gnostic icon indicating copy to clipboard operation
gnostic copied to clipboard

gnostic upgrade from yaml.v2 to yaml.v3 breaks some clients (here's the fix)

Open timburks opened this issue 5 years ago • 0 comments

With #194, gnostic upgrades its dependency on yaml.v2 to yaml.v3. This means that code that calls the automatically-generated NewDocument functions will break, because they take yaml.v2 data structures as input.

Affected code will get build errors for code like this:

document, err := openapi_v2.NewDocument(info, compiler.NewContext("$root", nil))

To fix this, please don't just replace yaml.v2 with yaml.v3 in client code. Instead, please use the ParseDocument functions defined in openapiv2/document.go and openapiv3/document.go. That would make the calling code look like this:

document, err := openapi_v2.ParseDocument(b)

where b is a []byte of the JSON or YAML file to be parsed.

Also, please use a tagged version of gnostic. This change will be in v0.5.0 and later.

timburks avatar Jul 14 '20 20:07 timburks