How 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" } }] } ] }SolvedArray 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 validate whether an array of objects in the response is sorted by a field ??
Sample Response { "result": { "list": [ { "proceduresId": 282, "name": "dark knightnew batch workflow 123", "templateId": null, "isLocked": 0 }, { "proceduresId": 281, "name": "latest_trendsnew batch workflow 123", "templateId": null, "isLocked": 0 }, { "proceduresId": 284, "name": "new batch workflow 123", "templateId": null, "isLocked": 0 }, { "proceduresId": 280, "name": "new batch workflow 123new batch workflow 123", "templateId": null, "isLocked": 0 } ], "count": 4 }, Hi, I am trying to write a script assertion to validate whether the objects in listarray are sorted by "proceduresId" field. Please help. Thanks HarshaSolved1.4KViews0likes2CommentsUsing 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}]OpenAPI 3 define array mixed types without object type
To avoid response size >1Mbyte to GET array of a fixed mixed array structure such as customer: Howto define a mixed array with pure data without repetitive field names? [ [„John“,“Tannert“,37,true,“CA“], [„Mary“,“Adley“,44,true,“MD“], [„Kevin“,“Hamton“,27,false,“MI“] ]881Views0likes1CommentMismatch between JSON displayed in Raw Data and in JSON viewer pane
Hi, I am using SOAPUI 5.2.1 (build date: 20151002-1138) to test the response of a REST webservice. The service seems to be sending an incorrect JSON data, wherein a node that was expected to come as an array is, of course, not coming as an array. The JSON Viewer pane though shows the node as an array, which caused quite a bit great confusion till the raw data pane showed that the JSON response is indeed having an issue. To illustrate, let me give an example here: Data taken from Raw: { "APIResponse": { "Contact": { "phoneNumbers" : { "type" : "mobile", "number" : "1234567890" }, "phoneNumbers" : { "type" : "landline", "number" : "9876543210" } } } } And this is how it mysteriously appears in JSON tab with the node "phoneNumbers" automatically converted as an array: { "APIResponse": { "Contact": { "phoneNumbers" : [ { "type" : "mobile", "number" : "1234567890" }, { "type" : "landline", "number" : "9876543210" } ] } } } Any idea why this is happening? Thanks in advance!!809Views0likes0CommentsPassing array from groovy to request in Ready!API 2.3.0
Hi, I am passing multiple dates to my request, From groovy I returning this:[2018-06-11, 2018-06-13, 2018-06-11, 2018-06-14, 2018-06-11, 2018-06-14] Before version 2.3.0 I was using the script below to access each element (this one gives 2018-06-11): ${Groovy-CheckIn-CheckOut#result#$[0]} However in latest version it returns empty, also GetData no longer recognizes this array. Is there other way to access, is it related to JSON version update (I am not using one)?808Views0likes0Comments