0

Hello I am quite new to swagger ui OAPSEC definition. currently we have one yaml file in project and we wanted to have multiple versions of this yaml file. and we wanted to support these multiple yaml files in swagger ui (something like dropdown to choose between which yaml file api's swagger should display). As of now for single file we have below code which is working fine.

import SwaggerUI from 'swagger-ui'
import 'swagger-ui/dist/swagger-ui.css';

const spec = require('./folder/to/sepc/spec.yaml');

const ui = SwaggerUI({
  spec,
  dom_id: '#swagger',

  
  supportedSubmitMethods: [],

});

ui.initOAuth({
  appName: "API NAME",
  clientId: 'implicit'
});

From above code I have tried removing spec attribute and added below urls(dummy) param. but unfortunately I see a screen no api definition found in swagger ui when I run it. Some pointers would be helpful.

urls: [
    {name: "petstore",  url: "http://petstore.swagger.io/v2/swagger.json"},
    {name: "instagram", url: "https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml"}
  ],
  "urls.primaryName": "petstore"

1 Answer 1

1

I have verified swagger UI document thoroughly and I have understood that this urls param will support in swagger-ui-dist module. Thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.