Forum Discussion

Dimkanp's avatar
Dimkanp
New Contributor
4 years ago

Linking to custom documentation file

Hello! I'm looking for answer for my problem: how to link to documentation from custom file?
I run the swagger ui docker instance using this command 'docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui' and add some other documentation files next to the swagger.json, so I can switch between them on the site but I can't create link that opens additional file with documentation. Is exists any way to do that? Any path variable like this ip:port/#/users/search?documentation=/doc_v2.json ?

  • Solution:
    Using URLS environment variable gives opportunity to chose documentation file from drop down menu on the site and path to the request changed.


    Env variable passed to docker:
    URLS=[{url:'./swagger.json',name:'stable'},{url:'./develop.json',name:'develop'}]

     

    Url to the request defined in non default documentation file:
    ip:port/?urls.primaryName=develop#/users/search

    Documentation: Swagger Documentation 

  • Dimkanp's avatar
    Dimkanp
    New Contributor

    Solution:
    Using URLS environment variable gives opportunity to chose documentation file from drop down menu on the site and path to the request changed.


    Env variable passed to docker:
    URLS=[{url:'./swagger.json',name:'stable'},{url:'./develop.json',name:'develop'}]

     

    Url to the request defined in non default documentation file:
    ip:port/?urls.primaryName=develop#/users/search

    Documentation: Swagger Documentation