Skip to content

Commit

Permalink
Merge pull request #1506 from json-schema-org/gregsdennis/extract-pro…
Browse files Browse the repository at this point in the history
…pertydependencies2

Extract `propertyDependencies`
  • Loading branch information
gregsdennis committed May 22, 2024
2 parents 4075f2e + a48fd8d commit a8893b3
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jsonschema-*.txt
relative-json-pointer.html
relative-json-pointer.pdf
relative-json-pointer.txt
proposals/*.html

# For the Python enviornment
.venv
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ Labels are assigned based on [Sensible Github Labels](https://github.com/Releque
## Authoring and Building

### Specification
To build the spec files to HTML from the Markdown sources, run `npm run build`.
You can also build each individually with `npm run build-core` and `npm run
build-validation`.
To build the spec files to HTML from the Markdown sources, run `npm run
build-all`.
You can also build each individually with `npm run build -- filename.md`
(Example: `npm run build -- jsonschema-core.md`). You can also use wildcards to
build multiple specs at the same time: `npm run build -- jsonschema-*.md`.

The spec is built using [Remark](https://remark.js.org/), a markdown engine with
good support for plugins and lots of existing plugins we can use.
Expand Down
42 changes: 37 additions & 5 deletions build/build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 2 additions & 17 deletions jsonschema-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
Clients SHOULD be able to make requests with a "From" header so that server
operators can contact the owner of a potentially misbehaving script.

## A Vocabulary for Applying Subschemas
## A Vocabulary for Applying Subschemas {#applicatorvocab}

This section defines a vocabulary of applicator keywords that are RECOMMENDED
for use as the basis of other vocabularies.
Expand Down Expand Up @@ -1793,7 +1793,7 @@ successfully validates against its subschema. Implementations MUST NOT evaluate
the instance against this keyword, for either validation or annotation
collection purposes, in such cases.

##### `dependentSchemas`
##### `dependentSchemas` {#dependent-schemas}

This keyword specifies subschemas that are evaluated if the instance is an
object and contains a certain property.
Expand All @@ -1807,21 +1807,6 @@ property.

Omitting this keyword has the same behavior as an empty object.

##### `propertyDependencies`

This keyword specifies subschemas that are evaluated if the instance is an
object and contains a certain property with a certain string value.

This keyword's value MUST be an object. Each value in the object MUST be an
object whose values MUST be valid JSON Schemas.

If the outer object key is a property in the instance and the inner object key
is equal to the value of that property, the entire instance must validate
against the schema. Its use is dependent on the presence and value of the
property.

Omitting this keyword has the same behavior as an empty object.

### Keywords for Applying Subschemas to Child Instances

Each of these keywords defines a rule for applying its subschema(s) to child
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"main": "index.js",
"scripts": {
"lint": "eslint build/",
"build": "npm run build-core && npm run build-validation && npm run build-output",
"build-core": "node build/build.js < jsonschema-core.md > jsonschema-core.html",
"build-validation": "node build/build.js < jsonschema-validation.md > jsonschema-validation.html",
"build-output": "node build/build.js < jsonschema-validation-output-machines.md > jsonschema-validation-output-machines.html"
"build-all": "node build/build.js jsonschema-*.md proposals/*.md",
"build": "node build/build.js"
},
"license": "MIT",
"dependencies": {
Expand Down
Loading

0 comments on commit a8893b3

Please sign in to comment.