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

Pattern api-gateway.json does not conform to JSON Schema draft 2020-12 #74

Closed
lbulanti-ms opened this issue Mar 22, 2024 · 4 comments
Closed
Assignees

Comments

@lbulanti-ms
Copy link
Member

lbulanti-ms commented Mar 22, 2024

Bug Report

The api-gateway.json does not conform to the JSON Schema Draft 2020-12. As mentioned in the release notes the items keyword changed to prefixItems.

Additional Context:

This issue has been discovered while trying out the AJV library to validate the pattern schema against the CALM meta-schema

@rocketstack-matt rocketstack-matt self-assigned this Mar 22, 2024
@rocketstack-matt
Copy link
Member

@lbulanti-ms do you mean that the core schema is wrong, which then correspondingly means the pattern is wrong or just the pattern? I think the former.

It would be great if you could show the code section and also what you ran to perform the validation if that is something that would be reproducible so that the person fixing the bug could validate they had done it correctly.

@lbulanti-ms
Copy link
Member Author

lbulanti-ms commented Mar 22, 2024

While there are other known issues with the core.json meta-schema(we raised a separate issue #75), this particular issue refers to the section below which uses the items key instead of the prefixItems key.

    "nodes": {
      "type": "array",
      "minItems": 3,
      "items": [
        {
          "$ref": "https://raw.githubusercontent.com/finos-labs/architecture-as-code/main/calm/draft/2024-03/meta/core.json#/defs/node",
          "properties": {
            "ingress-host": {
              "type": "string"
            },
            ...

To validate the schema I used the AJV library. I ran this command
ajv compile -s api-gateway.json -r core.json -r calm.json --spec=draft2020 --strict=false (we are not sure if we want to use the strict mode, so I set that to false while testing)
The error I am getting is schema api-gateway.json is invalid error: schema is invalid: data/properties/nodes/items must be object,boolean

I am planning to raise a PR to fix this issue.

@rocketstack-matt
Copy link
Member

Thanks @lbulanti-ms so the issue you're looking at is in the pattern itself, but I think we have the same issue in the core schema itself.

"properties": {
    "nodes": {
      "type": "array",
      "items": {
        "$ref": "#/defs/node"
      }
    },
    "relationships": {
      "type": "array",
      "items": {
        "$ref": "#/defs/relationship"
      }
    },
    "required": [
      "nodes",
      "relationships"
    ]
  }

Do you agree?

@lbulanti-ms
Copy link
Member Author

@rocketstack-matt yes correct. I agree with you. The properties section of the core schema seems to have a couple of issues. Thank you for pointing this out!

lbulanti-ms pushed a commit to lbulanti-ms/architecture-as-code that referenced this issue Mar 25, 2024
…ms keyword instead of items as per JSON Schema 2020-12
lbulanti-ms pushed a commit to lbulanti-ms/architecture-as-code that referenced this issue Mar 26, 2024
rocketstack-matt added a commit that referenced this issue Mar 26, 2024
* #74 - Updating the api-gateway.json pattern to use the prefixItems keyword instead of items as per JSON Schema 2020-12

* Only run spectral validation on json and yaml files.

* #74 - Adding placeholder values to api-gateway-implementation.json

* Update api-gateway-implementation.json

Remove the parties element which was removed form the schema.

---------

Co-authored-by: Luigi Bulanti <[email protected]>
Co-authored-by: Matthew Bain <[email protected]>
Co-authored-by: rocketstack-matt <[email protected]>
Budlee pushed a commit to Budlee/architecture-as-code that referenced this issue Apr 1, 2024
…inos#79)

* finos#74 - Updating the api-gateway.json pattern to use the prefixItems keyword instead of items as per JSON Schema 2020-12

* Only run spectral validation on json and yaml files.

* finos#74 - Adding placeholder values to api-gateway-implementation.json

* Update api-gateway-implementation.json

Remove the parties element which was removed form the schema.

---------

Co-authored-by: Luigi Bulanti <[email protected]>
Co-authored-by: Matthew Bain <[email protected]>
Co-authored-by: rocketstack-matt <[email protected]>
rocketstack-matt added a commit that referenced this issue Apr 7, 2024
* #55 initial prototype of the CALM translator service

* #55 Additional changes to the prototype translator to tidy up the c4 endpoints

* #55 move project to be top level and add a README

* #55 Fix to reference to calm schema from chaninging top level project

* #55 Add dockerfile to containerize the application

* Improvement to code to handle multiple software systems

* #86 Update README

* #86 Remove supress warnings annotation

* Fix translator action

* Fix translator action and checkin breaking test to confirm - test wil be removed before merge.

* Update TestC4ModelTranslatorShould.java

Removing the breaking test now we have proof it failed.

* #35 Add manual spectral action  (#68)

* #35 Add manual spectral validation action

* Fix indentation

* Modify triggers for job

* Validate samples instead of bad document

* Change sample again to trigger build

* PR feedback

* Bump webpack-dev-middleware from 5.3.3 to 5.3.4 in /docs (#78)

Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md)
- [Commits](webpack/webpack-dev-middleware@v5.3.3...v5.3.4)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* created core cli (#53) (#80)

* #74 - Updating the api-gateway.json pattern to use prefixItems (#79)

* #74 - Updating the api-gateway.json pattern to use the prefixItems keyword instead of items as per JSON Schema 2020-12

* Only run spectral validation on json and yaml files.

* #74 - Adding placeholder values to api-gateway-implementation.json

* Update api-gateway-implementation.json

Remove the parties element which was removed form the schema.

---------

Co-authored-by: Luigi Bulanti <[email protected]>
Co-authored-by: Matthew Bain <[email protected]>
Co-authored-by: rocketstack-matt <[email protected]>

* #42 removed old visualizer to make room for the new one (#83)

* Fix spectral rules (#81)

* #42 included initial visualization command in CLI (#85)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: rocketstack-matt <[email protected]>
Co-authored-by: Matthew Bain <[email protected]>
Co-authored-by: Will Osborne <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aidan McPhelim <[email protected]>
Co-authored-by: Luigi Bulanti <[email protected]>
Co-authored-by: Luigi Bulanti <[email protected]>
Co-authored-by: jpgough-ms <[email protected]>
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

No branches or pull requests

3 participants