Open aeoncl opened 1 year ago
Thanks for reporting this @aeoncl. We'll have a look at this and get back to you.
Hi guys, i've started working on this. i'll submit a PR in the coming days for you to review
Hi @aeoncl, really appreciate the initiative. Please do let us know if you have any queries regarding the code.
@aeoncl Thank you for your patience. The reason we were taking time on this PR is to make sure we also understood the http RFC around this. And it does look like the expected behaviour in your bug description is valid as per this section in RFC 7578. We are now reviewing your PR in this regard. cc @jaydeepk
Hi, I seem to be running into similar issue trying to upload a file in request body where content type is multipart/form-data
Description
Hi 😁, here's the issue:
In a multipart-form-data, you can have an array of parts by specifing the same partname multiple times.
Here is how it looks in the OpenApi definition (pdfFiles):
We expect this to be an array of pdfFiles:
If i send this request to the Specmatic Stub, i get the following error:
This happens because Specmatic thinks a multipart part of type array should contain an array, and not be one: Internally this is interpreted as a ListPattern which matches only if the value is an array.
Snippet from ListPattern.kt
If i change my part value to an array, it works, but that's not the behaviour i expected:
Steps to reproduce
servers:
Expected behavior I expect to receive a 200 OK generated response
System Information:
Additional context To fix it, we'll need to change the way Specmatic interprets "type: array" on multipart parts. Changing the meaning from "contains a json array" to "expect to have the same part multiple times"