ePages-de / ePages-de/restdocs-api-spec

OpenApi2 SwaggerUI execute POST sends empty body

Open
#166 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Kotlin
Stars
427
Forks
116
Avg merge
23h 54m
Merged PRs (30d)
1

Description

The OpenApi2 SwaggerUI Try Out for POST request appears to be broken, it sends an empty request body. (OpenApi3 works).

This is the resource.json:

```json
{
"operationId" : "birthCertificate",
"summary" : null,
"description" : null,
"privateResource" : false,
"deprecated" : false,
"request" : {
"path" : "/example",
"method" : "POST",
"contentType" : "application/json;charset=UTF-8",
"schema" : null,
"headers" : [ ],
"pathParameters" : [ ],
"requestParameters" : [ ],
"requestFields" : [ ],
"example" : "{\"some\": \"json\"}",
"securityRequirements" : null
},
"response" : {
"status" : 200,
"contentType" : "text/xml",
"schema" : null,
"headers" : [ ],
"responseFields" : [ ],
"example" : "\n"
},
"tags" : [ "sometag" ]
}
```

Below is the resulting openapi2.yml. It has an empty parameter name for the body, and I suspect that this causes the problem, see https://github.com/swagger-api/swagger-ui/issues/965

```yaml
swagger: "2.0"
info:
description: xmaproutes Service
version: 1.0-SNAPSHOT
title: xmaproutes
host: localhost:8090
tags: []
schemes:
- http
paths:
/example:
post:
tags:
- sometag
operationId: birthCertificate
consumes:
- application/json;charset=UTF-8
produces:
- text/xml
parameters:
- in: body
name: "" # I suspect that the empty name might cause the empty body
required: false
schema:
$ref: '#/definitions/myrequest3530607'
x-examples:
application/json;charset=UTF-8: "{"\some\": \"json\"}"
responses:
"200":
description: ""
examples:
text/xml: |-


definitions:
myrequest3530607:
example: "{\"some\": \"json\"}"

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.