Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a FormParameter model object instead of BodyParameter #2722

Merged
merged 4 commits into from Jan 6, 2020

Conversation

shartte
Copy link

@shartte shartte commented Oct 6, 2018

This fixes #2717 by creating the right Swagger model class for parameters of type "formData".
Since those parameters only support a single example, I've also opted to simply copy over the first one.

@shartte
Copy link
Author

shartte commented Oct 6, 2018

I've adapted the class so that it only maps to FormParameter now if the type is one of the types supported by the spec. In other cases it falls back to BodyParameter, which is seemingly wrong, but matches previous behavior better.
I've also added a few unit tests for these cases.
Since the "spec" tests don't run on my own machine, I hope my adapted tests data will work on the CI.

@Carmageddon
Copy link

Whats up with this PR? Can you please get it fixed so we would not have to build based on your repo on Monday :)

@dilipkrish
Copy link
Member

@shartte thanks for the PR. It appears that the contract tests are failing. Would you mind taking a look?

@shartte
Copy link
Author

shartte commented Oct 23, 2018

@dilipkrish Will do, I had some issues with getting them to run initially, but now they work for me. So I'll investigate.

@codecov
Copy link

codecov bot commented Oct 23, 2018

Codecov Report

Merging #2722 into master will decrease coverage by 0.05%.
The diff coverage is 76.92%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2722      +/-   ##
============================================
- Coverage     94.77%   94.71%   -0.06%     
- Complexity     3161     3166       +5     
============================================
  Files           354      354              
  Lines          8057     8081      +24     
  Branches        608      612       +4     
============================================
+ Hits           7636     7654      +18     
- Misses          271      276       +5     
- Partials        150      151       +1
Impacted Files Coverage Δ Complexity Δ
...ocumentation/swagger2/mappers/ParameterMapper.java 84.5% <76.92%> (-4.86%) 15 <7> (+5)

@dilipkrish dilipkrish added the PR label Nov 7, 2018
@dilipkrish dilipkrish added this to the 3.0 milestone Nov 7, 2018
@kremers
Copy link
Contributor

kremers commented Nov 4, 2019

Having issues with #2717
Very happy with the solution, hope it makes it in 3.0.0-SNAPSHOT soon

dilipkrish added a commit that referenced this pull request Jan 6, 2020
Create a FormParameter model object instead of BodyParameter

related to #2722
@dilipkrish dilipkrish merged commit fd81627 into springfox:master Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Primitive RequestPart parameters generate incorrect Swagger Model
4 participants