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

@ApiModelProperty and @ApiModel not respected in EJB module #485

Closed
Paave opened this issue Mar 13, 2014 · 18 comments
Closed

@ApiModelProperty and @ApiModel not respected in EJB module #485

Paave opened this issue Mar 13, 2014 · 18 comments

Comments

@Paave
Copy link

Paave commented Mar 13, 2014

Model descriptions are not read by the the Swagger when models are placed in to the EJB module of EJB in EAR project. This is likely in Swagger core According Ron R. and Tony Tam (as discussed in https://groups.google.com/forum/#!topic/swagger-swaggersocket/xVvQekBHLxo).

@perabello
Copy link

On the same way, service are not read by the Swagger when the annotations for REST services are placed on external jar (on interfaces for remote access).
I resolve this setting the annotation in the implementation methods. But this force me to duplicate annotations to define the service (example: path, GET, POST, etc.) on interfaces and on implementation.

@fehguy
Copy link
Contributor

fehguy commented Mar 15, 2014

Hi, I have not been able to reproduce this--if you have any tips on how to do so, please pass them on here. In the mean time, there was a defect (#486) which may be relevant--could you please try this with 1.3.3-SNAPSHOT?

@perabello
Copy link

I can not find 1.3.3-SNAPSHOT. Can you give the link?

@Paave
Copy link
Author

Paave commented Mar 17, 2014

perabello: clone the repo and build it by setting the version in the pom.xml under swagger-core module.

@Paave
Copy link
Author

Paave commented Mar 17, 2014

Hi guys,

Tried with 1.3.3-SNAPSHOT no luck yet... Also added some debug logs to the "match case":
Here's the difference, first the model in web war, works fine (the logs are generated when calling the path api-docs/):
processing method public java.lang.Integer com.model.TestClass.getI()
@javax.xml.bind.annotation.XmlElement(nillable=false...
(default task-10) XMLELEMENT PROPERTY CASE MATCHED
ma :@com.wordnik.swagger.annotations.ApiModelProperty(positio...
(default task-10) API MODEL PROPERTY CASE MATCHED

Then the EJB module case:

(default task-10) processing method public java.lang.Integer model.EjbModel.getIntegterInEjb()
ma :@com.wordnik.swagger.annotations.ApiModelProperty(positio...
ma :@javax.xml.bind.annotation.XmlElement(nillable=fal...
(default task-10) XMLELEMENT PROPERTY CASE MATCHED

So, for some reason the match case skips the ApiModelProperty paramater alltogether!? It's good to note that the XMLelement parameter works just fine, which is also weird to me.

Here's again simple sample project that can reproduce the case on Wildfly 8 server. https://groups.google.com/group/swagger-swaggersocket/attach/101b8b58a6843084/mockproject.zip?part=4&authuser=0

@Paave
Copy link
Author

Paave commented Mar 17, 2014

To make it 100% clear: The match case I modified is in processAnnotations method.

@fehguy
Copy link
Contributor

fehguy commented Mar 17, 2014

FYI the snapshots are here:

https://oss.sonatype.org/content/repositories/snapshots/com/wordnik/swagger-core_2.10/1.3.3-SNAPSHOT/

Did you test against the develop branch, which builds the 1.3.3-SNAPSHOT?

@perabello
Copy link

Yes, now descriptions for the sample are published.
But not descriptions my specification (methods on interfaces).
I create a different issue for this bug: #493

@perabello
Copy link

Sorry, I was wrong.
As Paave said, no descriptions are published.

Result preview

@Paave
Copy link
Author

Paave commented Mar 18, 2014

Hi guys,

We got the issue solved by changing the project configuration. The EJB module scope in web module POM needs to be "compile". Otherwise while Checking the annotations Swagger will receive a proxy instead of the annotated interface and it fails to do the match case for getting the values. Working project https://groups.google.com/group/swagger-swaggersocket/attach/1d5184c961dcb6dc/mockproject%202.zip?part=4&authuser=0.

This issue can be closed IMO. Thanks for the activity!

@webron
Copy link
Contributor

webron commented Mar 18, 2014

@Paave - Thank you for providing a solution. Feel free to reopen it if you feel the need.

@elisid
Copy link

elisid commented Jun 4, 2014

@Paave - I dont think that is an acceptable solution. If you put an ejb in the ejb module with a method that returns an instance of "model.EjbModel" and calls the method from the web module, you will produce a ClassCastException since the class of the returned object (from the dependency in the ear) and the expected class (from the "compile" dependency in the war) will come from different places.

I.e. with this solution you cant put any ejb:s in the ejb module...

@elisid
Copy link

elisid commented Jun 4, 2014

Please reopen this bug if possible

@fehguy
Copy link
Contributor

fehguy commented Jun 5, 2014

per @elisid 's request...

@fehguy fehguy reopened this Jun 5, 2014
@webron
Copy link
Contributor

webron commented Jun 10, 2014

@elisid, @Paave - can any of you possibly provide a test case we can use to see the problem and debug it? If you create one, please remember to provide environment details (such as which JEE and container and versions are used).

@Paave
Copy link
Author

Paave commented Jun 10, 2014

Hi @webron, a while since I was working on this, but from https://groups.google.com/forum/#!topic/swagger-swaggersocket/xVvQekBHLxo you can find complete mock projects to reproduce the issue on Wildfly.

@fehguy
Copy link
Contributor

fehguy commented Dec 20, 2014

ok without a committed test case, I'm going to close this out

@dolejnik
Copy link

dolejnik commented Jul 5, 2017

I think it deserves to be reopened and fixed.

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

6 participants