Not sure why you are not seeing snapshots, can you try these artifacts:

https://builds.apache.org/view/A-D/view/CXF/job/CXF-3.1-deploy/lastSuccessfulBuild/org.apache.cxf$cxf-rt-rs-service-description-swagger/artifact/org.apache.cxf/cxf-rt-rs-service-description-swagger/3.1.8-SNAPSHOT/

(may be install them into a local repo)

Cheers, Sergey

On 23/08/16 18:38, jcrump wrote:
This does not resolve:

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
            <version>3.1.8-SNAPSHOT</version>
        </dependency>

Not sure I can access the snapshot builds?


On Tue, Aug 23, 2016 at 11:51 AM, Jeffrey Crump <jcr...@constantcontact.com>
wrote:

What artifact should I be using? I'm currently using
 cxf-spring-boot-starter-jaxrs and it's only at 3.1.7 (I'd have to have
explicit artifact overrides to get your patch, I think)

On Wed, Aug 17, 2016 at 6:15 AM, Sergey Beryozkin [via CXF] <
ml-node+s547215n5771666...@n5.nabble.com> wrote:

I've updated Swagger2Feature to set media types for all the resources
found in the latest 2.1.8-M1 swagger-ui distro OOB but it is also
configurable with a map of extension-to-mediaTypes if needed.

Give 3.1.8-SNAPSHOT a try next week please - hopefully it will eliminate
any issues some browsers have when enforcing the strict mime type control

Sergey
On 16/08/16 21:25, Sergey Beryozkin wrote:

Ok, thanks, we can easily enough (I hope) make SwaggerUi jaxrs resource
configurable (ex - have it injected with a map of extensions to media
types that need to be returned, etc),

In fact I'm pretty sure why you see it on some browser versions - when
CXF JAX-RS serves it directly it sets application/octet-stream by
default while when these UI resources are served by the default servlet
(example, when SwaggerUI jar is unpacked) a mapped content-type set...

I'll need to look a bit more into it, as I said all works for me but
lots of different browsers around; good news though you've made it work
with Firefox

Cheers, Sergey
On 16/08/16 18:37, jcrump wrote:
Well, it's broken for me in Chrome but working in an older version
(41) of
Firefox... so I suppose this is something client-specific.  I'll poke
around with the CORS filters but I seem to remember having similar
problems
with Chrome around CORS support on localhost.

Thanks so much for your help so far.

Jeff

On Tue, Aug 16, 2016 at 12:55 PM, Sergey Beryozkin [via CXF] <
[hidden email] <http:///user/SendEmail.jtp?type=node&node=5771666&i=0>>
wrote:

Hi

I've just tried 3 demos, description_swagger2, spring_boot,
spring_boot_scan, and linking to SwaggerUi from the services page
works
fine (Firefox 48.0, and Chrome (not sure how to check a version
there)
but I suppose it is the latest, Ubuntu updates it)

Check Google for "strict MIME type checking is enabled".

Or can you create a test maven project for me to investigate further
?
(so that I can reproduce and see if some JSON or CORS filter needs to
be
added OOB).

Speaking of CORS. CXF description_swagger2 demo ships ApiOriginFilter
(CXF has the one it can provide OOB too). The demo works fine for me
with or without this filter - but I believe Aki added it for good
reason
- can you return an instance of that filter from @Bean method and see
if
it helps ?

If nothing helps consider creating a test module

Cheers, Sergey

On 16/08/16 17:19, jcrump wrote:

OK, progress... Yes, I had an auto-scan set on
'org.apache.cxf.jaxrs.swagger'
in my Spring Boot application.yaml. I removed it, and also removed
the
setBasePath.  I'm down to this:


 @Bean
    public Swagger2Feature swagger2Feature() {
        Swagger2Feature feature = new Swagger2Feature();
        feature.setResourcePackage("x.y.z.v1.rs");
        feature.setTitle("My API");
        return feature;
    }

which is quite nice.   All the server-side errors are gone, and only
one
endpoint in the service list:

Available RESTful services:
Endpoint address: http://localhost:8080/context/
Swagger : http://localhost:8080/context/
api-docs?url=/context/swagger.
json

However, I'm still seeing a bunch of errors in my browser console on
the
client side when I go to that URL, all like this:

Refused to execute script from '
http://localhost:8080/context/lib/shred.bundle.js' because its MIME
type
('application/octet-stream') is not executable, and strict MIME type
checking is enabled.

So close!



On Tue, Aug 16, 2016 at 11:57 AM, Sergey Beryozkin [via CXF] <
[hidden email] <http:///user/SendEmail.jtp?ty
pe=node&node=5771648&i=0>>
wrote:

Can you check you have no SpringBoot configuration scanning
'org.apache.cxf.jaxrs.swagger' - the CXF demo does it and picks up
Swagger2Feature automatically - that will explain these warnings.

Can you also remove
feature.setBasePath("/api-docs") ?

FYI, Swagger UI resource does listen on this path but this will be
configurable.

Cheers, Sergey

On 16/08/16 16:35, jcrump wrote:


Yes, I am using a SpringBoot starter.  So I took out the @Bean
code
and
replaced it with this:

@Bean
public Swagger2Feature swagger2Feature() {
   Swagger2Feature feature = new Swagger2Feature();
   feature.setResourcePackage("x.y.z.v1.rs");
   feature.setTitle("My API");
   feature.setBasePath("/api-docs");
   return feature;
}

The JSON is being generated correctly and I'm only seeing one
endpoint
on
the services list:

Available RESTful services:
Endpoint address: http://localhost:8080/context/
Swagger :
http://localhost:8080/context/api-docs?url=/context/swagger.

json

When I click on the link, I get the Swagger UI but with no
content.  I
get a
whole bunch of messages like this:

WARNING: Both
org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService#getResource




and
org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService#getResource




are equal candidates for handling the current request which can
lead
to
unpredictable results

and a FileNotFoundException:

Caused by: java.io.FileNotFoundException: JAR entry
META-INF/resources/webjars/swagger-ui/2.1.8-M1/api-docs/lib/swagger-oauth.js




not found in
/Users/jcrump/.m2/repository/org/webjars/swagger-ui/2.1.8-M1/swagger-ui-2.1.8-M1.jar




at
sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142)






The problem is the "api-docs" in the META-INF path.  I traced this
in
the
debugger to Swagger2Feature.SwaggerUIService#getResource; the
resourcePath
being passed in is prefixed with api-docs whereas the jar entry
path
is
not.
I tried removing the 'setBasePath' call in my @Bean method but it
didn't
change anything.

BTW, I'm also getting the warning message when called to generate
the
JSON,
but the warning is this:

WARNING: Both io.swagger.jaxrs.listing.ApiListingResource#getListing

and
io.swagger.jaxrs.listing.ApiListingResource#getListing are equal
candidates
for handling the current request which can lead to unpredictable
results

Same warning but different class. Sounds like a configuration or
classpath
thing, but I couldn't detect any libraries duplicated on my
classpath.

Thanks.


Thanks for making it work so far.

The question is, where is the first endpoint coming from, or
rather
why
do you see two endpoints as opposed to the one you create ?

Do use a SpringBoot starter with the auto-scan enabled ? That may
create
the endpoint at the "/" address (note for me - make sure this is
also
configurable in the auto-scan case)

I'll need to sign off now as it is getting late but please try to
get
the only endpoint shown first and then we'll see what happens.

FYI, if you use the auto-scan then you can usually remove all the
code
below but only keep a @Bean code returning Swagger2Feature
because it
is
configured, would not be needed otherwise (another note to myself
-
how
to auto-configure Swagger2Feature in SpringBoot given that
Swagger2Feature can be used without Spring too)





--
View this message in context: http://cxf.547215.n5.nabble.
com/Swagger2Feature-not-finding-Api-annotations-in-
interfaces-tp5771115p5771637.html
Sent from the cxf-user mailing list archive at Nabble.com.




------------------------------
If you reply to this email, your message will be added to the
discussion
below:
http://cxf.547215.n5.nabble.com/Swagger2Feature-not-
finding-Api-annotations-in-interfaces-tp5771115p5771639.html
To unsubscribe from Swagger2Feature not finding @Api annotations in
interfaces, click here
<
.
NAML
<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?
macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&
base=nabble.naml.namespaces.BasicNamespace-nabble.view.
web.template.NabbleNamespace-nabble.view.web.template.
NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_
instant_email%21nabble%3Aemail.naml>





--
View this message in context: http://cxf.547215.n5.nabble.
com/Swagger2Feature-not-finding-Api-annotations-in-
interfaces-tp5771115p5771644.html
Sent from the cxf-user mailing list archive at Nabble.com.




------------------------------
If you reply to this email, your message will be added to the
discussion
below:
http://cxf.547215.n5.nabble.com/Swagger2Feature-not-
finding-Api-annotations-in-interfaces-tp5771115p5771648.html
To unsubscribe from Swagger2Feature not finding @Api annotations in
interfaces, click here
<

.
NAML
<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?ma
cro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=
nabble.naml.namespaces.BasicNamespace-nabble.view.web.
template.NabbleNamespace-nabble.view.web.template.NodeNamesp
ace&breadcrumbs=notify_subscribers%21nabble%3Aemail.
naml-instant_emails%21nabble%3Aemail.naml-send_instant_
email%21nabble%3Aemail.naml>






--
View this message in context:
http://cxf.547215.n5.nabble.com/Swagger2Feature-not-finding-
Api-annotations-in-interfaces-tp5771115p5771650.html

Sent from the cxf-user mailing list archive at Nabble.com.





--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


------------------------------
If you reply to this email, your message will be added to the discussion
below:
http://cxf.547215.n5.nabble.com/Swagger2Feature-not-finding-
Api-annotations-in-interfaces-tp5771115p5771666.html
To unsubscribe from Swagger2Feature not finding @Api annotations in
interfaces, click here
<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5771115&code=amNydW1wQGNvbnN0YW50Y29udGFjdC5jb218NTc3MTExNXwtMTU1OTE5MTQ3NA==>
.
NAML
<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>







--
View this message in context: 
http://cxf.547215.n5.nabble.com/Swagger2Feature-not-finding-Api-annotations-in-interfaces-tp5771115p5771818.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to