npm package: @resumerealm/open-resume-format
Description: Open Resume Format (ORF) is a standard based on JSON for representing resume (CV) data
Author: Dawid Wojda
Latest version: 0.0.1

# Open Resume Format (ORF)

ORF is a simple, open, and human-readable format for resumes. It is designed to be easy to read and write, and to be easily converted to other formats.

## TS types
This repo includes TS types for ORF files, which can be found in `src/version/YYYY-MM-DD/resume.d.ts`.

### Resume type
Example resume type from `2023-04-28` looks like below:

```ts
interface Resume {
  /**
   * The version of resume schema in format of date (YYYY-MM-DD)
   */
  version: string;
  
  professionalSummary: ProfessionalSummary;
  
  dataProcessingPermission: DataProcessingPermission;
  
  personalInformation: PersonalInformation;
  
  experience: Experience;
  
  education: Education;
  
  certifications: Certifications;
  
  projects: Projects;
  
  languages: Languages;
  
  skills: Skills;
  
  awardsAndHonors: AwardsAndHonors;
  
  volunteerExperience: VolunteerExperience;
  
  references: References;
  
  /**
   * Additional attributes of the resume, used also for custom plugins configuration
   */
  attributes: {
    [k: string]: unknown;
  };
  
}
```

### Examples

Resume type for specific version can be imported like this:

```ts
import type { Resume } from '@resumerealm/open-resume-format/lib/version/2023-04-28/resume.schema';

const myResume: Resume = {
    // ...
};
```

for latest version you can use `latest` instead of version:

```ts
import type { Resume } from '@resumerealm/open-resume-format/lib/version/latest/resume.schema';

const myResume: Resume = {
    // ...
};
```

You can also import versions or version date format, same date format is used across schema:

```ts
import {
    // date format
    DATE_VERSION_FORMAT,
    // array of all available versions
    openResumeVersions,
    // latest version
    openResumeLatestVersion,
} from '@resumerealm/open-resume-format';

// You can also import type of all available versions
import type {
    OpenResumeVersion
} from '@resumerealm/open-resume-format';


```


If you want to know the latest version of the schema 

## Schema
this repo includes a schema for ORF files, which can be found in `src/version/YYYY-MM-DD/resume.schema.json` alongside the TS typings for the ORF version. 
TS types are generated from the schema. 

The schema is written in [JSON Schema](https://json-schema.org/), and can be used to validate ORF files.

### Example

```shell
npm i ajv ajv-formats @resumerealm/open-resume-format
```

```ts
import addFormats from "ajv-formats"
import Ajv from "ajv";
import { getSchema } from '@resumerealm/open-resume-format';

const ajv = new Ajv();
addFormats(ajv);

async function main() {
    const fakeResumeObject = {};
    // schema is versioned by date, so you can provide any date and it will return the closest schema
    const schema = await getSchema('2023-04-29');
    // or 'latest' to get the latest schema
    // const schema = await getSchema('latest');
    const validate = ajv.compile(schema);
    const valid = validate(fakeResumeObject);
    
    if (!valid) {
        console.log('invalid data');
        return;
    }
    
    console.log('valid data');
}

main();
```

## Contributing

Contributions are welcome :)

### Adding a new version

just copy-paste the latest version folder from `src/version/YYYY-MM-DD`, change date to today's 
and update the json schema, everything else is autogenerated from the schema. 
Run the below command to generate types, utils and build the project:

```shell
npm run build:all
```

# TODO

- [ ] add tests for each version