Skip to content

Include extact HTTP content in case of Multipart #4405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LasneF opened this issue Mar 4, 2025 · 5 comments
Open

Include extact HTTP content in case of Multipart #4405

LasneF opened this issue Mar 4, 2025 · 5 comments
Milestone

Comments

@LasneF
Copy link
Member

LasneF commented Mar 4, 2025

When using multipart it can be confusing especially when dealing with array

in the case describes

  content:
    multipart/form-data:
      schema:
        type: object
        properties:
          id:
            # default for primitives without a special format is text/plain
            type: string
          addresses:
            # default for arrays is based on the type in the `items`
            # subschema, which is an object, so `application/json`
            type: array
            items:
              type: object
              properties : 
                 street: 
                    type: string
                 city 
                    type : sting

it can be interesting to add the exact HTTP content

Rationnal : Prism fails to do validation of such structure ,
several AI tool chatbot replies divergent / not correct answer from the truth (or may be i am wrong still they are confused)
looks they are mixing the content , with the parameter name

Content-Type: multipart/form-data; boundary=--------------------------002292520254007945318895

----------------------------002292520254007945318895
Content-Disposition: form-data; name="id"
Content-Type: application/json
"32d49c7f-566c-4d07-9f13-08e74fb5c464"
----------------------------002292520254007945318895
Content-Disposition: form-data; name="addresses"
Content-Type: application/json
{
"street" : "4726 Earth Street"
"city" : "Houston"
}
----------------------------002292520254007945318895
Content-Disposition: form-data; name="addresses"
Content-Type: application/json
{
"street" : "4 Moon Street"
"city" : "Edwards"
}

----------------------------002292520254007945318895--

and not something with

----------------------------002292520254007945318895
Content-Disposition: form-data;
Content-Type: application/json
{
"addresses" : [ { "street" : "4 Moon Street" , "city" : "Edwards"} ,
{ "street" : "4726 Earth Street" , "city" : "Houston" } ]
}

@handrews
Copy link
Member

@LasneF I strongly agree. In fact I thought I included such an example, but I remember that the syntax highlighting was a mess and I put it on the back burner and never got around to it. I know @ralfhandl fixed syntax highlighting for query string examples — This is more complex, but perhaps we could figure it out? I remember finding a highlighter somewhere that would correctly read the Content-Type per-part field and use the appropriate syntax highlighter (e.g. JSON, XML, plain text) on each part.

@handrews handrews added this to the v3.1.2 milestone Mar 11, 2025
@ralfhandl
Copy link
Contributor

@handrews Please create a PR adding such an example and let's see how it gets rendered and what can be improved.

@LasneF
Copy link
Member Author

LasneF commented Mar 13, 2025

i will give it a try with a with the above content , @ralfhandl is there a way to check the renderer page of a branch ?

@handrews
Copy link
Member

handrews commented Mar 13, 2025

@LasneF npm run build-src (I have filed #4433 to document this)

@smshukkur
Copy link

Details

[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants