@OpenAPIDefinition not working

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

@OpenAPIDefinition not working

Ivan Junckes Filho
The @OpenAPIDefinition is not being picked up by the CDI extension because it is only getting InternalApplication instead of picking up my custom Application config. Any ideas why? OpenAPIDefinition configs are therefore not showing up in the openapi doc.

@OpenAPIDefinition(info =
@Info(
title = "TEST",
version = "2.0",
description = "Pet Store App API",
license = @License(
name = "Apache 2.0",
url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
contact = @Contact(
name = "PetStore API Support",
url = "https://github.com/eclipse/microprofile-open-api",
email = "[hidden email]")
),
security = @SecurityRequirement(name = "oauth2"),
servers = @Server(url = "/test/"))
@ApplicationPath("/api")
@LoginConfig(authMethod = "MP-JWT")
public class ApplicationConfiguration extends Application {
Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Romain Manni-Bucau
Hi Ivan,

In a few cases - don't recall out of my head if it is all - TomEE wraps user application in InternalApplication. IIRC it was for caching reason - TomEE not being super cleanly aligned on CDI + to avoid to get multiple instances between runtime and deployment which can break user code. Enhancing TomEE to no do it anymore or not use a wrapper when not needed can be a first step fixing that.

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]> a écrit :
The @OpenAPIDefinition is not being picked up by the CDI extension because it is only getting InternalApplication instead of picking up my custom Application config. Any ideas why? OpenAPIDefinition configs are therefore not showing up in the openapi doc.

@OpenAPIDefinition(info =
@Info(
title = "TEST",
version = "2.0",
description = "Pet Store App API",
license = @License(
name = "Apache 2.0",
url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
contact = @Contact(
name = "PetStore API Support",
url = "https://github.com/eclipse/microprofile-open-api",
email = "[hidden email]")
),
security = @SecurityRequirement(name = "oauth2"),
servers = @Server(url = "/test/"))
@ApplicationPath("/api")
@LoginConfig(authMethod = "MP-JWT")
public class ApplicationConfiguration extends Application {
Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Ivan Junckes Filho
Interesting, ok thanks Romain.

On Fri, Feb 8, 2019 at 3:29 PM Romain Manni-Bucau <[hidden email]> wrote:
Hi Ivan,

In a few cases - don't recall out of my head if it is all - TomEE wraps user application in InternalApplication. IIRC it was for caching reason - TomEE not being super cleanly aligned on CDI + to avoid to get multiple instances between runtime and deployment which can break user code. Enhancing TomEE to no do it anymore or not use a wrapper when not needed can be a first step fixing that.

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]> a écrit :
The @OpenAPIDefinition is not being picked up by the CDI extension because it is only getting InternalApplication instead of picking up my custom Application config. Any ideas why? OpenAPIDefinition configs are therefore not showing up in the openapi doc.

@OpenAPIDefinition(info =
@Info(
title = "TEST",
version = "2.0",
description = "Pet Store App API",
license = @License(
name = "Apache 2.0",
url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
contact = @Contact(
name = "PetStore API Support",
url = "https://github.com/eclipse/microprofile-open-api",
email = "[hidden email]")
),
security = @SecurityRequirement(name = "oauth2"),
servers = @Server(url = "/test/"))
@ApplicationPath("/api")
@LoginConfig(authMethod = "MP-JWT")
public class ApplicationConfiguration extends Application {
Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Romain Manni-Bucau
Hey, just recalled we had a flag about it,

you can skip it setting openejb.cxf-rs.cache-application=false

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le ven. 8 févr. 2019 à 19:01, Ivan Junckes Filho <[hidden email]> a écrit :
Interesting, ok thanks Romain.

On Fri, Feb 8, 2019 at 3:29 PM Romain Manni-Bucau <[hidden email]> wrote:
Hi Ivan,

In a few cases - don't recall out of my head if it is all - TomEE wraps user application in InternalApplication. IIRC it was for caching reason - TomEE not being super cleanly aligned on CDI + to avoid to get multiple instances between runtime and deployment which can break user code. Enhancing TomEE to no do it anymore or not use a wrapper when not needed can be a first step fixing that.

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]> a écrit :
The @OpenAPIDefinition is not being picked up by the CDI extension because it is only getting InternalApplication instead of picking up my custom Application config. Any ideas why? OpenAPIDefinition configs are therefore not showing up in the openapi doc.

@OpenAPIDefinition(info =
@Info(
title = "TEST",
version = "2.0",
description = "Pet Store App API",
license = @License(
name = "Apache 2.0",
url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
contact = @Contact(
name = "PetStore API Support",
url = "https://github.com/eclipse/microprofile-open-api",
email = "[hidden email]")
),
security = @SecurityRequirement(name = "oauth2"),
servers = @Server(url = "/test/"))
@ApplicationPath("/api")
@LoginConfig(authMethod = "MP-JWT")
public class ApplicationConfiguration extends Application {
Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Ivan Junckes Filho
I will take a look thanks again Romain

On Fri, Feb 8, 2019 at 4:38 PM Romain Manni-Bucau <[hidden email]> wrote:
Hey, just recalled we had a flag about it,

you can skip it setting openejb.cxf-rs.cache-application=false

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le ven. 8 févr. 2019 à 19:01, Ivan Junckes Filho <[hidden email]> a
écrit :

> Interesting, ok thanks Romain.
>
> On Fri, Feb 8, 2019 at 3:29 PM Romain Manni-Bucau <[hidden email]>
> wrote:
>
>> Hi Ivan,
>>
>> In a few cases - don't recall out of my head if it is all - TomEE wraps
>> user application in InternalApplication. IIRC it was for caching reason -
>> TomEE not being super cleanly aligned on CDI + to avoid to get multiple
>> instances between runtime and deployment which can break user code.
>> Enhancing TomEE to no do it anymore or not use a wrapper when not needed
>> can be a first step fixing that.
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <https://rmannibucau.metawerx.net/> | Old Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Book
>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>
>>
>> Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]>
>> a écrit :
>>
>>> The @OpenAPIDefinition is not being picked up by the CDI extension
>>> because it is only getting InternalApplication instead of picking up my
>>> custom Application config. Any ideas why? OpenAPIDefinition configs are
>>> therefore not showing up in the openapi doc.
>>>
>>>
>>> @OpenAPIDefinition(info =
>>>         @Info(
>>>                 title = "TEST",
>>>                 version = "2.0",
>>>                 description = "Pet Store App API",
>>>                 license = @License(
>>>                         name = "Apache 2.0",
>>>                         url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
>>>                 contact = @Contact(
>>>                         name = "PetStore API Support",
>>>                         url = "https://github.com/eclipse/microprofile-open-api",
>>>                         email = "[hidden email]")
>>>         ),
>>>         security = @SecurityRequirement(name = "oauth2"),
>>>         servers = @Server(url = "/test/"))
>>> @ApplicationPath("/api")
>>> @LoginConfig(authMethod = "MP-JWT")
>>> public class ApplicationConfiguration extends Application {
>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Roberto Cortez
Hi Ivan,

Yes Romain is right, you should set openejb.cxf-rs.cache-application = false and it should work. We had to set that for the TCK to pass, but the config never reached the final distribution. I did notice that and I’ve added it in case a MP app is detected, but it was after M2 was released.

Cheers,
Roberto 

On 8 Feb 2019, at 21:06, Ivan Junckes Filho <[hidden email]> wrote:

I will take a look thanks again Romain

On Fri, Feb 8, 2019 at 4:38 PM Romain Manni-Bucau <[hidden email]> wrote:
Hey, just recalled we had a flag about it,

you can skip it setting openejb.cxf-rs.cache-application=false

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le ven. 8 févr. 2019 à 19:01, Ivan Junckes Filho <[hidden email]> a
écrit :

> Interesting, ok thanks Romain.
>
> On Fri, Feb 8, 2019 at 3:29 PM Romain Manni-Bucau <[hidden email]>
> wrote:
>
>> Hi Ivan,
>>
>> In a few cases - don't recall out of my head if it is all - TomEE wraps
>> user application in InternalApplication. IIRC it was for caching reason -
>> TomEE not being super cleanly aligned on CDI + to avoid to get multiple
>> instances between runtime and deployment which can break user code.
>> Enhancing TomEE to no do it anymore or not use a wrapper when not needed
>> can be a first step fixing that.
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <https://rmannibucau.metawerx.net/> | Old Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Book
>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>
>>
>> Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]>
>> a écrit :
>>
>>> The @OpenAPIDefinition is not being picked up by the CDI extension
>>> because it is only getting InternalApplication instead of picking up my
>>> custom Application config. Any ideas why? OpenAPIDefinition configs are
>>> therefore not showing up in the openapi doc.
>>>
>>>
>>> @OpenAPIDefinition(info =
>>>         @Info(
>>>                 title = "TEST",
>>>                 version = "2.0",
>>>                 description = "Pet Store App API",
>>>                 license = @License(
>>>                         name = "Apache 2.0",
>>>                         url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
>>>                 contact = @Contact(
>>>                         name = "PetStore API Support",
>>>                         url = "https://github.com/eclipse/microprofile-open-api",
>>>                         email = "[hidden email]")
>>>         ),
>>>         security = @SecurityRequirement(name = "oauth2"),
>>>         servers = @Server(url = "/test/"))
>>> @ApplicationPath("/api")
>>> @LoginConfig(authMethod = "MP-JWT")
>>> public class ApplicationConfiguration extends Application {
>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: @OpenAPIDefinition not working

Ivan Junckes Filho
It didn't seem to work for me adding the property to system.properties. Any ideas what I am doing wrong?

On Sat, Feb 9, 2019 at 10:21 AM Roberto Cortez <[hidden email]> wrote:
Hi Ivan,

Yes Romain is right, you should set openejb.cxf-rs.cache-application = false and it should work. We had to set that for the TCK to pass, but the config never reached the final distribution. I did notice that and I’ve added it in case a MP app is detected, but it was after M2 was released.

Cheers,
Roberto 

On 8 Feb 2019, at 21:06, Ivan Junckes Filho <[hidden email]> wrote:

I will take a look thanks again Romain

On Fri, Feb 8, 2019 at 4:38 PM Romain Manni-Bucau <[hidden email]> wrote:
Hey, just recalled we had a flag about it,

you can skip it setting openejb.cxf-rs.cache-application=false

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le ven. 8 févr. 2019 à 19:01, Ivan Junckes Filho <[hidden email]> a
écrit :

> Interesting, ok thanks Romain.
>
> On Fri, Feb 8, 2019 at 3:29 PM Romain Manni-Bucau <[hidden email]>
> wrote:
>
>> Hi Ivan,
>>
>> In a few cases - don't recall out of my head if it is all - TomEE wraps
>> user application in InternalApplication. IIRC it was for caching reason -
>> TomEE not being super cleanly aligned on CDI + to avoid to get multiple
>> instances between runtime and deployment which can break user code.
>> Enhancing TomEE to no do it anymore or not use a wrapper when not needed
>> can be a first step fixing that.
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <https://rmannibucau.metawerx.net/> | Old Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Book
>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>
>>
>> Le ven. 8 févr. 2019 à 18:14, Ivan Junckes Filho <[hidden email]>
>> a écrit :
>>
>>> The @OpenAPIDefinition is not being picked up by the CDI extension
>>> because it is only getting InternalApplication instead of picking up my
>>> custom Application config. Any ideas why? OpenAPIDefinition configs are
>>> therefore not showing up in the openapi doc.
>>>
>>>
>>> @OpenAPIDefinition(info =
>>>         @Info(
>>>                 title = "TEST",
>>>                 version = "2.0",
>>>                 description = "Pet Store App API",
>>>                 license = @License(
>>>                         name = "Apache 2.0",
>>>                         url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
>>>                 contact = @Contact(
>>>                         name = "PetStore API Support",
>>>                         url = "https://github.com/eclipse/microprofile-open-api",
>>>                         email = "[hidden email]")
>>>         ),
>>>         security = @SecurityRequirement(name = "oauth2"),
>>>         servers = @Server(url = "/test/"))
>>> @ApplicationPath("/api")
>>> @LoginConfig(authMethod = "MP-JWT")
>>> public class ApplicationConfiguration extends Application {
>>>
>>>