Fix for issue 1916: Consumes / Produces media-types on the document level aren't copied and merged anymore with the operation level consumes / produces media-types. #1917
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.
This is a possible fix for issue 1916. It removes the merging of the document level and operation level consumes and produces media types on the in the OperationContext. This results in a "more" valid swagger specification because now the document level media types are only defined on the document level and only when these media-types are overwritten on the operation level, they will be set on the operation level. This behaviour is according to the Swagger v2 specification and it also works just fine within the Swagger UI.
However we do want to provide some default values when no media-types are defined on the document and operation level. Thus I changed the MediaTypeReader to reflect this.
I also fixed the contract tests, because many of these didn't produce the correct specification anymore. TBH: I didn't check every specification by hand because many many failed due to this change. For most of them I just made sure that the expected specification matched the produces specification.