Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #828

Merged
merged 2 commits into from
Nov 26, 2024
Merged

Tests #828

merged 2 commits into from
Nov 26, 2024

Conversation

tschmidtb51
Copy link
Contributor

  • fixes Add $schema to testcases_json_schema.json #824
  • add missing $schema to testdata schema for CSAF 2.1
  • disallow additional properties for CSAF 2.1
  • add missing $schema to testdata schema for CSAF 2.0
  • disallow additional properties for CSAF 2.0

- addresses parts of oasis-tcs#824
- add missing `$schema` to testdata schema for CSAF 2.1
- disallow additional properties for CSAF 2.1
- addresses parts of oasis-tcs#824
- add missing `$schema` to testdata schema for CSAF 2.0
- disallow additional properties for CSAF 2.0
@tschmidtb51 tschmidtb51 added csaf 2.0 csaf 2.0 work test related to tests in this repo csaf 2.1 csaf 2.1 work labels Nov 18, 2024
@tschmidtb51 tschmidtb51 requested a review from sthagen November 18, 2024 23:29
@tschmidtb51 tschmidtb51 self-assigned this Nov 18, 2024
@tschmidtb51
Copy link
Contributor Author

@milux / @oxisto: Please review

Copy link
Contributor

@sthagen sthagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@milux
Copy link

milux commented Nov 26, 2024

The only section of JSON Schema Core that - according to my understanding - could be deemed relevant for this discussion states the following (emphasis mine):

The "$schema" keyword SHOULD be used in the document root schema object, and MAY be used in the root schema objects of embedded schema resources. It MUST NOT appear in non-resource root schema objects. If absent from the document root schema, the resulting behavior is implementation-defined.

However, the sentence emphasized refers to "non-resource root schema objects", whereas we talk about JSON documents only described by a schema. I therefore would see this as not applicable.

Furthermore, there is (or rather was) the discussion about general usage of $schema in JSON documents in order to make them "self-validating" (https://github.com/orgs/json-schema-org/discussions/473).
As pointed out by jdesrosiers there, at least 2 good arguments against that approach do exist (emphasis mine):

IMO the main argument against defining $schema as a special value in JSON documents is that it means you can't use $schema in a way other than the special meaning we define. One of the core principles of JSON Schema is that it allows you to describe any JSON document. You wouldn't be able to express a JSON document that has a $schema property because it would conflict with a $schema keyword with special meaning.
Another limitation of this approach is that it would only work for objects. JSON Schema can represent other types at the root as well and there would still need to be some way to externally associate a JSON document with its schema.

However, none of this arguments prohibits the usage of $schema as a specified attribute for JSON documents. On the contrary, a reversal of jdesrosiers' first argument would mean that specifying a document with a $schema property should be perfectly valid.

I therefore currently don't see any reason that prevents us from specifying it that way.

@tschmidtb51
Copy link
Contributor Author

@milux Thank you for the information. As I don't see a big stop sign here, I'm going to merge that now.

@tschmidtb51 tschmidtb51 merged commit 291050d into oasis-tcs:master Nov 26, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csaf 2.0 csaf 2.0 work csaf 2.1 csaf 2.1 work test related to tests in this repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add $schema to testcases_json_schema.json
4 participants