Go-swagger: referenced path item cause an error

Created on 7 May 2017  路  4Comments  路  Source: go-swagger/go-swagger

Problem statement

$ref within path is not resolved properly. Im getting error no operations were selected. fmt.Println shows that Spec.operations is empty.

Swagger specification

paths:
  "/":
    "$ref": './paths/options.yaml'

Steps to reproduce

Create any spec with referenced path item.

Environment

swagger version: 0.10.0
go version: go version go1.8.1 darwin/amd64
OS: osx

Ref resolution bug

Most helpful comment

I'll make it the default in in the next version. It solves quite a lot of problems
Currently it's a separate operation because it was experimental

All 4 comments

can you try to flatten your spec first to see if that fixes it?

swagger flatten -o swagger.flat.json swagger.json

Yes flattened spec has all operations included. Is such intermediate file recommended way of generation?

I'll make it the default in in the next version. It solves quite a lot of problems
Currently it's a separate operation because it was experimental

Thanks for posting that solution @casualjim - that will work for me in the interim as well

Was this page helpful?
0 / 5 - 0 ratings