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

Feature: Support Multiple Schemas #7

Open
GrantBirki opened this issue Apr 28, 2023 · 4 comments
Open

Feature: Support Multiple Schemas #7

GrantBirki opened this issue Apr 28, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@GrantBirki
Copy link
Owner

Feature: Support Multiple Schemas

This issue tracks work related to supporting multiple features in this Action. It has been brought to my attention (#6) that users are looking for a way to validate multiple files with multiple schemas.

Success Criteria:

  • Allow multiple schemas to be 'inputted' into this Action
  • Add a mapping of schema -> file so that the correct files are validated with the correct schemas
  • Update tests to support this use case
@Can-Sahin
Copy link

Cool. I think selecting json files explicity via input is the right way. I don't want all json files to be checked and I have different schemas for each file I want to be checked. Just sharing a real-life use case ;)

@andy-lawler-sbg
Copy link

Has this been actioned upon yet? Currently hit a road block with this action because I'm specifying one single file and it's attempting to validate everything.

@GrantBirki GrantBirki added the help wanted Extra attention is needed label Sep 7, 2023
@GrantBirki
Copy link
Owner Author

@andy-lawler-sbg It has not been completed yet. I have to prioritize other work at the moment and I'm not able to add this change. Pull requests are welcome though!

That being said, there are a couple of ways around this. You can tweak the inputs of this Action (either through the base_dir or one of the "exclude" options) to only validate or run against specific files. Then you could have a second (or more) workflows running with different schemas and pointing at different files that use said schemas. Its not pretty but it is a work around until this feature is added.

@michelverheijen
Copy link

michelverheijen commented Oct 21, 2024

@GrantBirki Adding the options json_include_regex and yaml_include_regex as a first step would also really help, especially if your JSON files are all in the same directory and if you have multiple schemas (so your json_exclude_regex becomes (too) complex).

Then you could do the following:

jobs:
  validate-json:
    name: Validate JSONs
    steps:
      - uses: actions/checkout@v4

      - name: Validate index JSON files
        id: index-json-validate
        uses: GrantBirki/[email protected]
        with:
          json_schema: ./schemas/index-schema.json
          base_dir: ./data
          # Validate files with prefix index_ and suffix .json
          json_include_regex: 'index_.*\.json$'
  
      - name: Validate topic JSON files
        id: topic-json-validate
        uses: GrantBirki/[email protected]
        with:
          json_schema: ./schemas/topic-schema.json
          base_dir: ./data
          # Validate files with prefix topic_ and suffix .json
          json_include_regex: 'topic_.*\.json$'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants