Using objects from components in arrays of other object
Hello everyone. I can't find any solution, unfortunately. So, I have the object 'address' in my schemas of components, and I want to use it in the array 'addresses', which is a part of the request body. How can I do that? If I do: addresses: type: array items: $ref: '#/components/schemas/addresses' then I get: "addresses": [ { "address": [ { but I need just properties of 'address' in 'addresses' like: "addresses":[{properties_of_address},{properties_of_address}]Array null values
Hello, Is it possible to define an array that can not contain null? I'm compiling it to Java with Open API 3.0 f.e for this example A: type: array minItems: 1 items: $ref: "#/components/schemas/B" B: type: string pattern: ^[a-z]+$ I consider [null] or ["abc",null] invalid Thanks in advanceSolvedCan Swagger UI for Openapi v3 handle arrays in multipart requests?
I have the following Openapi document: { "info": { "description": "This document shows strange behavior in swagger ui", "title": "This document shows a strange behavior in swagger ui", "version": "0.0.0" }, "openapi": "3.0.0", "paths": { "/post": { "post": { "description": "Upload multiple files", "requestBody": { "content": { "multipart/form-data": { "schema": { "properties": { "inputResources": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } } }, "description": "Multipart body to upload files" } } }, }, "servers": [ { "url": "https://httpbin.org" } ] } I want to display it with Swagger UI so I created the following HTML page: <script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script> <script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-standalone-preset.js"> </script> <script> window.onload = function() { const ui = SwaggerUIBundle({ url: "path/to/above/document", validatorUrl : null, dom_id: '#swagger-ui', deepLinking: true, }) window.ui = ui } </script> <div id="swagger-ui"></div> I get a nice display of my request However when I execute it the following multipart body is sent: ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" ewrr,eeee ------WebKitFormBoundaryzRaOvYA1aX8T4BXu-- As you see the strings are just comma-separated which is not a valid way to encode an array of strings in a multipart body. I would expect a part for each string element to be created like that: ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" ewrr ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" eeee ------WebKitFormBoundaryzRaOvYA1aX8T4BXu-- Even worse when I change the format of the inputResources property to binary to send files instead. "inputResources": { "items": { "format": "binary", "type": "string" }, "type": "array" } This changes the multipart body to the following: ------WebKitFormBoundary5OvyKi6BDAuPKnFm Content-Disposition: form-data; name="inputResources" [object File],[object File] ------WebKitFormBoundary5OvyKi6BDAuPKnFm-- Again I would have expected two parts with the respective file's binary content. Am I assuming correctly that Swagger UI simply does not support arrays yet in multipart request bodies? Or did I do something wrong? Kind regards, NeidhartHow to express an array in a swagger definition
How can I express an array of objects in a defition. Here's the sample json { "resourceType": "Patient", "extension": [{ "url": "http://hl7.org/fhir/StructureDefinition/us-core-race", "extension": [{ "url": "ombCategory", "valueCoding": { "system": "http://hl7.org/fhir/v3/Race", "code": "2106-3", "display": "White" } }] }, { "url": "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity", "extension": [{ "url": "ombCategory", "valueCoding": { "system": "http://hl7.org/fhir/v3/Ethnicity", "code": "2135-2", "display": "Hispanic or Latino" } }] } ] }Solved