I just created this for swagger ui 3.x  i hope it works for you 

https://gist.github.com/hareeqi/c9496288cfccf52342930874ac9670d3

On Friday, April 7, 2017 at 3:39:37 PM UTC+2, Marcus Eklöf wrote:
>
> window.swaggerUi.api.setHost('host:port')
>
> This worked perfectly for what I was looking for!
> However, I recently tried out Swagger UI 3.0.4. Is there a way to set the 
> Host in that version as well? Seems odd that the function would not be kept 
> on that version?
>
>
>
> Den lördag 28 november 2015 kl. 02:48:25 UTC+1 skrev tony tam:
>>
>> There is a setHost and setBasePath available in the swagger-js, which is 
>> reference from swagger.ui.  From petstore:
>>
>> window.swaggerUi.api.setBasePath('/new/base/path')
>>
>> Same goes for host.  Is that what you're looking for?
>>
>>
>> On Thursday, November 19, 2015 at 11:23:05 PM UTC-8, Skip wrote:
>>>
>>> Any technique to get what OP was asking for? I posted yet another 
>>> question on this as the links here were broken.
>>> Thanks
>>>
>>> On Monday, 27 April 2015 21:16:25 UTC+5:30, tony tam wrote:
>>>>
>>>> I do believe you can leave `host` blank in your spec (2.0 only) and 
>>>> it'll be treated relative to where you load it from.
>>>>
>>>> On Monday, April 27, 2015 at 8:17:54 AM UTC-7, Josh Ponelat wrote:
>>>>>
>>>>> Currently, the basePath + schema( the http part) get baked into the 
>>>>> operations, when fetching and then compiling a spec.
>>>>>
>>>>> I'm still playing around with it, 
>>>>> but it seems to be impossible at the moment to do this in swagger-ui, 
>>>>> I will of course stand corrected by others?
>>>>>
>>>>> On Monday, April 27, 2015 at 4:19:07 PM UTC+2, Юра Каплун wrote:
>>>>>>
>>>>>> I'm using  ASP.NET MVC. Is there are any way to do this only via JS?
>>>>>>
>>>>>> On Monday, April 27, 2015 at 4:37:58 PM UTC+3, tony tam wrote:
>>>>>>>
>>>>>>> There are many different techniques.  Look at these samples:
>>>>>>>
>>>>>>> Using spring configuration:
>>>>>>>
>>>>>>>
>>>>>>> https://github.com/swagger-api/swagger-core/tree/master/samples/java-jaxrs-cxf
>>>>>>>
>>>>>>>
>>>>>>> Using bootstrap servlet:
>>>>>>>
>>>>>>>
>>>>>>> https://github.com/swagger-api/swagger-core/tree/master/samples/java-jaxrs-no-webxml
>>>>>>>
>>>>>>> On Monday, April 27, 2015 at 5:17:58 AM UTC-7, Юра Каплун wrote:
>>>>>>>>
>>>>>>>> Hi, guys.
>>>>>>>> I have one problem. I have one site with SwaggerUi and three APIs 
>>>>>>>> from different environments.  I did not specify host and base path 
>>>>>>>> because 
>>>>>>>> I need setup it dynamically when the user selects environment. But I 
>>>>>>>> don't 
>>>>>>>> know how can I do this. I tried to do something like this 
>>>>>>>> swaggerUi.api.host="myhost" but this didn't work. SwaggerUi uses the 
>>>>>>>> same 
>>>>>>>> host that the site uses. Can you help me, please?
>>>>>>>>
>>>>>>>

-- 
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-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to