Skip to content

Added Tests + Schema Updates#33

Merged
natalialuzuriaga merged 15 commits intomainfrom
nat/validation
Aug 20, 2025
Merged

Added Tests + Schema Updates#33
natalialuzuriaga merged 15 commits intomainfrom
nat/validation

Conversation

@natalialuzuriaga
Copy link
Copy Markdown
Contributor

@natalialuzuriaga natalialuzuriaga commented Aug 19, 2025

Problem

Another round of schema updates plus a new feature: added tests!

Solution

  • Schema: Made values lowercase in CMS schema
  • Schema: Add languages as a required field to generic schema since it can be easily automated
  • Updated this repo's code.json

Added tests to validate examples against the generic schema and CMS schema using thejsonschema CLI:

  • test/gov-schema.json validates CMS code.json files for compliance with the generic schema
  • test/cms-schema.json validates CMS code.json files for compliance with the CMS schema
  • examples.md point to tests and is up-to-date
  • Updated json-schema-tests workflow

This will assist us with keeping the repository up-to-date as we continue to make changes to the schemas in the future.

Result

Thanks to json-schema-tests workflow. every PR will run the 2 test suites defined in /schemas/test

Test Plan

json-schema-tests passed!

Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
@natalialuzuriaga natalialuzuriaga changed the title Schema Updates: Added Tests + Schema Updates Aug 19, 2025
Copy link
Copy Markdown
Contributor

@decause-gov decause-gov left a comment

Choose a reason for hiding this comment

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

I left a bunch of comments and questions in here, so I'll wait until we discuss then approve :)

This is foundational work Nat, thank you for leading the way 💡

Comment thread .github/workflows/json-schema-tests.yml
Comment thread code.json Outdated
Comment thread code.json
Comment thread code.json
Comment thread code.json Outdated
Comment thread docs/examples.md Outdated
Comment thread docs/examples.md Outdated
Comment thread docs/examples.md
Comment thread docs/examples.md Outdated
Comment thread schemas/test/gov-schema.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps I'm not understanding how these test work, but should we be reading these examples from elsewhere, like the actual schema file in the repo? If that's not a simple thing, then having it in two places is prolly fine, so long as we remember to update it in both places, but if we don't update both, then would it show the tests passing even if the examples or schemas outside the test have changed?

Copy link
Copy Markdown
Contributor Author

@natalialuzuriaga natalialuzuriaga Aug 20, 2025

Choose a reason for hiding this comment

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

True, we would have to update in both places. Re-reading the jsonschema CLI docs, I'm realizing that I can separate each test case in its own json file. I will rework the way we show our examples/tests then!

Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Copy link
Copy Markdown
Contributor

@decause-gov decause-gov left a comment

Choose a reason for hiding this comment

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

Thanks for answering all the questions. LGTM +1 🚢

Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
@natalialuzuriaga natalialuzuriaga merged commit a33d04f into main Aug 20, 2025
6 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