Regarding swagger is not working in nodejs as per the swagger document.
Hi there, I tried to setup swagger on nodejs as per the document par it is not working and present wrong data of swagger UI see the below attached screenshot. So just wanted to know how to setup swagger in nodejs so that all my apis display in one place. I tried lot of solutions on different different websites but same issue appeared. So kindly guide how to do that so that swagger is running properly. Reference site that I tried below: https://swagger.io/docs/open-source-tools/swagger-codegen/#:~:text=The%20Swagger%20Codegen%20is%20an,can%20be%20found%20in%20GitHub. https://levelup.gitconnected.com/how-to-add-swagger-ui-to-existing-node-js-and-express-js-project-2c8bad9364ce https://medium.com/bb-tutorials-and-thoughts/how-to-add-swagger-to-nodejs-rest-api-7a542cfdc5e1 https://plainenglish.io/blog/how-to-implement-and-use-swagger-in-nodejs-d0b95e765245 https://dev.to/kabartolo/how-to-document-an-express-api-with-swagger-ui-and-jsdoc-50do https://itnext.io/setting-up-swagger-in-a-node-js-application-d3c4d7aa56d4 https://github.com/Surnet/swagger-jsdoc/blob/master/README.md Looking forward to hearing from you. Thanks! Swagger.json: { "swagger": "2.0", "info": { "version": "1.0.0", "title": "My User Project CRUD", "description": "My User Project Application API", "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" } }, "host": "localhost:3000", "basePath": "/", "tags": [ { "name": "Users", "description": "API for users in the system" } ], "schemes": ["http"], "consumes": ["application/json"], "produces": ["application/json"] } Server.js: import swaggerUi from 'swagger-ui-express'; import swaggerDocument from './swagger.json'; app.use( '/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument) ); app.listen(port, () => { console.log(`Server running at ${process.env.SERVER_URL}`); });2.9KViews0likes6CommentsMultiple urls for tokenUrl for multiple servers
I have a list of servers like this: servers: - url: https://api.prod.mydomain.com description: Production URL - url: https://api.{environment}.dev.mydomain.com description: Environment URL And would like my securitySchemes for OAuth2 to mention that the tokenUrl will be different depending on the server you use. Either allow tokenUrl to be a list of urls securitySchemes: oAuth2: type: oauth2 description: 'This API is using OAuth 2.0 with password grant type for authentication.' flows: password: tokenUrl: - https://api.environment.dev.mydomain.com/oauth/token - https://api.prod.mydomain.com/oauth/token scopes: read_pet: read your pets write_pet: modify pets in your account Or to use `server` as a variable like this for the tokenUrl string? securitySchemes: oAuth2: type: oauth2 description: 'This API is using OAuth 2.0 with password grant type for authentication.' flows: password: tokenUrl: {server}/oauth/token scopes: read_pet: read your pets write_pet: modify pets in your account Does anyone know of a way to do this?How to refer to models from different packages in auto generated class? Like Pageable
How to refer to models from different packages in same method in auto generated controller? Like "getAllProducts" uses "Pageable" from "org.springframework.data.domain.Pageable" and "Product from "com.pepsico.och.inventory.domain.product.Product" package.If we use x-[class/field]-extra-annotation then it’s adding annotation but not importing class
If we use x-class-extra-annotation or x-field-extra-annotation to add class or field level annotations like these "@JsonInclude(JsonInclude.Include.NON_NULL), then it’s adding the required annotations but it’s not importing the required class. So, how to import let's say JsonInclude in generated dto?