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

Spectral ruleset to validate pattern files #95

Closed
willosborne opened this issue Apr 3, 2024 · 3 comments
Closed

Spectral ruleset to validate pattern files #95

willosborne opened this issue Apr 3, 2024 · 3 comments
Assignees
Milestone

Comments

@willosborne
Copy link
Member

willosborne commented Apr 3, 2024

Feature Request

Add a new ruleset to validate pattern files, with the same functionality as the existing one (which only supports instantiations).

Description of problem

Currently we have no spectral rulesets to validate pattern files

Potential solutions

Make new ruleset to validate patterns with same checks as existing ruleset.

@willosborne
Copy link
Member Author

I've run into a wall with this. Spectral aggressively follows $ref files, treating them as actual objects in the document, rather than as an indication the schema for section of the document. This means that if you run into a $ref it just immediately resolves the reference from the meta schema and tries to validate that - which is obviously not what we want to do. I can't seem to disable this - see stoplightio/spectral#2195

Not quite sure how to proceed; one option would be to trim $ref links from the document before validation, which we'd need to do in the CLI. @lbulanti-ms what do you think about this?

@lbulanti-ms
Copy link
Member

I've run into a wall with this. Spectral aggressively follows $ref files, treating them as actual objects in the document, rather than as an indication the schema for section of the document. This means that if you run into a $ref it just immediately resolves the reference from the meta schema and tries to validate that - which is obviously not what we want to do. I can't seem to disable this - see stoplightio/spectral#2195

Not quite sure how to proceed; one option would be to trim $ref links from the document before validation, which we'd need to do in the CLI. @lbulanti-ms what do you think about this?

@willosborne and I have been looking into this and we think that removing the $refs at validation time is a good work around. We managed to achieve that with a script, we are planning to use the same approach in the cli. This means that we won't be able to validate the patterns directly from spectral but we will need to use the calm cli.

@rocketstack-matt rocketstack-matt moved this from Todo to In Progress in Architecture as Code Project Board Apr 22, 2024
grahampacker-ms added a commit to grahampacker-ms/architecture-as-code that referenced this issue Apr 26, 2024
grahampacker-ms added a commit that referenced this issue Apr 26, 2024
Issue #95 - Strip  from patterns when validating with spectral
@grahampacker-ms grahampacker-ms moved this from In Progress to Done in Architecture as Code Project Board Apr 26, 2024
@willosborne
Copy link
Member Author

This is done. We solved this problem by stripping $refs when validating patterns in the CLI, and including a script to do the same for CI tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants