You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swagger version: 0.25.0
go version: 1.14.2
OS: Windows
Steps to reproduce
I am using recommended docker mode to run go-swagger, setting concrete version 0.25.0 (see swagger.cmd) via cmd file.
I have my spec divided into files for every path and every model, in paths and models subdirectories respectively. I also have a root file swagger.yaml to bring all the paths together and another file pathParams.yaml to reuse RESTful path parameters for all types of items IDs.
All those files are located in swagger subdirectory of my project. If I try to validate my spec, I got:
C:\Users\Me\app\swagger>swagger validate swagger.yaml
The swagger spec at "swagger.yaml" is invalid against swagger specification 2.0.
See errors below:
- some references could not be resolved in spec. First found: open /app/swagger/paths/models/Error.yaml: no such file or directory
If I generate flattened json spec, it generates and validates correctly:
C:\Users\Me\app\swagger>swagger flatten swagger.yaml -o swagger.json
<no output, file is created>
C:\Users\Me\app\swagger>swagger validate swagger.json
2021/01/02 21:19:12
The swagger spec at "swagger.json" is valid against swagger specification 2.0
So it seems to me that go-swagger handles $ref paths differently in flatten and validate modes. I want to validate my spec as a part of CI pipeline and don't want to generate extra artifacts.
Moreover, when I try to use github.com/go-openapi/validate package to validate my app output against the spec - I got the "file not found" error while calling loads.Spec() / analysis.Flatten(). I hope solving that problem by understanding roots of this issue.
The text was updated successfully, but these errors were encountered:
The behavior is correct on Linux: neither validate nor flatten wants to proceed through the invalid $ref.
It looks to me that you hit a Windows-specific issue. This particular one I did not know about, though.
I've updated our current master with a bunch of Windows-specific fixes over the last weekend.
There are still some windows issues with flatten, but I have certainly narrowed down the scope for them.
Problem statement
go-swagger handles
$ref
paths differently in flatten and validate mode.Swagger specification
test-spec.zip
Environment
swagger version: 0.25.0
go version: 1.14.2
OS: Windows
Steps to reproduce
I am using recommended docker mode to run go-swagger, setting concrete version 0.25.0 (see
swagger.cmd
) via cmd file.I have my spec divided into files for every path and every model, in
paths
andmodels
subdirectories respectively. I also have a root fileswagger.yaml
to bring all the paths together and another filepathParams.yaml
to reuse RESTful path parameters for all types of items IDs.All those files are located in
swagger
subdirectory of my project. If I try to validate my spec, I got:If I generate flattened json spec, it generates and validates correctly:
So it seems to me that go-swagger handles $ref paths differently in flatten and validate modes. I want to validate my spec as a part of CI pipeline and don't want to generate extra artifacts.
Moreover, when I try to use
github.com/go-openapi/validate
package to validate my app output against the spec - I got the "file not found" error while callingloads.Spec() / analysis.Flatten()
. I hope solving that problem by understanding roots of this issue.The text was updated successfully, but these errors were encountered: