Open ChALkeR opened 1 year ago
Thanks for the report - yeah I was only aware that combining $ref
and $schema
weren't good, but I wasn't aware that other properties would get ignored.
To fix this sooner rather than later, I would like to add a Grunt task with some code they checks this stuff. Later, it might be worth creating (or finding) a larger tool to handle issues like this more generally
@hyperupcall not specifying $schema
is dangereous too, as when run in environments where default $schema
is draft-07
or below, those keywords would still be ignored and the problem would also arise.
This was changed only in draft/2019-09
(and onwards): https://json-schema.org/draft/2019-09/release-notes.html#core-vocabulary
The correct fix is to either specify draft/2019-09
+, or to use allOf
, i.e.:
{$ref, ...}
-> { allOf: [ { $ref}, { ... } ] }
or even { allOf: [ { $ref} ], ... }
As for the test, you can use this:
const { validator } = require('@exodus/schemasafe')
const fs = require('fs')
const path = require('path')
const dir = 'schemas/json'
const files = fs.readdirSync(dir).sort().map(x => path.join(dir, x))
const schemas = files.map(x => [x, JSON.parse(fs.readFileSync(x, 'utf-8'))])
for (const [name, schema] of schemas) {
try {
// validator(schema, { requireValidation: true })
validator(schema)
} catch (e) {
// if (e.message.startsWith('failed to resolve $ref:')) continue
console.log(name, ': ', e.message)
}
}
requireValidation
is recommended as it also checks if the schema is missing e.g. proper type checks / leaves something non-checked. It's much harder to achieve though.
Strong mode schema checks find a number of different mistakes across this database btw.
Non-anchored regexes that should likely be anchored:
schemas/json/BizTalkServerApplicationSchema.json : Should start with ^ and end with $: "\\w+[\\\\](\\w+\\.)*\\w+\\.dll" at #/properties/BizTalkAssemblies/items/properties/Path
schemas/json/helmfile.json : Should start with ^ and end with $: "[a-zA-Z\\d_-]+" at #/properties/environments
schemas/json/packer.json : Should start with ^ and end with $: "[a-zA-Z0-9_-]" at #/properties/variables
schemas/json/sarif-1.0.0.json : Should start with ^ and end with $: "[0-9]+(\\.[0-9]+){3}" at #/properties/fileVersion
schemas/json/sarif-2.0.0-csd.2.beta.2018-10-10.json : Should start with ^ and end with $: "[0-9]+(\\.[0-9]+){3}" at #/properties/fileVersion
schemas/json/sarif-2.0.0-csd.2.beta.2019-01-09.json : Should start with ^ and end with $: "[0-9]+(\\.[0-9]+){3}" at #/properties/dottedQuadFileVersion
schemas/json/sarif-2.0.0-csd.2.beta.2019-01-24.json : Should start with ^ and end with $: "[0-9]+(\\.[0-9]+){3}" at #/properties/dottedQuadFileVersion
schemas/json/sarif-2.0.0.json : Should start with ^ and end with $: "[0-9]+(\\.[0-9]+){3}" at #/properties/fileVersion
schemas/json/size-limit.json : Should start with ^ and end with $: "\\d+( ?(ms|s)|\\s*(B|kB|[MGTPEZY]i?B|KiB))" at #/items/allOf/0/properties/limit
Empty/ineffective regexes:
schemas/json/bitrise.json : Should start with ^ and end with $: ".*" at #/properties/envs/items
schemas/json/cloudify.json : Should start with ^ and end with $: "" at #
schemas/json/gcp-blueprint-metadata.json : Should start with ^ and end with $: ".*" at https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/bpmetadata/blueprint-metadata#/properties/labels
schemas/json/kustomization.json : Should start with ^ and end with $: ".*" at #/properties/commonAnnotations
Regexes that should be const
(otherwise e.g. foo1z0bar
passes for 1.0
:
schemas/json/azure-iot-edgeagent-deployment-1.0.json : Should start with ^ and end with $: "1.0" at #/properties/$edgeAgent/properties/properties.desired/properties/schemaVersion
schemas/json/azure-iot-edgeagent-deployment-1.1.json : Should start with ^ and end with $: "1.1" at #/properties/$edgeAgent/properties/properties.desired/properties/schemaVersion
schemas/json/azure-iot-edgehub-deployment-1.0.json : Should start with ^ and end with $: "1.0" at #/properties/$edgeHub/properties/properties.desired/properties/schemaVersion
schemas/json/azure-iot-edgehub-deployment-1.1.json : Should start with ^ and end with $: "1.1" at #/properties/$edgeHub/properties/properties.desired/properties/schemaVersion
schemas/json/azure-iot-edgehub-deployment-1.2.json : Should start with ^ and end with $: "1.2" at #/properties/$edgeHub/properties/properties.desired/properties/schemaVersion
Not sure, but barhttp://schemaForgbuz
likely shouldn't pass:
schemas/json/schema-org-action.json : Should start with ^ and end with $: "http://schema.org" at #/properties/@context
schemas/json/schema-org-contact-point.json : Should start with ^ and end with $: "http://schema.org" at #/properties/@context
schemas/json/schema-org-place.json : Should start with ^ and end with $: "http://schema.org" at #/properties/@context
I'm impressed by 1) how easy it is to find mistakes with this tool; and 2) how many mistakes are out there for so much time without even being noticed until now.
@madskristensen maybe it's a good idea to have a "schemasafe" check for pull requests on this repo, github actions could be used for that.
That would be super helpful
I added a separate lint()
mode in @exodus/schemasafe@1.1.1
:
const { lint } = require('@exodus/schemasafe')
const fs = require('fs')
const path = require('path')
const dir = 'schemas/json'
const files = fs.readdirSync(dir).sort().map(x => path.join(dir, x))
const schemas = files.map(x => [x, JSON.parse(fs.readFileSync(x, 'utf-8'))])
for (const [name, schema] of schemas) {
const errors = lint(schema) // lint(schema, { mode: 'strong' })
for (const e of errors) {
console.log(`${name}: ${e.message}`)
}
}
Exact messages and their format are experimental, but now it doesn't stop on the first error per schema and instead collects all of them.
Thanks for mentioning @exodus/schemasafe
, as far as I can tell, it's the only free software for linting JSON Schemas - it might be worth adding it to the official Json Schema resources page so others can use it.
I made a PR that adds integration of schemasfe, but it's behind a --lint
flag (for now) so new contributors don't get confused by the errors that they can't control.
Indeed, a integrating this into the GitHub Actions would be very useful. In fact I'm looking at the Actions, and I think I can improve it more generally, with exposing the various Grunt tasks and making it clear what is being checked. But before we can add this to the GitHub actions checks, I think it would be good to either fix or hide the current lint errors
So as I'm working on ripping out the tv4 validator (separate issue), I find through this issue that we have previously implemented SchemaSafe checking. That was 2021, so it might possible that the repository was not as well maintained and had fewer checks. Or the then-quality of the code made it more difficult to add individual validators.
In any case, thought it might be useful to mention. Very basic functionality of using SchemaSafe has already been merged, but for now it's undocumented because I don't want to encourage people using it until the reasons I mentioned earlier are resolved. #3105 and #3106 both contribute to making checking the schemas easier, and there is still more work to do.
I will close this PR once all schemasafe issues have been resolved or hidden.
@hyperupcall I wonder what were the exact issues you faced!
Partial report from the lint mode:
schemas/json/bukkit-plugin.json: Unprocessed keywords: ["type","items"] at https://json.schemastore.org/bukkit-plugin#/properties/children/additionalProperties
schemas/json/bukkit-plugin.json: Unprocessed keywords: ["type"] at #/properties/permissions/additionalProperties
schemas/json/cargo-make.json: Unprocessed keywords: ["type"] at #/properties/env_scripts/items
schemas/json/circleciconfig.json: Unprocessed keywords: ["enum"] at #/anyOf/0
schemas/json/circleciconfig.json: Unprocessed keywords: ["enum"] at #/anyOf/1
schemas/json/circleciconfig.json: Unprocessed keywords: ["enum"] at #/anyOf/2
schemas/json/circleciconfig.json: Unprocessed keywords: ["type","properties"] at #/additionalProperties
schemas/json/circleciconfig.json: Unprocessed keywords: ["type"] at #/properties/workflows/additionalProperties/properties/jobs/items/oneOf/1/additionalProperties
schemas/json/clangd.json: Unprocessed keywords: ["type"] at #/oneOf/0
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/create/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/poststart/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/update/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/delete/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/allOf/1/properties/cloudify.interfaces.lifecycle/properties/create/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/allOf/1/properties/cloudify.interfaces.lifecycle/properties/delete/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/create/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/poststart/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["enum"] at #/properties/cloudify.interfaces.lifecycle/properties/delete/properties/implementation
schemas/json/cloudify.json: Unprocessed keywords: ["type"] at #/properties/agent_config
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/argument-count
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/complex-logic
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/file-lines
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/method-complexity
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/method-count
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/method-lines
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/nested-control-flow
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/return-statements
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/similar-code
schemas/json/codeclimate.json: Unprocessed keywords: ["properties"] at #/properties/checks/properties/identical-code
schemas/json/codecov.json: Unprocessed keywords: ["type"] at #/properties/coverage/properties/status/properties/project/properties/default
schemas/json/codecov.json: Unprocessed keywords: ["type"] at #/properties/coverage/properties/status/properties/project/additionalProperties
schemas/json/codecov.json: Unprocessed keywords: ["type"] at #/properties/coverage/properties/status/properties/patch/anyOf/0
schemas/json/codecov.json: Unprocessed keywords: ["type"] at #/properties/coverage/properties/status/properties/changes
schemas/json/dependabot-2.0.json: Unprocessed keywords: ["type"] at #/properties/registries
schemas/json/drupal-libraries.json: Unprocessed keywords: ["type","properties","additionalProperties"] at #/additionalProperties/properties/js/additionalProperties
schemas/json/drupal-libraries.json: Unprocessed keywords: ["type","properties","additionalProperties"] at #/additionalProperties
schemas/json/fly.json: Unprocessed keywords: ["minLength"] at #/properties/ports/items/properties/handlers/items
schemas/json/foundryvtt-module-manifest.json: Unprocessed keywords: ["pattern"] at #/properties/manifest
schemas/json/foundryvtt-system-manifest.json: Unprocessed keywords: ["pattern"] at #/properties/manifest
schemas/json/foundryvtt-world-manifest.json: Unprocessed keywords: ["pattern"] at #/properties/manifest
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/community_bridge
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/issuehunt
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/ko_fi
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/liberapay
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/open_collective
schemas/json/github-funding.json: Unprocessed keywords: ["minLength"] at #/properties/otechie
schemas/json/github-funding.json: Unprocessed keywords: ["minLength","maxLength"] at #/properties/patreon
schemas/json/github-funding.json: Unprocessed keywords: ["pattern"] at #/properties/tidelift
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/check_run
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/check_suite
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/discussion
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/discussion_comment
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/issue_comment
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/issues
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/label
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/member
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/merge_group
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/milestone
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/project
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/project_card
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/project_column
schemas/json/github-workflow.json: Unprocessed keywords: ["properties","patternProperties","additionalProperties"] at #/properties/on/oneOf/2/properties/pull_request
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/pull_request_review
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/pull_request_review_comment
schemas/json/github-workflow.json: Unprocessed keywords: ["properties","patternProperties","additionalProperties"] at #/properties/on/oneOf/2/properties/pull_request_target
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/registry_package
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/on/oneOf/2/properties/release
schemas/json/github-workflow.json: Unprocessed keywords: ["properties","patternProperties"] at #/properties/on/oneOf/2/properties/workflow_run
schemas/json/github-workflow.json: Unprocessed keywords: ["properties"] at #/properties/steps/items/allOf/1/properties/with
schemas/json/helmfile.json: Unprocessed keywords: ["type"] at #/properties/commonLabels
schemas/json/helmfile.json: Unprocessed keywords: ["type"] at #/properties/missingFileHandler
schemas/json/hugo.json: Unprocessed keywords: ["type"] at #/properties/cascade/oneOf/0
schemas/json/jdt.json: Unprocessed keywords: ["additionalItems"] at #
schemas/json/jsonld.json: Unprocessed keywords: ["additionalItems"] at #/properties/@graph
schemas/json/label-commenter-config.json: Unprocessed keywords: ["properties"] at #/properties/labels/items
schemas/json/launchsettings.json: Unprocessed keywords: ["minLength"] at #/properties/commandName
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/min
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/max
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/allOf/2/then/properties/n
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["properties","allOf"] at #/allOf/3/then/properties/target
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/5/then/properties/levels
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type","properties"] at #/items/allOf/10/then/properties/limit
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/11/then/properties/count
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/12/then/properties/modifiers/items/additionalProperties/properties/amount
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type","items"] at #/items/allOf/12/then/properties/modifiers/items/additionalProperties/properties/slot
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/15/then/properties/count
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/16/then/properties/damage
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/17/then/properties/enchantments/additionalProperties
schemas/json/minecraft-item-modifier.json: Unprocessed keywords: ["type"] at #/items/allOf/22/then/properties/effects/items/additionalProperties/properties/duration
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/min
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/max
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["type"] at #/allOf/2/then/properties/n
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["properties","allOf"] at #/allOf/3/then/properties/target
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["type"] at #/properties/pools/items/properties/rolls
schemas/json/minecraft-loot-table.json: Unprocessed keywords: ["type"] at #/properties/pools/items/properties/bonus_rolls
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/min
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/1/then/properties/max
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/2/then/properties/n
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["properties","allOf"] at #/allOf/3/then/properties/target
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/max
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/min
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/effects/additionalProperties/properties/amplifier
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/effects/additionalProperties/properties/duration
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/count
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/durability
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/items/properties/levels
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/block/properties/state/properties/key
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/fluid/properties/state
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/light/properties/light
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/player/properties/level
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/properties/player/properties/stats/additionalProperties/properties/value
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/4/then/properties/scores/additionalProperties
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/14/then/properties/value
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/16/then/properties/value
schemas/json/minecraft-predicate.json: Unprocessed keywords: ["type"] at #/allOf/16/then/properties/range
schemas/json/minecraft-recipe.json: Unprocessed keywords: ["type"] at #
schemas/json/minecraft-recipe.json: Unprocessed keywords: ["type","items"] at #/properties/ingredient
schemas/json/minecraft-recipe.json: Unprocessed keywords: ["type"] at #/allOf/3/then/properties/ingredients/items/oneOf/0
schemas/json/minecraft-recipe.json: Unprocessed keywords: ["properties"] at #/allOf/5/then
schemas/json/minecraft-recipe.json: Unprocessed keywords: ["oneOf","properties"] at #/allOf/7/then
schemas/json/pre-commit-config.json: Unprocessed keywords: ["type","required"] at https://json.schemastore.org/pre-commit-config.json#/properties/hooks/items
schemas/json/pre-commit-config.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/pre-commit-config.json#/properties/hooks/items
schemas/json/prettierrc-1.8.2.json: Unprocessed keywords: ["type"] at #/properties/overrides/items/properties/options
schemas/json/prettierrc.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/prettierrc.json#/properties/overrides/items/properties/options
schemas/json/pyproject.json: Unprocessed keywords: ["type"] at #/properties/tool/properties/poetry/properties/dependencies/properties/python
schemas/json/sourcemap-v3.json: Unprocessed keywords: ["additionalItems"] at #/properties/sections
schemas/json/sourcemap-v3.json: Unprocessed keywords: ["additionalItems"] at #/patternProperties/^x_
schemas/json/stale.json: Unprocessed keywords: ["properties","type"] at #
schemas/json/swagger-2.0.json: Unprocessed keywords: ["additionalItems"] at http://swagger.io/v2/schema.json#
schemas/json/swagger-2.0.json: Unprocessed keywords: ["additionalItems"] at http://swagger.io/v2/schema.json#
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #/anyOf/0
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #/items/anyOf/0
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #/items
schemas/json/tslint.json: Unprocessed keywords: ["min"] at #
schemas/json/tslint.json: Unprocessed keywords: ["min"] at #/items
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #
schemas/json/tslint.json: Unprocessed keywords: ["minItems","maxItems","uniqueItems"] at #/items
schemas/json/utam-page-object-1.5.0.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/1
schemas/json/utam-page-object-1.5.0.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/2
schemas/json/utam-page-object-1.5.0.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/matcher
schemas/json/utam-page-object-1.5.0.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/compose/items
schemas/json/utam-page-object-2.0.3.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/1
schemas/json/utam-page-object-2.0.3.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/2
schemas/json/utam-page-object-2.0.3.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/matcher
schemas/json/utam-page-object-2.0.3.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/compose/items
schemas/json/utam-page-object.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/1
schemas/json/utam-page-object.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/oneOf/1/properties/value/anyOf/2
schemas/json/utam-page-object.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/matcher
schemas/json/utam-page-object.json: Unprocessed keywords: ["type"] at https://json.schemastore.org/utam-page-object.json#/properties/compose/items
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/0/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/3/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/4/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/6/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/7/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/8/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/9/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/vega.json: Unprocessed keywords: ["numItems"] at #/allOf/1/oneOf/10/properties/range/oneOf/3/properties/extent/oneOf/0
schemas/json/venvironment-basic-schema.json: Unprocessed keywords: ["type"] at #
schemas/json/venvironment-schema.json: Unprocessed keywords: ["type"] at #
schemas/json/vtesttree-schema.json: Unprocessed keywords: ["type"] at #
schemas/json/vtestunit-schema.json: Unprocessed keywords: ["type"] at #
schemas/json/workflows.json: Unprocessed keywords: ["type","minItems","maxItems"] at #
schemas/json/yamllint.json: Unprocessed keywords: ["properties","type"] at #
An update, schemasafe can now be ran using the following command:
node ./cli.js --schema-name=jscsrc.json lint
Area with issue?
JSON Schema
✔️ Expected Behavior
See https://github.com/ExodusMovement/schemasafe/issues/158#issuecomment-1653608034
In
draft-07
and below (below2019-09
),$ref
makes all sibling keywords ignored: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01#section-8.3Upstream testsuite: https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/8cdfac41e37527795879e480a483997cbd6188f3/tests/draft7/ref.json#L145-L177
❌ Actual Behavior
A number of schemas here don't check what they are supposed to, e.g. the following checks are noops/ignored in all JSON Schema implementations that pass on upstream testsuite:
github-workflow.json
:https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/github-workflow.json#L3
https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/github-workflow.json#L1017-L1031
properties
is a noop/ignored, with all nested checks.prettierrc.json
:https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/prettierrc.json#L2
https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/prettierrc.json#L378-L382
type
is a noop/ignored.stale.json
:https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/stale.json#L3-L4
https://github.com/SchemaStore/schemastore/blob/ac57222a5fba1f5b61643af38b1d402477a2ae83/src/schemas/json/stale.json#L91-L103
type
andproperties
are noops/ignored, with all nested checks.A number of other schemas.
The ones above are just examples, this seems wide-spread.
Passing all schemas through schemasafe should highlight all issues — it refuses to compile such schemas in default configuration (unless schema mistakes are silenced).
YAML or JSON file that does not work.
No response
IDE or code editor.
None
Are you making a PR for this?
No, someone else must create the PR.