Skip to content

Conversation

@Karan-Palan
Copy link
Contributor

@Karan-Palan Karan-Palan commented Jul 1, 2025

This PR introduces two key improvements to the rule.schema.json and
ruleset.schema.json files to enhance their compliance and reduce redundancies:

  1. JSON Schema Draft 7 Compatibility (Fixes issue The schemas follow the JSON Schema Draft 7 dialect but make use of the $defs keyword #669):

    • Updated all instances of $defs to definitions and their corresponding
      $ref pointers.
    • The $defs keyword was introduced in JSON Schema 2019-09, making it
      incompatible with the declared Draft 7 schemas. This change ensures
      schemas compile correctly with strict evaluators like Blaze.
    • This is a purely syntactic update with no semantic changes.
  2. Remove Redundant 'type' Declarations with 'enum':

    • Eliminated the anti-pattern of explicitly declaring type: "string"
      alongside enum for properties in both schemas.
    • The enumeration choices inherently imply their respective types, making
      the explicit type declaration redundant.
    • This improves schema correctness, readability, and adherence to JSON
      Schema best practices.

These combined changes lead to more robust and compliant schema definitions.

image

Note: These auto-fixes were made with the help of sourcemeta's jsonschema cli , we are improving the linter and defining linting rules as part of a GSoC project. If helpful, I could help integrate the linter with the schemas in the repo, so it can help flag and fix redundancies and errors

@Karan-Palan Karan-Palan changed the title update schemas Fix(ruleset): [schema] Enhance schema compliance and remove redundancies Jul 1, 2025
@Karan-Palan Karan-Palan marked this pull request as ready for review July 1, 2025 18:29
@daveshanley
Copy link
Owner

daveshanley commented Jul 9, 2025

Hey cool! Yeah, if you want to add schema linting, that would be great. just don't lint test specs, they can't be fixed or changed :)

@daveshanley daveshanley added the release/patch Patch / non-breaking release label Jul 9, 2025
Copy link
Owner

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

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

Nice.

I took this from spectral's ruleset schema and modified it for my own needs, I would also go see if they need help too!

@Karan-Palan
Copy link
Contributor Author

Hey cool! Yeah, if you want to add schema linting, that would be great. just don't lint test specs, they can't be fixed or changed :)

@daveshanley, another project named krakend uses the cli in their workflow - https://github.com/krakend/krakend-schema/blob/main/.github/workflows/validate-json-schema.yml

I'll add something like that to the project :)

@daveshanley daveshanley removed the release/patch Patch / non-breaking release label Aug 5, 2025
@daveshanley daveshanley merged commit 4d47bda into daveshanley:main Aug 5, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants