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

Evaluate styleguide compliance validation tooling #34

Closed
pvdbosch opened this issue Jan 6, 2020 · 12 comments
Closed

Evaluate styleguide compliance validation tooling #34

pvdbosch opened this issue Jan 6, 2020 · 12 comments
Assignees
Milestone

Comments

@pvdbosch
Copy link
Contributor

pvdbosch commented Jan 6, 2020

In GitLab by @pvdbosch on May 17, 2019, 19:24

Provide tooling support to validate the compliance of OpenAPI to the styleguide, for checks that can be automated.

There was a PoC "styleguide-validationrules", but it was put on hold.
We're currently looking at using spectral.

Unsolved issues encountered when trying out the styleguide-validationrules:

  • NPE on external $ref with relative path - workaround by prefixing with "./". Issue reported on the maven plugin.
  • SemanticError at paths./health.get: All 4xx and 5xx should link to "#/definitions/Problem". For the health resource we may return 503 with non-problem body. This exception to the rule should be added.
  • SemanticError at b2b-env.ksz-bcss.fgov.be:4523: Should be in lowercase - for validation of host value. Seems like a bug.
  • SemanticError at $.info.version: The version number should be 'x.y'. A version number "1.0.0" fails, while it should be supported as patch version is optional
@pvdbosch
Copy link
Contributor Author

pvdbosch commented Jan 6, 2020

In GitLab by @pvdbosch on May 17, 2019, 19:50

I also got some weird error on problem-v1.yaml:

[ERROR] DefinitionSemanticError at InvalidParamProblem.invalidParams.items: reference InvalidParam cannot be found

[ERROR] DefinitionSemanticError at InvalidParamProblem: reference Problem cannot be found

I can't find the cause of this. Error seems to disappear when removing the allOf construct in InvalidParamProblem, but allOf doesn't cause problems when used in the main swagger file.

@pvdbosch pvdbosch added this to the in progress milestone Jan 9, 2020
@pvdbosch
Copy link
Contributor Author

Investigating if we'd rewrite the validation rules using spectral as tool, which is supported in stoplight studio.

@pvdbosch pvdbosch changed the title issues with styleguide-validationrules styleguide compliance validation tool Mar 25, 2020
pvdbosch added a commit that referenced this issue Mar 26, 2020
#34: remove styleguidevalidation-rules
@pvdbosch
Copy link
Contributor Author

I removed the styleguidevalidation-rules (+ maven plugin) from the guide.

@pvdbosch pvdbosch modified the milestones: in progress, backlog May 27, 2020
wsalembi pushed a commit that referenced this issue Jul 23, 2020
#34: remove styleguidevalidation-rules
@pvdbosch pvdbosch modified the milestones: backlog, in progress Mar 16, 2022
@pvdbosch
Copy link
Contributor Author

Someone at Smals is working on this.

There's also a tool by the developers of the openapi-generator:

Haven't checked yet how good it fits our needs.

@pvdbosch
Copy link
Contributor Author

@wsalembi , Italy has worked out on online OpenAPI validation tool based on Spectral.
They reached out to us in belgif/rest-security#21 ; it may be interesting to see what they developed and if it's interesting to work together on some aspects.

Links:

@pvdbosch
Copy link
Contributor Author

feedback from @wsalembi and colleagues:

  • Spectral: hard to bypass default checks, some guidelines cannot be expressed in spectral (e.g. check consistency between multiple elements in the OpenAPI file), another flavor of regexp that doesn't allow to express all types of lookups.
  • openapi-style-validator: hardcoded rules, not really extensible. Not mature enough.
  • Now working on a Java-based validation tool that uses drools rules, which allows full flexibility.

@pvdbosch
Copy link
Contributor Author

EC provides a validation framework:
https://joinup.ec.europa.eu/collection/interoperability-test-bed-repository/solution/interoperability-test-bed/detailed-information#capabilities

Doesn't support REST guide validation rules, but framework might be extensible enough to fit it in. To investigate; consider reaching out?

@pvdbosch
Copy link
Contributor Author

Progress has been made on the Java-based validation tool that can be executed from a maven plugin. @wsalembi will share the tool and its code with the WG participants for early feedback. The tools allows for extension with custom rules or deactivation of built-in rules.

@pvdbosch
Copy link
Contributor Author

first versions of validation tool are released, internally on git/artifactory gcloud. CBSS is interested to take a look at it, and perhaps contribute.

(there's also an openapi diff tool in development)

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Dec 7, 2022

@wsalembi will check if development of validation tool could be moved to GitHub (under Open Source license ASL 2.0). Binaries could be published then to maven central. Setup of github project can be done by CBSS participants.

@wsalembi will already share the binaries within the WG manually in the meantime.

@jpraet
Copy link
Contributor

jpraet commented Feb 20, 2023

@pvdbosch pvdbosch changed the title styleguide compliance validation tool Evaluate styleguide compliance validation tooling Jan 24, 2024
@pvdbosch
Copy link
Contributor Author

open-sourcing of the Smals tool will be followed up in #168; closing this issue

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

3 participants