Submit An Array of Integer Elements In formdata
See original GitHub issueSwagger sends the field location (array) as a single value
/signup: {
post: {
tags: ['Authentication'],
requestBody: {
required: true,
content: {
'multipart/form-data': {
schema: {
type: 'object',
properties: {
...schema.CreateUserBody.properties,
location: {
type: 'array',
items: {
type: 'integer'
},
example: [32.3046505, 30.6080822]
},
profileImg: {
type: 'string',
format: 'binary'
},
},
}
}
}
},
responses: {
201: {
description: 'User Created',
content: {
'application/json': {
// schema:{
// $ref: '#/components/schemas/User'
// }
}
}
}
}
},
}
i expected that the field(location) will be repeated for each element in the array
how would i make it work this way ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Can I append an array to 'formdata' in javascript?
I am attempting to upload an arbitrary number of files, with AJAX, which the user specifies with standard form input elements. The server-side...
Read more >Using FormData Objects - Web APIs | MDN
The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. It is primarily intended for use in sending...
Read more >FormData append javascript array (JSON.stringify ... - Laracasts
I'm using Vue/ inertia, to submit a javascript array to be stored as JSON in ... For FormData.append() to work with an array,...
Read more >Send Array as Part of x-www-form-urlencoded Using Postman
How to send array data using x-www-form-urlencoded via Postman. ... It sends an encoded form data set for submission to the server.
Read more >JavaScript FormData
JavaScript FormData · const formData = new FormData(form); · const btn = document.querySelector('#submit'); const form = document.querySelector('#subscription'); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just ran into this bug as well. My case is with application/x-www-form-urlencoded. I think the issue is related to the requestBody section.
I am attaching an example where explode is set to true in both the parameter block and the requestBody and they behave differently.
The example midway down this page mentions that you can specify the explode param in the encoding block for the requestBody - https://swagger.io/docs/specification/describing-request-body/
I’m using that exact example, except setting explode to true.
@Crackz the next version of the spec, OpenAPI 3.1, will support exploded arrays in
multipart/form-data
requests, and this is the default serialization style for arrays in form data (i.e.style: form
+explode: true
).