scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.42k stars 225 forks source link

Stringified example numbers interpreted as numbers. #238

Closed sserperior closed 2 years ago

sserperior commented 3 years ago

I have a small testcase which exhibits the above behavior with swagger-ui-express 4.1.6 and swagger-jsdoc 6.0.1:

const express = require('express'); const swaggerJsdoc = require('swagger-jsdoc'); const swaggerUi = require('swagger-ui-express');

const swaggerSpecification = swaggerJsdoc({ swaggerDefinition: { openapi: '3.0.0', info: { title: 'Hello World', version: '1.0.0' } }, apis: ['./index.js'] });

const app = express();

/**

app.listen(3000, () => console.log('Express listening on port 3000'));

when I go to the /api-docs URL to load the Swagger-UI page, I see the following in the Request body:

{ "inputText": 6000 }

and the same when I click on "Try it out". The 6000 should be in quotes and was with an earlier version of this stack. How do I get the 6000 quoted again in both the request body display and the try it out control?

scottie1984 commented 2 years ago

Apologies for the delay - I hope you have fixed the issue - if not it would be better to raise with swagger-ui .

Will close for now