[ 
https://issues.apache.org/jira/browse/ARIES-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17366178#comment-17366178
 ] 

Börcsök József commented on ARIES-2055:
---------------------------------------

Hi [~csierra],

the problem is that Swagger annotations work fine on JAX-RS resources (i.e. 
Operation annotation on getUsers method at the referenced documentation) but 
annotations on JAX-RS application are ignored. In my case OpenAPIDefinition 
(title, description, ...) is added to the application because there are shared 
JAX-RS resources (representing services) among some applications (representing 
actors).

An empty OpenAPI OSGi component is registered by a generic bundle activator 
selecting all applications and exposing metadata defined by annotations.
{code:java}
final OpenAPI openAPI = new OpenAPI();
final Dictionary<String, Object> props = new Hashtable<>();
props.put(JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT, "(" + 
JaxrsWhiteboardConstants.JAX_RS_NAME + "=*)");
registration = context.registerService(OpenAPI.class, openAPI, props);
{code}
A test case is also added to the PR, defining such metadata by annotations 
instead of source code in unit test. Can you check it?

Thanks,

Joe

> Support Swagger annotations on JAX-RS applications
> --------------------------------------------------
>
>                 Key: ARIES-2055
>                 URL: https://issues.apache.org/jira/browse/ARIES-2055
>             Project: Aries
>          Issue Type: Improvement
>          Components: jax-rs-whiteboard
>    Affects Versions: jax-rs-whiteboard-1.1.0, jax-rs-whiteboard-2.0.0
>            Reporter: Börcsök József
>            Priority: Major
>
> JAX-RS annotations (i.e. OpenAPIDefinition) on JAX-RS application should be 
> supported (similar to JaxrsApplicationAndResourcePackagesAnnotationScanner in 
> swagger-core integration).
> Sample:
> {code:java}
> @OpenAPIDefinition(
>         info = @Info(
>                 title = "My Service",
>                 description = "Service REST API",
>                 contact = @Contact(
>                         email = "[email protected]"
>                 )
>         )
> )
> public class TestApplicationWithClasses extends Application {
> // ...
> }{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to