Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
588 stars 261 forks source link

Content handling updates to properly support YAML #4739

Closed EricWittmann closed 4 months ago

EricWittmann commented 4 months ago

OpenAPI and AsyncAPI types are often formatted as YAML instead of JSON. In the past we have simply converted it, because all of our parsing was assuming JSON. In v3 this has been changed so that we honor the content type provided to us. So now we simply store the content as-is. If you give us YAML we'll give that back to you. If you give us JSON then we'll store that.

This does not work for other JSON based types, since Avro and JSON Schema are not typically formatted as YAML files.

Supporting this required the introduction of a new interface called TypedContent to make it easier to pass the content around to various classes (Canonicalizer, Validator, etc) that need to have the content and the contentType.

The changes are mostly to support getting this test to pass:

https://github.com/Apicurio/apicurio-registry/pull/4739/files#diff-2dc524c744a0171e2b44f95bc92ba63edae6f7685363812aa4a3560eb00fcbf3

apicurio-bot[bot] commented 4 months ago

Thank you for creating a pull request!

Pinging @jsenko to respond or triage.