Skip to content

Repository files navigation

@prosperis/resume-format

TypeScript types for the JSON Resume schema, a compiled JSON Schema for validation, and a lossless bidirectional mapper between JSON Resume documents and the ResumeContent type used by @prosperis/resumes.

Use this package to import a standard JSON Resume file into the builder, or to export builder content back out to the interoperable JSON Resume format.

Install

bun add @prosperis/resume-format
# or: npm install @prosperis/resume-format

@prosperis/resumes is a peer dependency — install it alongside this package.

Usage

Import a JSON Resume into the builder

import { jsonResumeToResumeContent } from "@prosperis/resume-format";
import { ResumeBuilder, DEFAULT_STYLE_CONFIG } from "@prosperis/resumes";
import "@prosperis/resumes/styles.css";
import { useState } from "react";
import type { ResumeContent, StyleConfig } from "@prosperis/resumes";

// A JSON Resume document — from a file, an API, or user input.
import myJsonResume from "./my-resume.json";

export function Editor() {
  const [content, setContent] = useState<ResumeContent>(
    () => jsonResumeToResumeContent(myJsonResume),
  );
  const [style, setStyle] = useState<StyleConfig>(DEFAULT_STYLE_CONFIG);

  return (
    <ResumeBuilder
      content={content}
      style={style}
      onChange={setContent}
      onStyleChange={setStyle}
    />
  );
}

Export builder content back to JSON Resume

import { resumeContentToJsonResume } from "@prosperis/resume-format";

const jsonResume = resumeContentToJsonResume(content);

Validate a JSON Resume document

import { validateJsonResume } from "@prosperis/resume-format";

const { valid, errors } = validateJsonResume(unknownData);
if (!valid) {
  console.error("Invalid JSON Resume:", errors);
}

API

jsonResumeToResumeContent(input: JsonResume): ResumeContent

Converts a JSON Resume document into the ResumeContent shape expected by <ResumeBuilder>. The mapping is lossless for every field the Prosperis ecosystem uses: personal info, work experience, education, skills, certificates, projects, awards, and social profiles.

resumeContentToJsonResume(content: ResumeContent): JsonResume

The inverse operation. Converts ResumeContent back to a well-formed JSON Resume document. Round-tripping through both directions is lossless for all mapped fields.

validateJsonResume(data: unknown): { valid: boolean; errors: string[] }

Validates an unknown value against the bundled JSON Resume JSON Schema (powered by Ajv). Returns a valid flag and a list of human-readable error messages.

JsonResume type

The full TypeScript type for a JSON Resume document. All fields are optional in accordance with the spec.

import type { JsonResume } from "@prosperis/resume-format";

Dependencies

Package Role
@prosperis/resumes Provides the ResumeContent type (peer dependency)
ajv JSON Schema validation

Development

bun install
bun run typecheck   # tsc --noEmit
bun run test        # vitest
bun run build       # typecheck + vite lib build → dist/

License

MIT

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages