Skip to content

remove $schema restrictions from JSON #402

Closed

Description

@jkowalleck

allowing $schema in JSON files was a good idea - see #106
but pinning it to a certain value - as if it was a namespace - was just wrong.

this pinning prevents reusing JSON documents that adhere to multiple schemas.

lets take the following JSON:

{
  "$schema": "http://cyclonedx.org/schema/bom-1.3.schema.json",
  "bomFormat": "CycloneDX",
  "specVersion": "1.3",
  "components": []
}

see also:

"$schema": {
"type": "string",
"enum": [
"http://cyclonedx.org/schema/bom-1.5.schema.json"
]
},


This document IS valid to schema http://cyclonedx.org/schema/bom-1.3.schema.json.
This document WOULD also be valid to schema http://cyclonedx.org/schema/bom-1.5.schema.json, IF the $schema was removed from the document (since the $schema has an enum pining).

Let's make documents be able to be validated by upgraded schema-parsers.

The required change: remove the enum pinning from the $schema property.

Activity

  1. jkowalleck commented on Mar 18, 2024

    @jkowalleck
    MemberAuthor

    this change would also enable us to put $schema on our test data, without a need to change this with every bugfix/patch -- see #138

  2. added a commit that references this issue on Mar 23, 2024
    f866a54
  3. added a commit that references this issue on Apr 9, 2024
  4. added a commit that references this issue on Jan 27, 2026
  5. added 2 commits that reference this issue on Feb 23, 2026
    b2124de
    1d5c493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions