-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Description
I've configured my api with swagger openapi3.0, unfortunately, it is not showing try it out button for my API endpoints. am I missing any configuration in the swagger file? can anyone help me how to solve this error? I've already posted the same on stackoverflow for help. but some stupid people are closing it as a duplicate by not knowing whether the question is having accepted answer or not.
Note: I'm using swagger open API3.0
here is the configuration I've used:
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Reinvent-API",
"description": "Reusable and minimalistic API for Hyperledger-fabric Networks",
"contact": {
"name": "Dev",
"email": "[email protected]",
"url": "https://dev.github.io/"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"servers": [
{
"url": "http://localhost:3000/api"
}
],
"paths": {
"/invoke": {
"post": {
"tags": [
"API Explorer"
],
"description": "invoke chaincode function",
"operationId": "invoke",
"requestBody": {
"description": "body parameters should be passed as the order defined in chaincode function. First argument must be function name to call.",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/invoke"
}
}
}
},
"responses": {
"200": {
"description": "Chaincode Invoke Succesfull.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/invoke"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"invoke": {
"properties": {
"fcn": {
"type": "string"
},
"arg1": {
"type": "string"
},
"arg2": {
"type": "string"
}
}
}
}
}
}
Here is the express configuration I've used.
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
swaggerUi = require('swagger-ui-express')
swaggerDocument = require('./swagger.json');
app.use(bodyParser.urlencoded({ extended: true }));
var options = {
swaggerOptions: {
supportedSubmitMethods:["get", "post"]
}
};
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options));
Or maybe it should be posted to swagger-ui github as a bug?
Metadata
Metadata
Assignees
Labels
No labels