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": "[email protected]"
},
"license": {
"name": "",
"url": ""
}
},
"servers": [
{
"url": "/mysrvc",
"description": ""
}
]
},
"userDefinedOptions": {
"support.swagger.ui": true
}
}
On Thu, Sep 13, 2018 at 6:55 AM Andriy Redko <[email protected]> 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 <[email protected]> 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..........................