rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

How to add dynamic formdata parameters #109

Closed vasnav closed 4 years ago

vasnav commented 4 years ago

Hi, Does RapiDoc support sending dynamic formdata string parameters in the url? As per the link https://stackoverflow.com/questions/49875184/how-to-describe-dynamic-form-data-using-openapi-swagger, OpenAPI 3.x supports free-form formdata parameter. Does RapiDoc support it?

Please find below our .yaml file:

paths:
    /sample/test:
        post:
            summary: Formdata parameter.
            operationId: formdataParameter
            description: | 
            tags:
                -   
            parameters: 
                - name: custom
                  in: query
                  description: |
                    Custom attribute. eg. {"custom.ordertype":["2", "3"]} where 'custom.ordertype' is the custom attribute name and the values are '2' and '3'
                  required: false
                  schema:
                    type: object
                    additionalProperties:
                      type: string
                  style: form
                  explode: false
            requestBody:
                description: Request body
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            required:
                                - QuestionAnswerPair
                            properties:
                                QuestionAnswerPair:
                                    description: A question and its answer.Q<type>-<displayFormat>-<questionId>=<answerText|conceptId>
                                    type: object
                                    schema:
                                        type: object
                                    required: false
                                    style: form
                                    explode: false
                                profileId:
                                    type: long
                                    description: The profile ID to be used during the guided help session. This is not used during the casebase lookup.
                                    required: false 

The custom query parameter is correctly shown as: "https://sample/users?customQuery=2"

The custom formdata parameter is incorrectly shown as: "https://sample/users?customQuery=2" -H "Content-Type: application/x-www-form-urlencoded" -F "QuestionAnswerPair=a=b" Instead custom formdata parameter should be: "https://sample/users?customQuery=2" -H "Content-Type: application/x-www-form-urlencoded" -F "a=b"

mrin9 commented 4 years ago

Well, dynamic query params are supported, You can checkout this example for that https://mrin9.github.io/RapiDoc/examples/dynamic-query-params.html

Dynamic form parameters are not yet done, but we do have plans to add it soon

mrin9 commented 4 years ago

provided support in 7.1.0 example: https://mrin9.github.io/RapiDoc/examples/dynamic-form-params.html