Closed tomasphelan closed 1 year ago
I have reproduced this issue. See https://github.com/swagger-akka-http/swagger-scala-module/commit/abbecc32fe6ad2a7b9c4c64c0889d2f1502b4548
com.fasterxml.jackson.module.scala.introspect.BeanIntrospector ignores the getOptionalAmount - the fact that optionalAmount is added as swagger model property is not this - and I haven't yet found what that is - note the package name on com.fasterxml.jackson.module.scala.introspect.BeanIntrospector - this not a Java class
I have limited time to spend on this over the next few days. I suggest you rename your function. Or you can put a JsonIgnore annotation on the getOptionalAmount function. There are other swagger and jackson annotations you could use too. If you do find a solution, could you add a comment here so other users can benefit from the knowledge.
I'll come back to this at some point in the future to see if the behaviour can be improved.
@tomasphelan the main branch latest code should handle this better now. It will probably be a few weeks before I release a new jar though - other stuff I want to get in before that release.
Awesome work @pjfanning !
v2.7.5 is out
Using swagger-scala-module with swagger-core v2.2.5 and above breaks the hack I put in swagger-scala-module. This issue needs more investigation.
https://github.com/swagger-akka-http/swagger-scala-module/pull/220 (will be part of v2.8.1 release) appears to fix latest issue
When including a function name prefixed with
get
to a case class, for example,getOptionalAmount
swagger will generate as a required fieldOptionalAmount
We believe it might be due to due to the fact that it uses a (Java) bean introspector to inspect the case classes.
https://github.com/swagger-akka-http/swagger-scala-module/blob/1d764e5b5a191199a84df4990aa7fdb4a061a385/src/main/scala/com/github/swagger/scala/converter/SwaggerScalaModelConverter.scala#L117