diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bdc9f8d7780..4e43fd4fc90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,13 +15,14 @@ used or has potential for broad uptake. Keep single source of truth. Do not copy an external schema here, but point the catalog to the external schema. If you don't have Visual Studio (using macOS or Linux?), you can check your modifications are fine by running: + ```sh make ``` ### Adding to catalog -After adding schema files, register them in alphabetical order in [schema catalog](src/api/json/catalog.json) by adding an entry corresponding to your schema: +After adding a schema file in `src/schemas`, register them in alphabetical order in the [schema catalog](src/api/json/catalog.json) by adding an entry corresponding to your schema: ```json { @@ -75,14 +76,14 @@ If the build succeeds, your changes are valid and you can safely create a PR. If you wish to retain full control over your schema definition, simply register it in the [schema catalog](src/api/json/catalog.json) by providing a `url` pointing to the self-hosted schema file to the [entry](#catalog). Example on how to handle [multiple schema versions.](https://github.com/SchemaStore/schemastore/pull/2057#issuecomment-1024470105) -### Ref from schema x.json to schema y.json +### How to `$ref` from `schema_x.json` to `schema_y.json` - Both schemas must exist [locally](src/schemas/json) in SchemaStore. - Both schemas must have the same draft (example draft-04) -- Schema y.json must have `id` or `$id` with this value `"https://json.schemastore.org/y.json"` -- In schema x.json add ref to schema y.json `"$ref": "https://json.schemastore.org/y.json#..."` -- [schema-validation.json](src/schema-validation.json) in "options": [] list add - `"x.json": {"externalSchema": ["y.json"]}` +- `schema_y.json` must have `id` or `$id` with this value `"https://json.schemastore.org/schema_y.json"` +- In `schema_x.json`, add ref to `schema_y.json`: `"$ref": "https://json.schemastore.org/schema_y.json#..."` +- In [schema-validation.json](src/schema-validation.json), in `"options": []` list add + `"schema_x.json": {"externalSchema": ["schema_y.json"]}` ### JSON formatter @@ -92,10 +93,12 @@ If your IDE or code editor doesn't natively support it, please install the [Edit ### Validation mode SchemaStore supports three types of schema validation mode. + - [Full strict mode](https://ajv.js.org/strict-mode.html) via AJV validator (SchemaStore default mode) - Not fully strict mode via AJV validator. (The json filename is present in the `ajvNotStrictMode` list in [schema-validation.json](src/schema-validation.json)) - Validation via [tv4](https://github.com/geraintluff/tv4) (The json filename is present in the `tv4test` list in [schema-validation.json](src/schema-validation.json)) -### Avoid common PR problem: +### Avoid common PR problems + - git merge conflict in catalog.json because you added the item to the end of the list instead of alphabetically. - Prettier build server failed because the PR was created/push from an organization and not from your own account.