0

I have this definition in a swagger document:

"/myEndpoint": {
        "post": {
            "summary": "handle",
            "operationId": "handleUsingGET",
            "produces": ["application/json", "application/vnd.spring-boot.actuator.v2+json"],
            "parameters": [{
                    "in": "body",
                    "name": "body",
                    "description": "body",
                    "required": false,
                    "schema": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    }
                }
            ],
            "responses": { ... }
        }

I need to create a request with a body but I'm not sure how to do that with this schema definition. I have read this question so I know that additionalProperties is used to represent a Dictionary. But there is no property name or anything specified here, so can we say any key-value pairs would be valid to sent in the body? Or is this definition not complete?

Selman Genç
  • 100,147
  • 13
  • 119
  • 184
  • Could you please elaborate on what your use case is, i.e. why you need to "generate a sample request"? Are you testing this API? Or writing a client app for this API? Or something else? The answer may be different depending on your use case. – Helen Oct 03 '18 at 15:48
  • @Helen my use case falls into "testing" – Selman Genç Oct 04 '18 at 09:21
  • There are API testing tools that can automatically generate tests based on OpenAPI/Swagger definitions - check out [RESTful API Testbed with Swagger](https://stackoverflow.com/q/30989965/113116) and [Import swagger definition to SoapUI free?](https://stackoverflow.com/q/35398889/113116) – Helen Oct 04 '18 at 09:29
  • @Helen thanks for the links. – Selman Genç Oct 04 '18 at 10:15

0 Answers0