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

Complex type support by @ModelAttribute #1350

Merged
merged 6 commits into from Aug 27, 2016
Merged

Complex type support by @ModelAttribute #1350

merged 6 commits into from Aug 27, 2016

Conversation

MaksimOrlov
Copy link
Member

@MaksimOrlov MaksimOrlov commented Jun 21, 2016

This code adds functionality to unwrap complex parameters, that were annotated with @ModelAttribute annotation.

Example:

Parameter List<MyObject> myObject;

Where:

MyObject {
    String a;
    Integer b;
    List<MyObject2> myObject2;
}

MyObject2 {
    Long c;
}

Will be unwrapped to:

myObject[#ind].a

myObject[#ind].b

myObject[#ind].myObject2[#ind].c

@MaksimOrlov MaksimOrlov changed the title Complextypes Complex type support by @ModelAttribute Jun 22, 2016
@dilipkrish
Copy link
Member

@MaksimOrlov Sorry just getting around to merging PRs. How would this work in something like swagger-ui? How would the client resolve the #ind values?

@dilipkrish dilipkrish added the PR label Jul 3, 2016
@dilipkrish dilipkrish added this to the 2.6.0 milestone Jul 3, 2016
@MaksimOrlov
Copy link
Member Author

Hi. I'm sorry for the delay with answer.

At the swagger-ui or some other tools we will get something like:

myObject[#ind].myObject2[#ind].c

#ind - it's only my suggestion to mark array's indexes.

I'm not sure, that swagger-us's function "Try it out!" will work for requests with parameters like that.

My other suggestion was just to leave empty brackets (myObject[].myObject2[].c) with out any other markers. But that will help to try request with only one parameter in array.

My opinion, there should be some other way to introduce complex parameters at the ui level, the way different from just simple input fields and submit button.

@MaksimOrlov
Copy link
Member Author

MaksimOrlov commented Jul 8, 2016

And I'm opened for any other suggestions and solutions for that issue:)

@dilipkrish
Copy link
Member

My opinion, there should be some other way to introduce complex parameters at the ui level, the way different from just simple input fields and submit button.

That way is to use the request body :)

Not sure what the right answer is, how about instead of #ind, we replace it with 0. That way the parameters are atleast accurate for one variation. What do you think?

@MaksimOrlov
Copy link
Member Author

I'm agree with you. That can partly solve the issue.

I will make commit with this changes.

@dilipkrish dilipkrish merged commit 86e7404 into springfox:master Aug 27, 2016
@dilipkrish
Copy link
Member

Thanks for the PR! 🙇 Sorry it took so long to merge it in

@MaksimOrlov MaksimOrlov deleted the complextypes branch September 17, 2016 14:34
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.

None yet

2 participants