Content handling updates to properly support YAML #4739
Merged
+1,966
−1,396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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