Contributions
Dynamic/Variable servers URLs in the swagger document
I was trying to find out how I could specify my server URLs inside my swagger.json file so that when we deploy the documentation to the different servers (i.e., production, staging, dev, etc), each link points to the right server without user involvement. Currently, I have the following setup which works fine: "servers": [ { "url": "https://.../api/.../v1", "description": "Staging server" }, { "url": "https://.../api/.../v1", "description": "Production server" } ] I am looking to do something like this: "servers": [ { "url": process.env.serverUrl, "description": process.env.serverName } ] I am using swagger-ui-express in a Vue CLI project.2.9KViews0likes3CommentsIs it possible to customize the Authorization UI in the Swagger editor?
Hi there, I have created specifications for my API under openapi V3.0.3. My API can be authorized in two ways: By passing a JWT token or a combination of accessKey, secretKey, and 2 more pieces of data. I don't have any issues with implementing these approaches and everything works fine. The problem is how the authorization screen looks like. It displays 5 separate fields the user should fill in either a token or 4 other values and hit the Authorize btn for each. I'd like to have a radio btn or dropdown where the user can select his/her desire authorization method, enter value(s), and hit the btn. Or, at the minimum, to have those 4 related fields and then one btn to authorize.444Views0likes0CommentsDefining a Dynamic JSON Object in Response
Hi there, I am documenting our API by using Open API 3.0.3 and the Swagger editor. One of the get methods returns MongoDB indexes in the following format. I am wondering how I can define my response specifications: ``` [ { "purl_-1": [ [ "purl", -1 ] ] }, { "cIndex_product_-1_price_-1": [ [ "product", -1 ], [ "price", -1 ] ] } ``` As you can see, the key part of the objects is the name of the index, which is built by combining all array items.486Views0likes0CommentsWhere to add minItems and maxItems
I am trying to force only one item for my array parameter by setting minItems and maxItems to 1 but I couldn't make it work in the UI. It still lets me add more items. I tried to put these properties on different levels but still no luck. I also tried the specs without "content" and still the same result. Here is my parameters definition: "parameters": [ { "in": "query", "name": "find", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "minItems": 1, "maxItems": 1, "properties": { "$match": { "type": "object", "description": "To specify conditions to filter the result.", "default": {}, "properties": { "name": { "type": "string", "description": "Name of the desired import" } } } } } } } } } ] Another issue that I faced is that the "find" param is not sent as an array. I got error 503 (socket hang up): Sent URL: https://.../api/contact-service/v1/imports?find=%7B%0A%20%20%22%24match%22%3A%20%7B%7D%0A%7D&count=&limit=20&skip=0 This is the decoded value for find (the same object should have been an item of an array): { "$match": { "name": "12234" } } And here is the actual definition that I executed the method with: parameters: - in: query name: find schema: type: array items: type: object properties: $match: type: object description: To specify conditions to filter the result. default: {} properties: anyOf: - name: type: string description: Name of the desired import You are seeing anyOf because this param will have more properties that I haven't added yet.570Views0likes0CommentsWhat editor can support the latest OAS 3.23.x?
Hi there, I am wondering how I can verify my swagger documentation based on the latest OAS version. I know about the swagger editor which is available online (https://editor.swagger.io) and the npm package of the same editor (https://www.npmjs.com/package/swagger-editor/v/3.6.34) but the problem with both have is that they only support Open API 3.0.x or Open API 3.1.x respectively. However, there are some new features (like oneOf, anyOf, etc) that I'd like to use in my documentation, and would like to have the validation feature to make sure everything looks fine. Apart from validation, I believe these editors cannot also parse those features in their UI to see the result properly.367Views0likes0Comments