Skip to content

Conversation

@mzeijen
Copy link

@mzeijen mzeijen commented Jul 13, 2017

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.

mzeijen added 2 commits July 13, 2017 17:46
…ypes are always added to resource level consumes and produces media types. This change won't add those media types anymore but will make sure default media types are set when no document level media types are defined.
@codecov
Copy link

codecov bot commented Jul 13, 2017

Codecov Report

Merging #1917 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@ Coverage Diff @@ ## master #1917 +/- ## ============================================ + Coverage 95.91% 95.91% +<.01%  - Complexity 2647 2649 +2  ============================================ Files 311 311 Lines 5826 5827 +1 Branches 475 475 ============================================ + Hits 5588 5589 +1  Misses 138 138 Partials 100 100
@dilipkrish
Copy link
Member

Could you perhaps add some tests for this change?

@mzeijen
Copy link
Author

mzeijen commented Jul 25, 2017

No problem, I can add some additional tests.

mzeijen added 3 commits July 25, 2017 08:09
…es are set in the document and operation context
…consumes and/or produces defined on the document level and when only on the operation level
@springfox springfox deleted a comment Jul 25, 2017
@mzeijen
Copy link
Author

mzeijen commented Jul 25, 2017

@dilipkrish I updated the MediaTypeReaderSpec with additional tests and added two contract tests that test the behaviour for this change. I hope this suffices.

@dilipkrish
Copy link
Member

🤘 Will pull it in over the weekend. Thanks for being diligent! 🙇

@dilipkrish dilipkrish merged commit ae3f264 into springfox:master Jul 30, 2017
@dilipkrish dilipkrish added this to the 2.8.0 milestone Jul 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants