Skip to content

The definitions field in JSONSchemaObject has the wrong type and JSON name #471

@smoyer64

Description

@smoyer64

Describe the bug
The definitions field in JSONSchemaObject has the wrong type and JSON name. According to the jsonschema specification, this type (given the meta-schema code) should be map[string]JSONSchema and when marshaled to JSON, the object's field should be $defs. See https://www.learnjsonschema.com/2020-12/core/defs/.

To Reproduce
Add one or more definitions to a JSONSchema and marshal to JSON.

Expected behavior
The output should conform to the specification and should be reported as a valid JSON schema. The definitions field is named "definitions" instead of "$defs" and validation fails (or the definitions field is considered additional properties).

Screenshots
N/A

Desktop (please complete the following information):

  • OS: N/A
  • Browser N/A
  • Version N/A

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser N/A
  • Version N/A

Additional context
This is clearly a breaking change but one is needed to comply with the specifications. Assign this to me if you want me to make the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions