Reputation: 11
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"
Upvotes: 0
Views: 747
Reputation: 11
I have verified swagger UI document thoroughly and I have understood that this urls param will support in swagger-ui-dist module. Thanks
Upvotes: 1