JSON interface is wrong for inner classes
See original GitHub issuePlease take the time to search the repository, if your question has already been asked or answered.
What kind of issue is this?
-
Question. Is this a question about how to do a certain thing?
-
Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests or steps to reproduce get fixed faster. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
- spring xml/java config that is relevant
- springfox specific configuration if it makes sense
- include any output you’ve received; logs, json snippets etc.; and what the expected output should be
- if you have a repo that demonstrates the issue for bonus points! See this example
-
Feature Request. Start by telling us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.
Please do consider starring this repository if you do like this project and find it useful.
Hello! When I implement response beans with inner class, unexpected JSON interface is displayed.
Book.class
@Data
public class Book {
private Desc desc;
@Data
public class Desc {
private String i_am_book_inner_class;
}
}
Animal.class
@Data
public class Animal {
private Desc desc;
@Data
public class Desc {
private String i_am_animal_inner_class;
}
}
Swagger Docs
{
"desc": {
"i_am_animal_inner_class": "string",
"i_am_book_inner_class": "string"
}
}
Here is my sample repository which can reproduce this behavior.
It is simple Spring Boot jar so you can run by java -jar target/swaggerfox-bug-0.0.1-SNAPSHOT.jar
after maven build.
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
That is true… thanks for creating the repo. Im sure it will be very useful in validating #2056
This issue still exists in Springfox 3.0.0 release. Naming inner classes with the same name in different Java classes confuses the system, such that wrong JSON prototypes are shown for API requests and responses.