-
-
Notifications
You must be signed in to change notification settings - Fork 45
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 Use @ApiModelProperty on case classes properties #8
Comments
This branch uses model annotations. |
Thank you @pjfanning for your fast response, I really appreciate it. Right now I am using it just like that but I was trying to migrate to Swagger 2, the main reason is that I want to use the new annotation I want to be able to do something like
FYI: comments in the code doesn't makes sense, its just an example while I was testing.
This is the first time I use Swagger so apologize for the lack of experience with this, I appreciate in advance any insight you can give me. |
Did you look at the swagger 2.0 branch - it uses a snapshot version of swagger-akka-http that supports openapi 3. |
Yes, my issue started there, taking that branch I couldn't find any place where being used OpenApi 3.0 and those Annotations together using swagger-akka-http, I am stuck. Thank you a lot for your help. |
I tried https://github.com/pjfanning/swagger-akka-http-sample/tree/swagger2-enum and the Parameter annotation on the case class |
Hello @pjfanning, Thank you for taking time to help me with this issue, I appreciate it especially on your vacations, I hope you are having a great time. I was looking at your example and also here https://github.com/swagger-api/swagger-samples/tree/2.0 And, to my surprise, I found that using Here is the sample piece of code
And here the result
Again, thank you so much for your help and support, I am closing this issue. Have a great time. |
Hello again @pjfanning I wanted to comment out here, just FYI, maybe you can point me in the right direction, I am struggling for a while with an issue with properties of type Option[T] not showing the specified example. The output YML will show all examples accordingly under the ClientName schema
however, this one won't, the only difference is the type of the properties.
Please, I appreciate any information you can give me, I've been looking everywhere but without luck. Thanks in advance |
Swagger-akka-http is a tiny codebase that depends on swagger-api jars and Jackson databind. There are type erasure issues with Scala options. In the end, it seems likely that we will need to rewrite large amounts of code yo support Scala reflection instead of Java reflection. There is no community formed to support this right now. This whole project is no longer a priority for me. |
In the ClientName class Schema annotations, you could have type=string, required=false |
Thank you @pjfanning for taking time to answer, I really appreciate it. Regarding your recommendation, I already tried that, as you said, it looks like a bug somewhere deeper, and reading around I found someone saying on Stackoverflow that he solved it by having two classes one for the examples (without using Option[T]) and the real class, but it looks like a very nasty solution. I've I tried many other combinations without success. Unfortunately, I am moving from 10 years of PHP to Scala/Java and I am going through the learning curve, I still don't dare to try to rebuild or help in something like that, I do notice the community is very small and there are not too many people contributing, but I recognized the power of Scala at first sight, I know that will improve dramatically within the next years. I really appreciate the time you take to help others, any other advice will be welcome. |
Hello @pjfanning , thanks for the great work with this example
I am reaching you out because I am trying to use @ApiModelProperty following the instructions specified here https://github.com/swagger-akka-http/swagger-akka-http#model-definitions but it's not working, all I get is Type not found errors for @apimodel and @ApiModelProperty annotations
I am interested in Swagger-2.0 branch of this project as an example to generate OpenApi 3.0.0
Do you have any experience or could point me the right direction on how properly use those annotations in this project?
I am trying this code.
FYI I also tried to install swagger-jaxrs2 (https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-jaxrs2/2.0.0)
libraryDependencies += "io.swagger.core.v3" % "swagger-jaxrs2" % "2.0.0"
But didn't have any luck with that, the same error keeps coming up.
I really appreciate your help in advance.
Thanks
The text was updated successfully, but these errors were encountered: