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

Can't ignore the type returned from method #3074

Closed
arinal opened this issue Jan 17, 2019 · 1 comment
Closed

Can't ignore the type returned from method #3074

arinal opened this issue Jan 17, 2019 · 1 comment

Comments

@arinal
Copy link
Contributor

arinal commented Jan 17, 2019

Oftentimes, operation method returns wrapper classes which is not really important and should be filtered in the output swagger json/yaml. The example below uses scala akka-http and it's very common to return ToResponseMarshallable in every operation. This class is only a wrapper value to serialise the object its contain.

@GET 
@ApiResponse(responseCode = "200", /* details is omitted */ classOf[Employee])
def getEmployee(id: String): ToResponseMarshallable =
   ToResponseMarshallable(Employee("Michael Suyama"))

case class Employee(name: String)

The expected swagger output components.schemas is Employee without ToResponseMarshallable.

Executing ModelConverters.getInstance().addClassToSkip("ToResponseMarshallable") won't work since it only filters annotated type, while ToResponseMarshallable is deducted from method's type return value.

Has been analysing Reader.java, seems like the filter logic is pretty much hard coded.

@frantuma
Copy link
Member

frantuma commented Feb 4, 2019

Thanks for reporting and working on this! implemented in #3107

@frantuma frantuma closed this as completed Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants