Deep-linking to schema docs
While deep-linking API endpoints works as described on https://swagger.io/docs/open-source-tools/swagger-ui/usage/deep-linking/, schemas aren't included it seems. When I manually add an anchor to the HTML node id of a schema div, a `/` prefix gets added automatically, making the browser NOT find that id. When I then remove the slash and press Return in the location bar, things work as expected. Am I doing something wrong? If not, can schema support be added (expanding a schema currently does not rewrite the anchor)?Server Variables - can it be refrenced?
i am using openapi:3.0.0 i have five servers define in swagger inside it i am using variables specific to servers. something like this servers: - url: https://server1/api/{version} description: server variables: version: description: versioning of api enum: - v1 default: v1 - url: https://server2/api/{version} description: server variables: version: description: versioning of api enum: - v1 default: v1 Can we declare variables once and can we reference in multiple servers? here i am breaking "DRY" by declaring same variables again and again.CORS error on using try out feature in swagger-ui-react
I integrated swagger-ui-react to display API documentation and utilized its tryout feature for API testing. However, after enabling Bearer Token authorization, I encountered a CORS error on all API calls performed from the swagger-ui tool. Can anyone help me to resolve this issue?Error message Can't read from file myWebsite.com:443/swagger/docs/v1
Hi everyone, I am dealing with a peculiar validation error on our swagger UI implementation. The swagger validator is marking the website as invalid, and when you click on the validator link it returns the error message: {"schemaValidationMessages":[{"level":"error","message":"Can't read from file https://mywebsite.com:443/swagger/docs/v1"}]} the strange thing is that if I browse tohttps://mywebsite.com:443/swagger/docs/v1from an external computer The text of the documentation is displayed, so the url is publicly accessible. Any ideas?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.3KViews0likes6CommentsDisable default /v3/api-docs springdoc openapi endpoint in Swagger UI
I migrated from code-first approach to api design-first approach by writing an openapi specification file. but whenever I hit swagger-ui/index.html, I can see it is loading previous specification file as default like /v3/api-docs. I want this url to load my custom openapi-specification file (openapi-spec.yaml). how to achieve this in java spring boot? I want to remove this default endpoint of /v3/api-docsEnabling "Authorize" button
How do I enable the "Authorize" button in Swagger UI? I got it all set up, but if the endpoints require authentication, it's not going to work straight from the UI. I need to be able to pass tokens as `Authorization` header values Do I need to pass some yml property? I have a Java app Should I write something here? ```java @SpringBootApplication @OpenAPIDefinition(info = info(version = "1.0", title = "Hello World API"), security = @SecurityRequirement(name = "/* here */")) public class HelloworldMreApplication { public static void main(String[] args) { SpringApplication.run(HelloworldMreApplication.class, args); } } ``` I tried this: ```java @RestController @RequestMapping("/auth") @Tag(name = "Message Controller") @SecurityScheme(type = SecuritySchemeType.HTTP, name = "basicAuth") public class MessageController { @GetMapping("/hello-world") // ... ``` I got the button, but it's not useful. Once I click on it, I get a popup that says "Available authorizations" and that's it A more verbose variation produced the same result ```java @SecurityScheme(type = SecuritySchemeType.HTTP, name = "basicAuth", description = "authorization with JWT token", scheme = "token", bearerFormat = "bearer") ```Non-Primitive, Non-Scalar HTTP Values
How can standard HTTP values that are non-primitive, non-scalar be documented in OpenAPI? They most often occur in HTTP header fields, but they occasionally occur in the path or query string too. There appears to be no documentation or coverage for these scenarios. Are these a gap or omission from the specification? A few examples include: - Accept (with quality) (ex: Accept: application/json; q=0.8, application/xml, application/problem+json) - Range (ex: Range: bytes=0-99) -Content-Disposition (ex: Content-Disposition: attachment; filename=example.txt) -Link(ex: Link: <https://my.api.com/swagger.json>; rel="openapi" type="application/json") There are other cases as well. Some values in the OData protocol have specific value formats that seemingly cannot be described by OpenAPI. Arrays, for example, must be encoded with surrounding '[' and ']'. While an argument can be made that these values are objects and can be represented in the schema, there doesn't seem to be a way to control or define their serialization and deserialization. A well-known HTTP header cannot be represented in another format such as JSON nor are the values just text. A regular expression might be a way to enforce the format, but it is still a poor representation in the schema and UI. Perhaps I've missed something in the specifications or documentation. Any thoughts or suggestions are appreciated.