Replies: 3 comments
|
I have this same problem... I spent some time setting up spectral only to learn that by default it won't do anything. I was kind of expecting some basic rules like "description must be set in specific cases", "object properties must be camelCased" or some complex checks to rule out impossible situations like |
|
I just built this custom function, it's a bit of a poor man's implementation of JSON schema validation, but it does just what i need it to do: https://github.com/erwinkramer/bank-api/blob/main/.spectral/functions/well-formed-object.js |
|
I've created json-schema-validate; a package that combines swagger-parser (for structural validation + circular detection) and Spectral (for quality rules) to properly handle what both tools alone can't do. What it validates
|
Uh oh!
There was an error while loading. Please reload this page.
Validating an OpenAPI specification file is as simple as putting
extends: "spectral:oas"into a.yamlfile, and passing this in as a parameter when callingspectral lint.I have a use case where I don't have an OpenAPI specification inside a file, but just a plain JSON schema which I'd check for consistency? Is that possible? Given the fact that the
spectral:oasruleset relies on JSON Schema, and thedraft-2020-12JSON schema definition is even included in the source tree, this should be rather straight-forward, right? Is it exposed as functionality somewhere? I tried usingspectral:jsonschemaandspectral:json-schema, but none of these worked.All reactions