You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Irfan Pasha <ir...@gmail.com> on 2018/09/12 03:48:03 UTC

Adding resourcePackages in OpenAPICustomizer

Hi,

Is there a way to add resourcePackages to OpenAPICustomizer from the code
so that I can completely  skip openapi-configuration.json ? I see that
OpenAPICustomizer has the method "setClassResourceInfos", but it seems to
be overkill to perform the task I was looking for.

Appreciate your time to respond to my questions !

Regards,
Irfan

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Dennis Kieselhorst <de...@apache.org>.
Hi Irfan,

just tried your usecase by adding resourcePackages to our sample https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/spring_boot and it worked. Maybe you can attach a project to reproduce it to the issue that you will create.

Cheers
Dennis

***UNCHECKED*** Re: Re: Adding resourcePackages in OpenAPICustomizer

Posted by Andrey Redko <dr...@gmail.com>.
Hey Irfan,

Its https://issues.apache.org/jira
Thanks.

Best Regards,
    Andriy Redko

On Wed, Sep 19, 2018, 9:53 AM Irfan Pasha <ir...@gmail.com> wrote:

> Hi Andrey,
>
> What is the Jira link for logging bugs in CXF ?
>
> On Fri, Sep 14, 2018 at 8:38 AM Irfan Pasha <ir...@gmail.com> wrote:
>
> > Sure Andrey, will do.
> >
> > On Thu, Sep 13, 2018 at 9:17 AM Andrey Redko <dr...@gmail.com> wrote:
> >
> >> Hey Irfan,
> >>
> >> Looks like you are doing everything right, would you mind please to open
> >> an issue and attach the sample project to it (so we can reproduce)?
> Thank
> >> you.
> >>
> >> Best Regards,
> >>     Andriy Redko
> >>
> >> On Thu, Sep 13, 2018, 7:36 AM Irfan Pasha <ir...@gmail.com> wrote:
> >>
> >>> Hi Andrey,
> >>>
> >>> All my JAX-RS annotations and services are in demo.test.rest package
> and
> >>> my webapp name is "mysrvc", so the URL is /mysrvc/app/openapi.json".
> >>>
> >>> Instead of using OpenAPICustomizer, if I use the below config file it
> >>> works perfectly fine.
> >>>
> >>>
> >>> {
> >>>         "resourcePackages": [
> >>>                 "demo.test.rest"
> >>>         ],
> >>>         "prettyPrint": true,
> >>>         "cacheTTL": 0,
> >>>         "openAPI": {
> >>>                 "info": {
> >>>                         "version": "1.0.0",
> >>>                         "title": "Demo Srvc REST API's",
> >>>                         "description": "Demo Srvc",
> >>>                         "contact": {
> >>>                                 "email": "mysrvc@gmail.com"
> >>>                         },
> >>>                         "license": {
> >>>                                 "name": "",
> >>>                                 "url": ""
> >>>                         }
> >>>                 },
> >>>                 "servers": [
> >>>                         {
> >>>                                 "url": "/mysrvc",
> >>>                                 "description": ""
> >>>                         }
> >>>                 ]
> >>>         },
> >>>         "userDefinedOptions": {
> >>>                 "support.swagger.ui": true
> >>>         }
> >>> }
> >>>
> >>> On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <dr...@gmail.com> wrote:
> >>>
> >>>> Hi Irfan,
> >>>>
> >>>> Do you have your JAX-RS resources in demo.test.rest package and
> >>>> annotated with OpenAPI annotations? What is the URL you
> >>>> deploy them at and which URL you expect the opeanapi.yaml/.json to be
> >>>> accessible? Also, please notice that if
> >>>> you still have openapi-configuration.json around, it will be preferred
> >>>> over the code configuration (unless you
> >>>> set openApiFeature.setScanKnownConfigLocations(false) to disable
> that).
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Best Regards,
> >>>>     Andriy Redko
> >>>>
> >>>>
> >>>> IP> Thank you Andriy. Somehow I am not able to get it working with
> >>>> OpenAPICustomizer. This is what I have in my class and I get a 404
> when I
> >>>> access it
> >>>>
> >>>>
> >>>> IP> public OpenApiFeature createOpenApiFeature() {
> >>>>
> >>>> IP> OpenApiFeature openApiFeature = new OpenApiFeature();
> >>>> IP>                 openApiFeature.setPrettyPrint(true);
> >>>> IP>                 Set<String> resourcePackages = new
> >>>> HashSet<String>();
> >>>> IP>                 resourcePackages.add("demo.test.rest");
> >>>> IP>
> >>>> IP>
> >>>>  openApiFeature.setResourcePackages(resourcePackages);
> >>>> IP>                 OpenApiCustomizer customizer = new
> >>>> OpenApiCustomizer();
> >>>> IP>                 customizer.setDynamicBasePath(true);
> >>>> IP>                 openApiFeature.setCustomizer(customizer);
> >>>> IP>                 return openApiFeature;
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> IP> Should I also a URL for my service ?  I do not see any option for
> >>>> that.
> >>>>
> >>>>
> >>>> IP> Also, if I want to disable OpenAPI from openapi-configuration.json
> >>>> then how can we do that ? I can change the
> >>>> IP> "resourcePackages" but would like to know if there is a better
> >>>> approach something like  property "support.swagger.ui".
> >>>> IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com>
> >>>> wrote:
> >>>>
> >>>> IP> Hi Irfan,
> >>>>
> >>>> IP>  The OpenApiFeature has setResourcePackages method to limit the
> >>>> scope of
> >>>> IP>  resource scanning. Most of the openapi-configuration.json could
> be
> >>>> translated into
> >>>> IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool
> in
> >>>> a few cases, when
> >>>> IP>  there is a need to perform manipulations with the specification
> at
> >>>> runtime (f.e.
> >>>> IP>  dynamicBasePath, ...). Thanks!
> >>>>
> >>>> IP>  Best Regards,
> >>>> IP>      Andriy Redko
> >>>>
> >>>>  IP>> Hi,
> >>>>
> >>>>  IP>> Is there a way to add resourcePackages to OpenAPICustomizer from
> >>>> the code
> >>>>  IP>> so that I can completely  skip openapi-configuration.json ? I
> see
> >>>> that
> >>>>  IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it
> >>>> seems to
> >>>>  IP>> be overkill to perform the task I was looking for.
> >>>>
> >>>>  IP>> Appreciate your time to respond to my questions !
> >>>>
> >>>>  IP>> Regards,
> >>>>  IP>> Irfan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> irfan..........................
> >>>
> >>
> >
> > --
> > irfan..........................
> >
>
>
> --
> irfan..........................
>

***UNCHECKED*** Re: Adding resourcePackages in OpenAPICustomizer

Posted by Irfan Pasha <ir...@gmail.com>.
Hi Andrey,

What is the Jira link for logging bugs in CXF ?

On Fri, Sep 14, 2018 at 8:38 AM Irfan Pasha <ir...@gmail.com> wrote:

> Sure Andrey, will do.
>
> On Thu, Sep 13, 2018 at 9:17 AM Andrey Redko <dr...@gmail.com> wrote:
>
>> Hey Irfan,
>>
>> Looks like you are doing everything right, would you mind please to open
>> an issue and attach the sample project to it (so we can reproduce)? Thank
>> you.
>>
>> Best Regards,
>>     Andriy Redko
>>
>> On Thu, Sep 13, 2018, 7:36 AM Irfan Pasha <ir...@gmail.com> wrote:
>>
>>> Hi Andrey,
>>>
>>> All my JAX-RS annotations and services are in demo.test.rest package and
>>> my webapp name is "mysrvc", so the URL is /mysrvc/app/openapi.json".
>>>
>>> Instead of using OpenAPICustomizer, if I use the below config file it
>>> works perfectly fine.
>>>
>>>
>>> {
>>>         "resourcePackages": [
>>>                 "demo.test.rest"
>>>         ],
>>>         "prettyPrint": true,
>>>         "cacheTTL": 0,
>>>         "openAPI": {
>>>                 "info": {
>>>                         "version": "1.0.0",
>>>                         "title": "Demo Srvc REST API's",
>>>                         "description": "Demo Srvc",
>>>                         "contact": {
>>>                                 "email": "mysrvc@gmail.com"
>>>                         },
>>>                         "license": {
>>>                                 "name": "",
>>>                                 "url": ""
>>>                         }
>>>                 },
>>>                 "servers": [
>>>                         {
>>>                                 "url": "/mysrvc",
>>>                                 "description": ""
>>>                         }
>>>                 ]
>>>         },
>>>         "userDefinedOptions": {
>>>                 "support.swagger.ui": true
>>>         }
>>> }
>>>
>>> On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <dr...@gmail.com> wrote:
>>>
>>>> Hi Irfan,
>>>>
>>>> Do you have your JAX-RS resources in demo.test.rest package and
>>>> annotated with OpenAPI annotations? What is the URL you
>>>> deploy them at and which URL you expect the opeanapi.yaml/.json to be
>>>> accessible? Also, please notice that if
>>>> you still have openapi-configuration.json around, it will be preferred
>>>> over the code configuration (unless you
>>>> set openApiFeature.setScanKnownConfigLocations(false) to disable that).
>>>>
>>>> Thanks.
>>>>
>>>> Best Regards,
>>>>     Andriy Redko
>>>>
>>>>
>>>> IP> Thank you Andriy. Somehow I am not able to get it working with
>>>> OpenAPICustomizer. This is what I have in my class and I get a 404 when I
>>>> access it
>>>>
>>>>
>>>> IP> public OpenApiFeature createOpenApiFeature() {
>>>>
>>>> IP> OpenApiFeature openApiFeature = new OpenApiFeature();
>>>> IP>                 openApiFeature.setPrettyPrint(true);
>>>> IP>                 Set<String> resourcePackages = new
>>>> HashSet<String>();
>>>> IP>                 resourcePackages.add("demo.test.rest");
>>>> IP>
>>>> IP>
>>>>  openApiFeature.setResourcePackages(resourcePackages);
>>>> IP>                 OpenApiCustomizer customizer = new
>>>> OpenApiCustomizer();
>>>> IP>                 customizer.setDynamicBasePath(true);
>>>> IP>                 openApiFeature.setCustomizer(customizer);
>>>> IP>                 return openApiFeature;
>>>>
>>>>
>>>>
>>>>
>>>> IP> Should I also a URL for my service ?  I do not see any option for
>>>> that.
>>>>
>>>>
>>>> IP> Also, if I want to disable OpenAPI from openapi-configuration.json
>>>> then how can we do that ? I can change the
>>>> IP> "resourcePackages" but would like to know if there is a better
>>>> approach something like  property "support.swagger.ui".
>>>> IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com>
>>>> wrote:
>>>>
>>>> IP> Hi Irfan,
>>>>
>>>> IP>  The OpenApiFeature has setResourcePackages method to limit the
>>>> scope of
>>>> IP>  resource scanning. Most of the openapi-configuration.json could be
>>>> translated into
>>>> IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool in
>>>> a few cases, when
>>>> IP>  there is a need to perform manipulations with the specification at
>>>> runtime (f.e.
>>>> IP>  dynamicBasePath, ...). Thanks!
>>>>
>>>> IP>  Best Regards,
>>>> IP>      Andriy Redko
>>>>
>>>>  IP>> Hi,
>>>>
>>>>  IP>> Is there a way to add resourcePackages to OpenAPICustomizer from
>>>> the code
>>>>  IP>> so that I can completely  skip openapi-configuration.json ? I see
>>>> that
>>>>  IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it
>>>> seems to
>>>>  IP>> be overkill to perform the task I was looking for.
>>>>
>>>>  IP>> Appreciate your time to respond to my questions !
>>>>
>>>>  IP>> Regards,
>>>>  IP>> Irfan
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> irfan..........................
>>>
>>
>
> --
> irfan..........................
>


-- 
irfan..........................

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Irfan Pasha <ir...@gmail.com>.
Sure Andrey, will do.

On Thu, Sep 13, 2018 at 9:17 AM Andrey Redko <dr...@gmail.com> wrote:

> Hey Irfan,
>
> Looks like you are doing everything right, would you mind please to open
> an issue and attach the sample project to it (so we can reproduce)? Thank
> you.
>
> Best Regards,
>     Andriy Redko
>
> On Thu, Sep 13, 2018, 7:36 AM Irfan Pasha <ir...@gmail.com> wrote:
>
>> Hi Andrey,
>>
>> All my JAX-RS annotations and services are in demo.test.rest package and
>> my webapp name is "mysrvc", so the URL is /mysrvc/app/openapi.json".
>>
>> Instead of using OpenAPICustomizer, if I use the below config file it
>> works perfectly fine.
>>
>>
>> {
>>         "resourcePackages": [
>>                 "demo.test.rest"
>>         ],
>>         "prettyPrint": true,
>>         "cacheTTL": 0,
>>         "openAPI": {
>>                 "info": {
>>                         "version": "1.0.0",
>>                         "title": "Demo Srvc REST API's",
>>                         "description": "Demo Srvc",
>>                         "contact": {
>>                                 "email": "mysrvc@gmail.com"
>>                         },
>>                         "license": {
>>                                 "name": "",
>>                                 "url": ""
>>                         }
>>                 },
>>                 "servers": [
>>                         {
>>                                 "url": "/mysrvc",
>>                                 "description": ""
>>                         }
>>                 ]
>>         },
>>         "userDefinedOptions": {
>>                 "support.swagger.ui": true
>>         }
>> }
>>
>> On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <dr...@gmail.com> wrote:
>>
>>> Hi Irfan,
>>>
>>> Do you have your JAX-RS resources in demo.test.rest package and
>>> annotated with OpenAPI annotations? What is the URL you
>>> deploy them at and which URL you expect the opeanapi.yaml/.json to be
>>> accessible? Also, please notice that if
>>> you still have openapi-configuration.json around, it will be preferred
>>> over the code configuration (unless you
>>> set openApiFeature.setScanKnownConfigLocations(false) to disable that).
>>>
>>> Thanks.
>>>
>>> Best Regards,
>>>     Andriy Redko
>>>
>>>
>>> IP> Thank you Andriy. Somehow I am not able to get it working with
>>> OpenAPICustomizer. This is what I have in my class and I get a 404 when I
>>> access it
>>>
>>>
>>> IP> public OpenApiFeature createOpenApiFeature() {
>>>
>>> IP> OpenApiFeature openApiFeature = new OpenApiFeature();
>>> IP>                 openApiFeature.setPrettyPrint(true);
>>> IP>                 Set<String> resourcePackages = new HashSet<String>();
>>> IP>                 resourcePackages.add("demo.test.rest");
>>> IP>
>>> IP>                 openApiFeature.setResourcePackages(resourcePackages);
>>> IP>                 OpenApiCustomizer customizer = new
>>> OpenApiCustomizer();
>>> IP>                 customizer.setDynamicBasePath(true);
>>> IP>                 openApiFeature.setCustomizer(customizer);
>>> IP>                 return openApiFeature;
>>>
>>>
>>>
>>>
>>> IP> Should I also a URL for my service ?  I do not see any option for
>>> that.
>>>
>>>
>>> IP> Also, if I want to disable OpenAPI from openapi-configuration.json
>>> then how can we do that ? I can change the
>>> IP> "resourcePackages" but would like to know if there is a better
>>> approach something like  property "support.swagger.ui".
>>> IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com>
>>> wrote:
>>>
>>> IP> Hi Irfan,
>>>
>>> IP>  The OpenApiFeature has setResourcePackages method to limit the
>>> scope of
>>> IP>  resource scanning. Most of the openapi-configuration.json could be
>>> translated into
>>> IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool in
>>> a few cases, when
>>> IP>  there is a need to perform manipulations with the specification at
>>> runtime (f.e.
>>> IP>  dynamicBasePath, ...). Thanks!
>>>
>>> IP>  Best Regards,
>>> IP>      Andriy Redko
>>>
>>>  IP>> Hi,
>>>
>>>  IP>> Is there a way to add resourcePackages to OpenAPICustomizer from
>>> the code
>>>  IP>> so that I can completely  skip openapi-configuration.json ? I see
>>> that
>>>  IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it
>>> seems to
>>>  IP>> be overkill to perform the task I was looking for.
>>>
>>>  IP>> Appreciate your time to respond to my questions !
>>>
>>>  IP>> Regards,
>>>  IP>> Irfan
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> irfan..........................
>>
>

-- 
irfan..........................

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Andrey Redko <dr...@gmail.com>.
Hey Irfan,

Looks like you are doing everything right, would you mind please to open an
issue and attach the sample project to it (so we can reproduce)? Thank you.

Best Regards,
    Andriy Redko

On Thu, Sep 13, 2018, 7:36 AM Irfan Pasha <ir...@gmail.com> wrote:

> Hi Andrey,
>
> All my JAX-RS annotations and services are in demo.test.rest package and
> my webapp name is "mysrvc", so the URL is /mysrvc/app/openapi.json".
>
> Instead of using OpenAPICustomizer, if I use the below config file it
> works perfectly fine.
>
>
> {
>         "resourcePackages": [
>                 "demo.test.rest"
>         ],
>         "prettyPrint": true,
>         "cacheTTL": 0,
>         "openAPI": {
>                 "info": {
>                         "version": "1.0.0",
>                         "title": "Demo Srvc REST API's",
>                         "description": "Demo Srvc",
>                         "contact": {
>                                 "email": "mysrvc@gmail.com"
>                         },
>                         "license": {
>                                 "name": "",
>                                 "url": ""
>                         }
>                 },
>                 "servers": [
>                         {
>                                 "url": "/mysrvc",
>                                 "description": ""
>                         }
>                 ]
>         },
>         "userDefinedOptions": {
>                 "support.swagger.ui": true
>         }
> }
>
> On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <dr...@gmail.com> wrote:
>
>> Hi Irfan,
>>
>> Do you have your JAX-RS resources in demo.test.rest package and annotated
>> with OpenAPI annotations? What is the URL you
>> deploy them at and which URL you expect the opeanapi.yaml/.json to be
>> accessible? Also, please notice that if
>> you still have openapi-configuration.json around, it will be preferred
>> over the code configuration (unless you
>> set openApiFeature.setScanKnownConfigLocations(false) to disable that).
>>
>> Thanks.
>>
>> Best Regards,
>>     Andriy Redko
>>
>>
>> IP> Thank you Andriy. Somehow I am not able to get it working with
>> OpenAPICustomizer. This is what I have in my class and I get a 404 when I
>> access it
>>
>>
>> IP> public OpenApiFeature createOpenApiFeature() {
>>
>> IP> OpenApiFeature openApiFeature = new OpenApiFeature();
>> IP>                 openApiFeature.setPrettyPrint(true);
>> IP>                 Set<String> resourcePackages = new HashSet<String>();
>> IP>                 resourcePackages.add("demo.test.rest");
>> IP>
>> IP>                 openApiFeature.setResourcePackages(resourcePackages);
>> IP>                 OpenApiCustomizer customizer = new
>> OpenApiCustomizer();
>> IP>                 customizer.setDynamicBasePath(true);
>> IP>                 openApiFeature.setCustomizer(customizer);
>> IP>                 return openApiFeature;
>>
>>
>>
>>
>> IP> Should I also a URL for my service ?  I do not see any option for
>> that.
>>
>>
>> IP> Also, if I want to disable OpenAPI from openapi-configuration.json
>> then how can we do that ? I can change the
>> IP> "resourcePackages" but would like to know if there is a better
>> approach something like  property "support.swagger.ui".
>> IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com>
>> wrote:
>>
>> IP> Hi Irfan,
>>
>> IP>  The OpenApiFeature has setResourcePackages method to limit the scope
>> of
>> IP>  resource scanning. Most of the openapi-configuration.json could be
>> translated into
>> IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool in a
>> few cases, when
>> IP>  there is a need to perform manipulations with the specification at
>> runtime (f.e.
>> IP>  dynamicBasePath, ...). Thanks!
>>
>> IP>  Best Regards,
>> IP>      Andriy Redko
>>
>>  IP>> Hi,
>>
>>  IP>> Is there a way to add resourcePackages to OpenAPICustomizer from
>> the code
>>  IP>> so that I can completely  skip openapi-configuration.json ? I see
>> that
>>  IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it
>> seems to
>>  IP>> be overkill to perform the task I was looking for.
>>
>>  IP>> Appreciate your time to respond to my questions !
>>
>>  IP>> Regards,
>>  IP>> Irfan
>>
>>
>>
>>
>>
>>
>
> --
> irfan..........................
>

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Irfan Pasha <ir...@gmail.com>.
Hi Andrey,

All my JAX-RS annotations and services are in demo.test.rest package and my
webapp name is "mysrvc", so the URL is /mysrvc/app/openapi.json".

Instead of using OpenAPICustomizer, if I use the below config file it works
perfectly fine.


{
        "resourcePackages": [
                "demo.test.rest"
        ],
        "prettyPrint": true,
        "cacheTTL": 0,
        "openAPI": {
                "info": {
                        "version": "1.0.0",
                        "title": "Demo Srvc REST API's",
                        "description": "Demo Srvc",
                        "contact": {
                                "email": "mysrvc@gmail.com"
                        },
                        "license": {
                                "name": "",
                                "url": ""
                        }
                },
                "servers": [
                        {
                                "url": "/mysrvc",
                                "description": ""
                        }
                ]
        },
        "userDefinedOptions": {
                "support.swagger.ui": true
        }
}

On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <dr...@gmail.com> wrote:

> Hi Irfan,
>
> Do you have your JAX-RS resources in demo.test.rest package and annotated
> with OpenAPI annotations? What is the URL you
> deploy them at and which URL you expect the opeanapi.yaml/.json to be
> accessible? Also, please notice that if
> you still have openapi-configuration.json around, it will be preferred
> over the code configuration (unless you
> set openApiFeature.setScanKnownConfigLocations(false) to disable that).
>
> Thanks.
>
> Best Regards,
>     Andriy Redko
>
>
> IP> Thank you Andriy. Somehow I am not able to get it working with
> OpenAPICustomizer. This is what I have in my class and I get a 404 when I
> access it
>
>
> IP> public OpenApiFeature createOpenApiFeature() {
>
> IP> OpenApiFeature openApiFeature = new OpenApiFeature();
> IP>                 openApiFeature.setPrettyPrint(true);
> IP>                 Set<String> resourcePackages = new HashSet<String>();
> IP>                 resourcePackages.add("demo.test.rest");
> IP>
> IP>                 openApiFeature.setResourcePackages(resourcePackages);
> IP>                 OpenApiCustomizer customizer = new OpenApiCustomizer();
> IP>                 customizer.setDynamicBasePath(true);
> IP>                 openApiFeature.setCustomizer(customizer);
> IP>                 return openApiFeature;
>
>
>
>
> IP> Should I also a URL for my service ?  I do not see any option for that.
>
>
> IP> Also, if I want to disable OpenAPI from openapi-configuration.json
> then how can we do that ? I can change the
> IP> "resourcePackages" but would like to know if there is a better
> approach something like  property "support.swagger.ui".
> IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com> wrote:
>
> IP> Hi Irfan,
>
> IP>  The OpenApiFeature has setResourcePackages method to limit the scope
> of
> IP>  resource scanning. Most of the openapi-configuration.json could be
> translated into
> IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool in a
> few cases, when
> IP>  there is a need to perform manipulations with the specification at
> runtime (f.e.
> IP>  dynamicBasePath, ...). Thanks!
>
> IP>  Best Regards,
> IP>      Andriy Redko
>
>  IP>> Hi,
>
>  IP>> Is there a way to add resourcePackages to OpenAPICustomizer from the
> code
>  IP>> so that I can completely  skip openapi-configuration.json ? I see
> that
>  IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it
> seems to
>  IP>> be overkill to perform the task I was looking for.
>
>  IP>> Appreciate your time to respond to my questions !
>
>  IP>> Regards,
>  IP>> Irfan
>
>
>
>
>
>

-- 
irfan..........................

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Andriy Redko <dr...@gmail.com>.
Hi Irfan,

Do you have your JAX-RS resources in demo.test.rest package and annotated with OpenAPI annotations? What is the URL you 
deploy them at and which URL you expect the opeanapi.yaml/.json to be accessible? Also, please notice that if
you still have openapi-configuration.json around, it will be preferred over the code configuration (unless you
set openApiFeature.setScanKnownConfigLocations(false) to disable that).

Thanks.

Best Regards,
    Andriy Redko


IP> Thank you Andriy. Somehow I am not able to get it working with OpenAPICustomizer. This is what I have in my class and I get a 404 when I access it


IP> public OpenApiFeature createOpenApiFeature() {

IP> OpenApiFeature openApiFeature = new OpenApiFeature();
IP>                 openApiFeature.setPrettyPrint(true);
IP>                 Set<String> resourcePackages = new HashSet<String>();
IP>                 resourcePackages.add("demo.test.rest");
IP>         
IP>                 openApiFeature.setResourcePackages(resourcePackages);
IP>                 OpenApiCustomizer customizer = new OpenApiCustomizer();
IP>                 customizer.setDynamicBasePath(true);
IP>                 openApiFeature.setCustomizer(customizer);
IP>                 return openApiFeature;




IP> Should I also a URL for my service ?  I do not see any option for that.


IP> Also, if I want to disable OpenAPI from openapi-configuration.json then how can we do that ? I can change the
IP> "resourcePackages" but would like to know if there is a better approach something like  property "support.swagger.ui".
IP> On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com> wrote:

IP> Hi Irfan,

IP>  The OpenApiFeature has setResourcePackages method to limit the scope of
IP>  resource scanning. Most of the openapi-configuration.json could be translated into
IP>  OpenApiFeature properties. The OpenApiCustomizer is a good tool in a few cases, when
IP>  there is a need to perform manipulations with the specification at runtime (f.e.
IP>  dynamicBasePath, ...). Thanks!

IP>  Best Regards,
IP>      Andriy Redko

 IP>> Hi,

 IP>> Is there a way to add resourcePackages to OpenAPICustomizer from the code
 IP>> so that I can completely  skip openapi-configuration.json ? I see that
 IP>> OpenAPICustomizer has the method "setClassResourceInfos", but it seems to
 IP>> be overkill to perform the task I was looking for.

 IP>> Appreciate your time to respond to my questions !

 IP>> Regards,
 IP>> Irfan






Re: Adding resourcePackages in OpenAPICustomizer

Posted by Irfan Pasha <ir...@gmail.com>.
Thank you Andriy. Somehow I am not able to get it working with
OpenAPICustomizer. This is what I have in my class and I get a 404 when I
access it

public OpenApiFeature createOpenApiFeature() {
OpenApiFeature openApiFeature = new OpenApiFeature();
openApiFeature.setPrettyPrint(true);
Set<String> resourcePackages = new HashSet<String>();
resourcePackages.add("demo.test.rest");

openApiFeature.setResourcePackages(resourcePackages);
OpenApiCustomizer customizer = new OpenApiCustomizer();
customizer.setDynamicBasePath(true);
openApiFeature.setCustomizer(customizer);
return openApiFeature;


Should I also a URL for my service ?  I do not see any option for that.

Also, if I want to disable OpenAPI from openapi-configuration.json then how
can we do that ? I can change the "resourcePackages" but would like to know
if there is a better approach something like  property "support.swagger.ui".

On Wed, Sep 12, 2018 at 6:44 AM Andriy Redko <dr...@gmail.com> wrote:

> Hi Irfan,
>
> The OpenApiFeature has setResourcePackages method to limit the scope of
> resource scanning. Most of the openapi-configuration.json could be
> translated into
> OpenApiFeature properties. The OpenApiCustomizer is a good tool in a few
> cases, when
> there is a need to perform manipulations with the specification at runtime
> (f.e.
> dynamicBasePath, ...). Thanks!
>
> Best Regards,
>     Andriy Redko
>
> IP> Hi,
>
> IP> Is there a way to add resourcePackages to OpenAPICustomizer from the
> code
> IP> so that I can completely  skip openapi-configuration.json ? I see that
> IP> OpenAPICustomizer has the method "setClassResourceInfos", but it seems
> to
> IP> be overkill to perform the task I was looking for.
>
> IP> Appreciate your time to respond to my questions !
>
> IP> Regards,
> IP> Irfan
>
>

-- 
irfan..........................

Re: Adding resourcePackages in OpenAPICustomizer

Posted by Andriy Redko <dr...@gmail.com>.
Hi Irfan,

The OpenApiFeature has setResourcePackages method to limit the scope of
resource scanning. Most of the openapi-configuration.json could be translated into
OpenApiFeature properties. The OpenApiCustomizer is a good tool in a few cases, when
there is a need to perform manipulations with the specification at runtime (f.e.
dynamicBasePath, ...). Thanks!

Best Regards,
    Andriy Redko

IP> Hi,

IP> Is there a way to add resourcePackages to OpenAPICustomizer from the code
IP> so that I can completely  skip openapi-configuration.json ? I see that
IP> OpenAPICustomizer has the method "setClassResourceInfos", but it seems to
IP> be overkill to perform the task I was looking for.

IP> Appreciate your time to respond to my questions !

IP> Regards,
IP> Irfan