Skip to content

JSON interface is wrong for inner classes #2413

@ninja-inc

Description

@ninja-inc

Please take the time to search the repository, if your question has already been asked or answered.

  • What version of the library are you using? Is it the latest version? The latest released version is Download

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions