swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
http://swagger.io
Apache License 2.0
7.39k stars 2.18k forks source link

OpenAPI - Setting swagger-jaxrs2 Base Path in TomEE 7.1.0 (CXF) #2983

Open jameschensmith opened 6 years ago

jameschensmith commented 6 years ago

I'm in the process of migrating from Swagger Core 1.5.X to 2.X, and I'm struggling to find where to modify the Base Path of my API (possibly multiple base path solution would be nice as well).

Earlier, I was using io.swagger.jaxrs.config.DefaultJaxrsConfig in my web.xml, but this doesn't seem to be available now. I've been scanning the Wiki for quite some time before finally falling back to asking here. The problem with the Wiki is that it's missing any CXF configurations. 😅

If anyone can direct me to where I can configure this (either web.xml or any other options), I would greatly appreciate it. Thanks!

valasatava commented 5 years ago

@james-r-smith, were you been able to solve your problem? I am facing the same issue.

valasatava commented 5 years ago

@james-r-smith, I ended up adding an openapi configuration file with server url as defined: https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-configuration#known-locations

jameschensmith commented 5 years ago

Hey @valasatava, I ended up implementing org.eclipse.microprofile.openapi.OASModelReader and using org.eclipse.microprofile.openapi.OASFactory to build the data that I needed. Just another option to consider. 😊👍

valasatava commented 5 years ago

@james-r-smith, thanks for your suggestion! I ended up implementing programmatic configuration using io.swagger.v3.oas.models.OpenAPI object.

padmakaraa commented 5 years ago

@james-r-smith, thanks for your suggestion! I ended up implementing programmatic configuration using io.swagger.v3.oas.models.OpenAPI object.

@valasatava Do you have reference documents for this implementation (programmatic configuration)?

valasatava commented 5 years ago

@padmakaraa, I followed this one: https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-configuration#jax-rs-application

Kiolali commented 5 years ago

@valasatava Could you please paste your code here, how you configured the base path using ServletConfig? Thanks in advance!