Skip to content

Commit

Permalink
readme: Improve CONTRIBUTING.md formatting and instruction (#2519)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Oct 8, 2022
1 parent ca0016a commit f739ab0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

### <a name="catalog"></a>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
{
Expand Down Expand Up @@ -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

Expand All @@ -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.

0 comments on commit f739ab0

Please sign in to comment.