On Tue, Nov 19, 2024 at 11:06:28AM -0500, apache-karaf-user.pyr3x.com via user wrote: > On Tue, Nov 19, 2024 at 09:18:36AM -0500, apache-karaf-user.pyr3x.com via > user wrote: > > On Fri, Nov 15, 2024 at 09:59:30PM -0500, apache-karaf-user.pyr3x.com via > > user wrote: > > > On Fri, Nov 15, 2024 at 11:06:58AM -0500, apache-karaf-user.pyr3x.com via > > > user wrote: > > > > On Thu, Nov 14, 2024 at 08:38:51AM -0500, apache-karaf-user.pyr3x.com > > > > via user wrote: > > > > > On Thu, Nov 14, 2024 at 08:19:10AM -0500, apache-karaf-user.pyr3x.com > > > > > via user wrote: > > > > > > > > > > > > On Wed, Nov 13, 2024 at 08:48:01PM -0500, Paul Spencer wrote: > > > > > > > Chaz, > > > > > > > > > > > > > > I have JSON endpoints in karat 4.4.3 using annotations see > > > > > > > https://lists.apache.org/thread/bfpvpw5kx52vk49kpoo5ztolsh8j2j9f > > > > > > > > > > > > > > Some information that will make it easier to assist: > > > > > > > > > > > > > > 1) What are the versions of > > > > > > > - Karaf > > > > > > > - Swagger > > > > > > > > > > > > > > 2) What entries are you seeing in the karaf log file? > > > > > > > - When you component start. ( I would expect the endpoint and > > > > > > > path to be logged) > > > > > > > - When you make a http request to the end point > > > > > > > - Web related errors > > > > > > > > > > > > > > Per you testing question I do not use Swagger UI, but the REST > > > > > > > test in karaf tests is a place to start. > > > > > > > > > > > > > > https://github.com/apache/karaf/blob/karaf-4.4.6/itests/test/src/test/java/org/apache/karaf/itests/examples/RestExampleTest.java > > > > > > > > > > > > > > Paul Spencer > > > > > > > > > > > > > > > On Nov 13, 2024, at 7:43 PM, apache-karaf-user.pyr3x.com via > > > > > > > > user <user@karaf.apache.org> wrote: > > > > > > > > > > > > > > > > On Tue, Nov 12, 2024 at 11:46:29AM -0500, > > > > > > > > apache-karaf-user.pyr3x.com via user wrote: > > > > > > > >> On Sun, Nov 10, 2024 at 07:05:33AM -0500, > > > > > > > >> apache-karaf-user.pyr3x.com via user wrote: > > > > > > > >>> On Tue, Nov 05, 2024 at 12:07:50PM -0500, > > > > > > > >>> apache-karaf-user.pyr3x.com via user wrote: > > > > > > > >>>> Hello, > > > > > > > >>>> > > > > > > > >>>> I'm running Karaf and have installed the the following > > > > > > > >>>> features: > > > > > > > >>>> > > > > > > > >>>> 'aries-jax-rs-whiteboard-whiteboard' > > > > > > > >>>> 'aries-jax-rs-whiteboard-openapi' > > > > > > > >>>> > > > > > > > >>>> I have a class with the following annotations: > > > > > > > >>>> > > > > > > > >>>> @Component( > > > > > > > >>>> service = {Blah.class, OpenAPI.class}, > > > > > > > >>>> immediate = true, > > > > > > > >>>> configurationPolicy = ConfigurationPolicy.OPTIONAL) > > > > > > > >>>> @OpenAPIDefinition(info = > > > > > > > >>>> @Info( > > > > > > > >>>> title = "${project.name}", > > > > > > > >>>> version = "${project.version}" > > > > > > > >>>> ) > > > > > > > >>>> ) > > > > > > > >>>> @Path("coolapp") > > > > > > > >>>> @JaxrsResource > > > > > > > >>>> @Consumes(MediaType.APPLICATION_JSON) > > > > > > > >>>> @Produces(MediaType.APPLICATION_JSON) > > > > > > > >>>> @JSONRequired > > > > > > > >>>> @Designate(ocd = Configuration.class) > > > > > > > >>>> @Slf4j > > > > > > > >>>> public class Blah extends OpenAPI { > > > > > > > >>>> > > > > > > > >>>> > > > > > > > >>>> I can access the openapi.yaml at > > > > > > > >>>> http://localhost:8181/openapi.yaml > > > > > > > >>>> > > > > > > > >>>> How do I make use of the swagger-ui to test my endpoints? > > > > > > > >>>> > > > > > > > >>>> I've tried to install the feature to add it: > > > > > > > >>>> > > > > > > > >>>> 'feature:info cxf-rs-description-openapi-v3' > > > > > > > >>>> > > > > > > > >>>> But can't seem to find the endpoint where it's running (if > > > > > > > >>>> it is) > > > > > > > >>>> > > > > > > > >>>> Any help would be appreciated! > > > > > > > >>>> > > > > > > > >>>> -- > > > > > > > >>>> Chaz > > > > > > > >>> > > > > > > > >>> ping > > > > > > > >>> > > > > > > > >>> -- > > > > > > > >>> Chaz > > > > > > > >> > > > > > > > >> ping :( > > > > > > > >> > > > > > > > >> -- > > > > > > > >> Chaz > > > > > > > > > > > > > > > > anyone? > > > > > > > > > > > > > > > > -- > > > > > > > > Chaz > > > > > > > > > > > > > > > > > > > Hi Paul, > > > > > > > > > > > > Yes that first link was me trying to get my REST endpoint deployed. > > > > > > To > > > > > > be clear I am able to deploy just fine and hit all my endpoints with > > > > > > curl. I've also been able to deploy OpenAPI to generate me the > > > > > > openapi.json which describes my endpoints located at > > > > > > http://localhost:8181/openapi.{yaml|json} > > > > > > > > > > > > What I haven't been able to do is deploy the swagger ui which > > > > > > generates > > > > > > the pretty documentation to show the endpoints and allow you to > > > > > > interactively use them for testing based on the generated openapi > > > > > > descriptor. > > > > > > > > > > > > According to https://cxf.apache.org/docs/openapifeature.html > > > > > > > > > > > > I should be fine to access this somewhere. I confirmed that > > > > > > installing > > > > > > the feature 'cxf-rs-description-openapi-v3' takes care of installing > > > > > > Swagger UI. I would expect to be able to go to a url like > > > > > > http://localhost:8181/endpoint?api-url=/openapi.json or similar and > > > > > > see > > > > > > the generated documentation site but I can't seem to get it to work. > > > > > > > > > > > > -- > > > > > > Chaz > > > > > > > > > > Sorry I meant to say I should be able to see the website at the > > > > > following location: > > > > > > > > > > http://localhost:8181/api-docs/?url=/openapi.yaml > > > > > > > > > > http://localhost:8181/openapi.yaml exists and describes my endpoints > > > > > which I can curl. > > > > > > > > > > -- > > > > > Chaz > > > > > > > > Someone must have been successful in deploying swagger-ui on karaf :( > > > > > > > > -- > > > > Chaz > > > > > > I'm using the Open API Integration in Aries JAX-RS Whiteboard > > > > > > https://github.com/apache/aries-jax-rs-whiteboard/blob/master/integrations/openapi/README.md > > > > > > I'm also following: > > > > > > https://cxf.apache.org/docs/openapifeature.html > > > > > > However, instead of blueprint I'm using DS > > > > > > I'm adding the feature 'cxf-rs-description-openapi-v3' > > > > > > As I noted before http://localhost:8181/openapi.json is being created > > > which describes my endpoints. > > > > > > The problem is after I 'install mvn:org.webjars/swagger-ui/3.23.8' it > > > appears it's not being picked up to produce the api-docs. The > > > http://localhost:8181/cxf/services does not produce the link to the > > > swagger docs. > > > > > > I'm using Karaf 4.4.6. Has something messed this resource loading up? As > > > I understand it the activator should fine that the resources from the > > > swagger-ui are available and set it up in the context. > > > > > > -- > > > Chaz > > > > OK. I think I've narrowed this down. I can get the Swagger UI working > > with example bundles that use blueprint to configure everything. > > However, I'm using the Aries JAX-RS whiteboard annotations. I noticed in > > the example bundle that they enable jaxrs feature for openApiFeature. > > How can I do this through declarative services or through JAX-RS > > whiteboard annotations? > > > > <jaxrs:server id="sampleServer" address="/swaggerSample"> > > <jaxrs:serviceBeans> > > <ref component-id="sampleResource" /> > > </jaxrs:serviceBeans> > > <jaxrs:providers> > > <ref component-id="jsonProvider" /> > > </jaxrs:providers> > > <jaxrs:features> > > <ref component-id="openApiFeature" /> > > </jaxrs:features> > > </jaxrs:server> > > > > -- > > Chaz > > Is there a way to publish my resource to the cxf context? It looks like > the swagger ui integration is expecting it to be published within that > context versus my own that is generated automatically as part of the JAX > RS whiteboard pattern. I really want to use Swagger UI to view my > endpoints from the generated openapi.json from the JAX RS whiteboard > integration with openapi. > > -- > Chaz
I'm still fighting with this. I'd love any support in resolving this. -- Chaz