Fix 867 by rejecting unsupported OpenAPI specs#1708
Conversation
This kinda fixes #867 by rejecting specs that we know we can't parse. We only support 3.0.x openAPI specs, which must have the `openapi` property as semver at the top level. Exit with an error if `openapi` is not present. This will be the case for Swagger specs. Exit with an error if major version != 3 Exit with an error if minor version != 0 Stop using the word Swagger in function names where we can help it.
jamietanna
left a comment
There was a problem hiding this comment.
Is this not going to be a breaking change? Given we've had to update our test files
Does this impact cases we've got partial specs (ie for external refs)?
I'd seen that when I started with #713
Yes. It is indeed a breaking change, and one I wanted your opinion on. A more compatible way would be to shim ourselves into the loading path in Kin somehow, and only complain if there's a known incompatible version present, and accept specs without versions. Let me have a second go at it... |
| swagger, err := util.LoadSwagger(flag.Arg(0)) | ||
| spec, err := util.LoadOpenAPI(flag.Arg(0)) | ||
| if err != nil { | ||
| errExit("error loading swagger spec in %s\n: %s\n", flag.Arg(0), err) |
There was a problem hiding this comment.
Shouldn't be this?
| errExit("error loading swagger spec in %s\n: %s\n", flag.Arg(0), err) | |
| errExit("error loading OpenAPI spec in %s\n: %s\n", flag.Arg(0), err) |
|
I'm going to do this differently, without affecting the loading of broken specs. |
No description provided.