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

Add GitHub action for deeper schema validation of PRs #830

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

query-jeremy
Copy link
Contributor

@query-jeremy query-jeremy commented Oct 19, 2023

Related Issue:

N/A

Description of changes:

This PR adds a GitHub action to perform deeper validation to pushes and pull requests.

The following tests will be performed on future pull requests:

  • The schema is readable and all JSON is valid. [FATAL]
  • The directory structure meets expectations. [WARNING]
  • The targets in $include, profiles, and extends directives can be found. [ERROR]
  • All required attributes in schema definition files are present. [WARNING]
  • There are no unrecognized attributes in schema definition files. [WARNING]
  • All attributes in the attribute dictionary are used. [WARNING]
  • There are no name collisions within a record type. [WARNING]
  • All attributes are defined in the attribute dictionary. [WARNING]

If any ERROR or FATAL tests fail, the validator exits with a non-zero exit code and merging will be blocked (probably).

The validator is published to PyPi. Its source can currently be found at https://github.com/query-ai/ocsf-validator, but can be relocated to an OCSF repository without impacting this workflow.

The new GitHub action was tested locally with act.

Signed-off-by: Jeremy Fisher [email protected]

@floydtree floydtree self-requested a review October 19, 2023 21:45
@zschmerber
Copy link
Contributor

tested and worked beautifully

SUMMARY
   PASSED: Schema definitions can be loaded
   PASSED: Schema types can be inferred
   PASSED: Dependency targets are resolvable and exist 

zschmerber
zschmerber previously approved these changes Oct 19, 2023
Copy link
Contributor

@zschmerber zschmerber left a comment

Choose a reason for hiding this comment

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

LGTM

@floydtree floydtree added enhancement New feature or request framework Structures, conventions, requirements, data types, etc. labels Oct 20, 2023
@floydtree
Copy link
Contributor

Looks good! For later, we should get publish the validator in a repo within the OCSF org.

@query-jeremy
Copy link
Contributor Author

we should get publish the validator in a repo within the OCSF org.

That would be my preference. I'd also like publishing control of the PyPi package to belong to the OCSF community. When the repo moves I'll wire up a GitHub action to publish to PyPi.

For now, this GitHub action pulls it from PyPi, so the source can move without effecting the action.

@floydtree floydtree requested review from alanisaac, zschmerber, mikeradka and jp-harvey and removed request for alanisaac November 9, 2023 22:03
Copy link
Contributor

@mikeradka mikeradka left a comment

Choose a reason for hiding this comment

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

LGTM

@mikeradka mikeradka merged commit 7ec5f48 into ocsf:main Nov 15, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request framework Structures, conventions, requirements, data types, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants