Skip to content

Commit af47518

Browse files
authored
Update JSON Schema to be v1.0 compliant (#1600)
* Update JSON Schema to be v1.0 compliant * Update schema to be more reusable * Add schema to validate a request that update a resource or a relationship * Change naming convention and folder structure to be more consistent * Enhance reusability * Lint test files * Fix typo * Update JSON Schema to be v1.0 compliant * Update schema to be more reusable * Add schema to validate a request that update a resource or a relationship * Change naming convention and folder structure to be more consistent * Change all title to more neutral text. Add meta member to all test files with informations about errors present in the document. * Add script to valide JSON schema against all test files and update schemas based on the results of the script. * Add documentation on how to run the tests for the JSON Schemas * Update validation script of JSON Schema so that validation is also done using files from previous versions * script linting * Revert "script linting" This reverts commit 8ce88f1. * Script linting * Enhance script output * Enhance readability * Add -f and -v options to test script * Fix typo * Add test-schema to CI * Fix typo in bash command to run script * Change trigger for the "Schema validation test" workflow * Allow for parallel relationships in JSON Schema * Bump ajv version * Update to latest version of json-schema * Remove node_modules
1 parent 40329de commit af47518

File tree

105 files changed

+3261
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3261
-397
lines changed

.github/workflows/node.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Schema validation tests
2+
3+
on:
4+
push:
5+
branches: [ gh-pages, schema-1.0 ]
6+
pull_request:
7+
branches: [ gh-pages ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [16.x]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
- name: Install dependencies
25+
run: npm ci
26+
- name: Test schemas
27+
run: npm run test-schema

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ Gemfile.lock
2525
/bin
2626
/b
2727
.rbx
28+
29+
# Ignore the node_modules directory
30+
31+
/node_modules

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,28 @@ place. Ideas for new extensions and questions about how to correctly implement
1717
or consume an API that adheres to the JSON:API specification belong here.
1818

1919
[about]: http://jsonapi.org/about
20+
21+
## JSON Schema
22+
If you would like to update the JSON schemas, you must first install the node.js dependencies :
23+
24+
`
25+
npm install
26+
`
27+
28+
Then you can run the schema validator by running one of the following commands :
29+
30+
`
31+
node ./_schemas/scripts/validator.js
32+
`
33+
34+
or
35+
36+
`
37+
npm run test-schema
38+
`
39+
40+
This script validates all test files against all available versions of the specification.
41+
Some options can be used :
42+
- `--verbose` : allows more verbose output.
43+
- `-f relative-path` : the relative path of the only file to test. For example : `npm run test-schema -- -f _schemas/1.0/response/valid/with_success/complete.json`
44+
- `-v version` : the version of the specification to use to test the files. For example : `npm run test-schema -- -v 1.0`

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy