Getting Swagger2 Working...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting Swagger2 Working...

James Carman
I've been trying to get some meaningful JSON out of the Swagger2Feature in
OSGi, but it keeps coming out rather "vanilla".  It doesn't show any
operations.  When I start it up using Spring, it works fine.  I can run the
Swagger OSGi example just fine after building 3.2.0-SNAPSHOT locally and I
see nice JSON there. It must be something with the way I'm setting up my
server, which is manual:

https://github.com/Microbule/microbule/blob/master/core/src/main/java/org/microbule/core/DefaultJaxrsServerFactory.java

Any pointers would be greatly appreciated :)

Thanks,

James
Reply | Threaded
Open this post in threaded view
|

Re: Getting Swagger2 Working...

Carlos Sierra Andrés

Hey there...

might it be that you are not registering a JAX-RS application per se?

You can try registering it when getting the JAXRSServerFactoryBean with

RuntimeDelegate runtimeDelegate = RuntimeDelegate.getInstance();

runtimeDelegate.createEndpoint(application, JAXRSServerFactoryBean.class);

to see if anything changes.

Otherwise it might be something is missing in the Feature configuration?

Bests.

Carlos.
El 12/5/17 a las 21:23, James Carman escribió:
I've been trying to get some meaningful JSON out of the Swagger2Feature in
OSGi, but it keeps coming out rather "vanilla".  It doesn't show any
operations.  When I start it up using Spring, it works fine.  I can run the
Swagger OSGi example just fine after building 3.2.0-SNAPSHOT locally and I
see nice JSON there. It must be something with the way I'm setting up my
server, which is manual:

https://github.com/Microbule/microbule/blob/master/core/src/main/java/org/microbule/core/DefaultJaxrsServerFactory.java

Any pointers would be greatly appreciated :)

Thanks,

James


--
Carlos Sierra
Core Engineer
Liferay España y Portugal / Liferay Spain and Portugal
Tel. +34 917336343
www.liferay.com


Enterprise. Open Source. For Life.

Visit Us: www.liferay.com  |  Like Us: facebook.com/liferay  |  Follow Us: twitter.com/liferay_es

AVISO DE CONFIDENCIALIDAD: “La información contenida en este mensaje y/o archivo(s) adjunto(s), enviada desde LIFERAY SL, es confidencial/privilegiada y está destinada a ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Le recordamos que sus datos han sido incorporados en un fichero y que siempre y cuando se cumplan los requisitos exigidos por la normativa, podrá ejercer los derechos de acceso, rectificación, cancelación y oposición, ante nuestra entidad.

Si usted lee este mensaje y no es el destinatario señalado, el empleado o el agente responsable de entregar el mensaje al destinatario, o ha recibido esta comunicación por error, le informamos que está totalmente prohibida, y puede ser ilegal, cualquier divulgación, distribución o reproducción de esta comunicación, y le rogamos que nos lo notifique inmediatamente y nos devuelva el mensaje original a la dirección arriba mencionada. Gracias.” 

"The information contained in this message and any attached file(s) sent by Liferay SL is confidential / privileged and intended solely for the addressee(s). If you are not the intended recipient, any form of disclosure, reproduction, distribution or any action taken or refrained from in reliance on it, is prohibited and may be unlawful. Please notify the sender immediately and destroy this e-mail. Thank you."

Reply | Threaded
Open this post in threaded view
|

Re: Getting Swagger2 Working...

Sergey Beryozkin
Administrator
Hi

Sometimes, in OSGI, setting a feature 'setScan' to false works better,
it is probably should be a default option, in this case CXF registers
Application with Swagger thus, even if the scan does not work, Swagger
still has all the info...

Sergey
On 12/05/17 21:03, Carlos Sierra Andrés wrote:

> Hey there...
>
> might it be that you are not registering a JAX-RS application per se?
>
> You can try registering it when getting the JAXRSServerFactoryBean with
>
> RuntimeDelegateruntimeDelegate =RuntimeDelegate.getInstance();
>
> runtimeDelegate.createEndpoint(application, JAXRSServerFactoryBean.class);
>
> to see if anything changes.
>
> Otherwise it might be something is missing in the Feature configuration?
>
> Bests.
>
> Carlos.
> El 12/5/17 a las 21:23, James Carman escribió:
>> I've been trying to get some meaningful JSON out of the Swagger2Feature in
>> OSGi, but it keeps coming out rather "vanilla".  It doesn't show any
>> operations.  When I start it up using Spring, it works fine.  I can run the
>> Swagger OSGi example just fine after building 3.2.0-SNAPSHOT locally and I
>> see nice JSON there. It must be something with the way I'm setting up my
>> server, which is manual:
>>
>> https://github.com/Microbule/microbule/blob/master/core/src/main/java/org/microbule/core/DefaultJaxrsServerFactory.java
>>
>> Any pointers would be greatly appreciated :)
>>
>> Thanks,
>>
>> James
>>
>
> --
> Carlos Sierra
> Core Engineer
> Liferay España y Portugal / Liferay Spain and Portugal
> Tel. +34 917336343
> www.liferay.com <http://www.liferay.com/>
>
>
> Enterprise. Open Source. For Life.
>
> Visit Us: www.liferay.com <http://www.liferay.com/>  |  Like
> Us: facebook.com/liferay <http://facebook.com/liferay>  |  Follow
> Us: twitter.com/liferay_es <http://twitter.com/liferay>
>
> *AVISO DE CONFIDENCIALIDAD: */“La información contenida en este mensaje
> y/o archivo(s) adjunto(s), enviada desde LIFERAY SL, es
> confidencial/privilegiada y está destinada a ser leída sólo por la(s)
> persona(s) a la(s) que va dirigida. Le recordamos que sus datos han sido
> incorporados en un fichero y que siempre y cuando se cumplan los
> requisitos exigidos por la normativa, podrá ejercer los derechos de
> acceso, rectificación, cancelación y oposición, ante nuestra entidad./
>
> /Si usted lee este mensaje y no es el destinatario señalado, el empleado
> o el agente responsable de entregar el mensaje al destinatario, o ha
> recibido esta comunicación por error, le informamos que está totalmente
> prohibida, y puede ser ilegal, cualquier divulgación, distribución o
> reproducción de esta comunicación, y le rogamos que nos lo notifique
> inmediatamente y nos devuelva el mensaje original a la dirección arriba
> mencionada. //Gracias.”/* *
>
> /"The information contained in this message and any attached file(s)
> sent by Liferay SL is confidential / privileged and intended solely for
> the addressee(s). If you are not the intended recipient, any form of
> disclosure, reproduction, distribution or any action taken or refrained
> from in reliance on it, is prohibited and may be unlawful. Please notify
> the sender immediately and destroy this e-mail. Thank you." /
>

Reply | Threaded
Open this post in threaded view
|

Re: Getting Swagger2 Working...

James Carman
I will give that a whirl. Are you saying that the default everywhere should
be false? The library I am working on will not necessarily know whether it
is running in OSGi or not
On Sat, May 13, 2017 at 3:33 PM Sergey Beryozkin <[hidden email]>
wrote:

> Hi
>
> Sometimes, in OSGI, setting a feature 'setScan' to false works better,
> it is probably should be a default option, in this case CXF registers
> Application with Swagger thus, even if the scan does not work, Swagger
> still has all the info...
>
> Sergey
> On 12/05/17 21:03, Carlos Sierra Andrés wrote:
> > Hey there...
> >
> > might it be that you are not registering a JAX-RS application per se?
> >
> > You can try registering it when getting the JAXRSServerFactoryBean with
> >
> > RuntimeDelegateruntimeDelegate =RuntimeDelegate.getInstance();
> >
> > runtimeDelegate.createEndpoint(application,
> JAXRSServerFactoryBean.class);
> >
> > to see if anything changes.
> >
> > Otherwise it might be something is missing in the Feature configuration?
> >
> > Bests.
> >
> > Carlos.
> > El 12/5/17 a las 21:23, James Carman escribió:
> >> I've been trying to get some meaningful JSON out of the Swagger2Feature
> in
> >> OSGi, but it keeps coming out rather "vanilla".  It doesn't show any
> >> operations.  When I start it up using Spring, it works fine.  I can run
> the
> >> Swagger OSGi example just fine after building 3.2.0-SNAPSHOT locally
> and I
> >> see nice JSON there. It must be something with the way I'm setting up my
> >> server, which is manual:
> >>
> >>
> https://github.com/Microbule/microbule/blob/master/core/src/main/java/org/microbule/core/DefaultJaxrsServerFactory.java
> >>
> >> Any pointers would be greatly appreciated :)
> >>
> >> Thanks,
> >>
> >> James
> >>
> >
> > --
> > Carlos Sierra
> > Core Engineer
> > Liferay España y Portugal / Liferay Spain and Portugal
> > Tel. +34 917336343
> > www.liferay.com <http://www.liferay.com/>
> >
> >
> > Enterprise. Open Source. For Life.
> >
> > Visit Us: www.liferay.com <http://www.liferay.com/>  |  Like
> > Us: facebook.com/liferay <http://facebook.com/liferay>  |  Follow
> > Us: twitter.com/liferay_es <http://twitter.com/liferay>
> >
> > *AVISO DE CONFIDENCIALIDAD: */“La información contenida en este mensaje
> > y/o archivo(s) adjunto(s), enviada desde LIFERAY SL, es
> > confidencial/privilegiada y está destinada a ser leída sólo por la(s)
> > persona(s) a la(s) que va dirigida. Le recordamos que sus datos han sido
> > incorporados en un fichero y que siempre y cuando se cumplan los
> > requisitos exigidos por la normativa, podrá ejercer los derechos de
> > acceso, rectificación, cancelación y oposición, ante nuestra entidad./
> >
> > /Si usted lee este mensaje y no es el destinatario señalado, el empleado
> > o el agente responsable de entregar el mensaje al destinatario, o ha
> > recibido esta comunicación por error, le informamos que está totalmente
> > prohibida, y puede ser ilegal, cualquier divulgación, distribución o
> > reproducción de esta comunicación, y le rogamos que nos lo notifique
> > inmediatamente y nos devuelva el mensaje original a la dirección arriba
> > mencionada. //Gracias.”/* *
> >
> > /"The information contained in this message and any attached file(s)
> > sent by Liferay SL is confidential / privileged and intended solely for
> > the addressee(s). If you are not the intended recipient, any form of
> > disclosure, reproduction, distribution or any action taken or refrained
> > from in reliance on it, is prohibited and may be unlawful. Please notify
> > the sender immediately and destroy this e-mail. Thank you." /
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Getting Swagger2 Working...

James Carman
In reply to this post by Sergey Beryozkin
That worked PERFECTLY!  Thanks, Sergey (as usual)!  I will default that
setting to "false" in my library.

On Sat, May 13, 2017 at 3:33 PM Sergey Beryozkin <[hidden email]>
wrote:

> Hi
>
> Sometimes, in OSGI, setting a feature 'setScan' to false works better,
> it is probably should be a default option, in this case CXF registers
> Application with Swagger thus, even if the scan does not work, Swagger
> still has all the info...
>
> Sergey
> On 12/05/17 21:03, Carlos Sierra Andrés wrote:
> > Hey there...
> >
> > might it be that you are not registering a JAX-RS application per se?
> >
> > You can try registering it when getting the JAXRSServerFactoryBean with
> >
> > RuntimeDelegateruntimeDelegate =RuntimeDelegate.getInstance();
> >
> > runtimeDelegate.createEndpoint(application,
> JAXRSServerFactoryBean.class);
> >
> > to see if anything changes.
> >
> > Otherwise it might be something is missing in the Feature configuration?
> >
> > Bests.
> >
> > Carlos.
> > El 12/5/17 a las 21:23, James Carman escribió:
> >> I've been trying to get some meaningful JSON out of the Swagger2Feature
> in
> >> OSGi, but it keeps coming out rather "vanilla".  It doesn't show any
> >> operations.  When I start it up using Spring, it works fine.  I can run
> the
> >> Swagger OSGi example just fine after building 3.2.0-SNAPSHOT locally
> and I
> >> see nice JSON there. It must be something with the way I'm setting up my
> >> server, which is manual:
> >>
> >>
> https://github.com/Microbule/microbule/blob/master/core/src/main/java/org/microbule/core/DefaultJaxrsServerFactory.java
> >>
> >> Any pointers would be greatly appreciated :)
> >>
> >> Thanks,
> >>
> >> James
> >>
> >
> > --
> > Carlos Sierra
> > Core Engineer
> > Liferay España y Portugal / Liferay Spain and Portugal
> > Tel. +34 917336343 <+34%20917%2033%2063%2043>
> > www.liferay.com <http://www.liferay.com/>
> >
> >
> > Enterprise. Open Source. For Life.
> >
> > Visit Us: www.liferay.com <http://www.liferay.com/>  |  Like
> > Us: facebook.com/liferay <http://facebook.com/liferay>  |  Follow
> > Us: twitter.com/liferay_es <http://twitter.com/liferay>
> >
> > *AVISO DE CONFIDENCIALIDAD: */“La información contenida en este mensaje
> > y/o archivo(s) adjunto(s), enviada desde LIFERAY SL, es
> > confidencial/privilegiada y está destinada a ser leída sólo por la(s)
> > persona(s) a la(s) que va dirigida. Le recordamos que sus datos han sido
> > incorporados en un fichero y que siempre y cuando se cumplan los
> > requisitos exigidos por la normativa, podrá ejercer los derechos de
> > acceso, rectificación, cancelación y oposición, ante nuestra entidad./
> >
> > /Si usted lee este mensaje y no es el destinatario señalado, el empleado
> > o el agente responsable de entregar el mensaje al destinatario, o ha
> > recibido esta comunicación por error, le informamos que está totalmente
> > prohibida, y puede ser ilegal, cualquier divulgación, distribución o
> > reproducción de esta comunicación, y le rogamos que nos lo notifique
> > inmediatamente y nos devuelva el mensaje original a la dirección arriba
> > mencionada. //Gracias.”/* *
> >
> > /"The information contained in this message and any attached file(s)
> > sent by Liferay SL is confidential / privileged and intended solely for
> > the addressee(s). If you are not the intended recipient, any form of
> > disclosure, reproduction, distribution or any action taken or refrained
> > from in reliance on it, is prohibited and may be unlawful. Please notify
> > the sender immediately and destroy this e-mail. Thank you." /
> >
>
>