gnostic upgrade from yaml.v2 to yaml.v3 breaks some clients (here's the fix)
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Description
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](https://github.com/googleapis/gnostic/blob/40cf3c0b6b95be12aa7d84b7957287d0762593e1/openapiv2/document.go#L20) and [openapiv3/document.go](https://github.com/googleapis/gnostic/blob/40cf3c0b6b95be12aa7d84b7957287d0762593e1/openapiv3/document.go#L20). 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.
Contributor guide
Assessment
This issue has not been assessed yet.