Swagger-Core-JAXRS Cannot get HTTPS scheme to work

55 views
Skip to first unread message

Derek Mitchell

unread,
Jun 13, 2015, 9:59:18 PM6/13/15
to swagger-sw...@googlegroups.com
Hello,

According to the documentation, if I send a request using the https protocol, it will by default return "schemes":["https"], but for me, it is returning "schemes":["http"]


When I attempt to set this property in my web.xml file, the resource listing again includes "schemes":["http"]


<servlet>
   <servlet-name>DefaultJaxrsConfig</servlet-name>
   <servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
 <param-name>swagger.api.schemes</param-name>
 <param-value>https</param-value>
</init-param>
....
</servlet>

Is this a bug, or am I doing something wrong?

Ron Ratovsky

unread,
Jun 15, 2015, 3:12:37 AM6/15/15
to swagger-sw...@googlegroups.com
As far as I can tell, we don't really read the property as you add it.
You'd need to opt for the BeanConfig method.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Derek Mitchell

unread,
Jun 15, 2015, 2:00:02 PM6/15/15
to swagger-sw...@googlegroups.com
Still, if I make the call via https and provide no scheme or host isn't it supposed to set the default scheme as https? (since that's the protocol I used in my request).

"For schemes and host, the default is the same scheme and host used to access the swagger.json or swagger.yaml files."

So if I make a call to https://localhost:8443/api/swagger.json, shouldn't the default scheme be https?




--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/plEoiUSR3BI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Derek Mitchell
Founder and CEO
Verdiseno, Inc  |  SolarDesignTool 

Ron Ratovsky

unread,
Jun 15, 2015, 2:01:17 PM6/15/15
to swagger-sw...@googlegroups.com
That's what the spec states and how the tools should support it. Do you not experience it?

Derek Mitchell

unread,
Jun 16, 2015, 5:03:46 PM6/16/15
to swagger-sw...@googlegroups.com
Hi Ron,

No, I'm not experience that. The image below shows a browser request to swagger.json using https and the return scheme as http:

Inline image 2

Ron Ratovsky

unread,
Jun 16, 2015, 5:07:40 PM6/16/15
to swagger-sw...@googlegroups.com
The tools will default to the scheme of the hosted definition only if the scheme is not explicitly defined. In your case, it is defined as http so it will always use that.

Derek Mitchell

unread,
Jun 16, 2015, 5:11:40 PM6/16/15
to swagger-sw...@googlegroups.com
Thanks for the super quick response. I haven't defined the scheme anywhere as http though. 

Ron Ratovsky

unread,
Jun 16, 2015, 5:18:33 PM6/16/15
to swagger-sw...@googlegroups.com
Can you share your full configuration? DefaultJaxrsConfig, BeanConfig or both?

Derek Mitchell

unread,
Jun 16, 2015, 5:28:46 PM6/16/15
to swagger-sw...@googlegroups.com
The only place where I attempt to set configuration properties is in web.xml:

<servlet>
   <servlet-name>DefaultJaxrsConfig</servlet-name>
   <servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
 <param-name>swagger.api.basepath</param-name>
 <param-value>/api</param-value>
</init-param>
   <init-param>
     <param-name>api.model.packages</param-name>
     <param-value>com.solardesigntool</param-value>
   </init-param>
<init-param>
 <param-name>api.version</param-name>
 <param-value>0.9.0</param-value>
</init-param>
   <init-param>
     <param-name>swagger.version</param-name>
     <param-value>1.5.0</param-value>
   </init-param>
   <init-param>
     <param-name>swagger.security.filter</param-name>
     <param-value>com.solardesigntool.api.http.ApiAuthorizationFilterImpl</param-value>
   </init-param>
   <load-on-startup>2</load-on-startup> 
</servlet>

This does work as I know the path is being set to /api.

I am not using BeanConfig.




Derek Mitchell

unread,
Jun 16, 2015, 5:52:37 PM6/16/15
to swagger-sw...@googlegroups.com
Well, I went ahead and used the BeanConfig method and it seems to work. Though I'm not sure how since the BeanConfig is not actually set on anything.
Reply all
Reply to author
Forward
0 new messages