Skip to content

Instantly share code, notes, and snippets.

View webron's full-sized avatar

Ron webron

  • fabric
View GitHub Profile
responses:
200:
description: "Success"
schema:
allOf:
- type: "object"
properties:
isSuccess2:
description: When True - Password was successfully updated
type: boolean
- in: query
name: field
schema:
type: array
items:
type: string
enum:
- value1
- value2
- value3
openapi: 3.0.0
info:
title: Swagger Petstore
version: '2.0'
description: >-
This is a sample server Petstore server. You can find out more about Swagger at
[https://swagger.io](https://swagger.io) or on [irc.freenode.net, #swagger](https://swagger.io/irc/).
termsOfService: https://swagger.io/terms/
contact:
MyModel:
type: object
additionalProperties:
type: string
minProperties: 1
@webron
webron / Instructions.md
Last active February 11, 2021 14:06
Load multiple resources to swagger-ui - work by @ponelat

Steps to follow:

  1. Create a new global SwaggerUi object, make sure to give the global variable a new name (in this case, swaggerUi2 - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L59-L84.
  2. Assign a new URL - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L60 - in this case, we use the same pet store URL, but just change the value to the swagger.json you want to display.
  3. Provide a unique dom_id - in this case we went with swagger-ui-container2 - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L61
  4. Load the new SwaggerUi object - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L103
  5. Add a <div> to display it. In it, make sure the id is set to the dom_id set in step 3, and that the class is swagger-ui-wrap so that the CSS is applied - https://gist.github.com/webron/7c41db7f777471fcbc10#file-index-html-L135

You can repeat the steps above as many times as needed, just make sure to provide a unique `dom_i