Gi60s / openapi-enforcer

Apache License 2.0
94 stars 22 forks source link

Body is not allowed #62

Closed ghost closed 4 years ago

ghost commented 4 years ago

This path

"post": {
                "requestBody": {
                    "description": "Pet to add to the store",
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/NewPet"
                            },
                            "examples": {
                                "tigresse": {
                                    "value": {
                                        "name": "Tigresse",
                                        "tag": "cat"
                                    }
                                }
                            }
                        }
                    },
                    "required": true
                },
                "tags": [
                    "pet"
                ],
                "responses": {

is giving me this error.

$ curl -X POST 'http://localhost:3011/pets' -H 'Content-Type: application/json; charset=utf-8' -d '{"name": "max","tag": "dog"}'

{"error":{"statusCode":400,"message":"Request has one or more errors"}}% 

on my server app:

[ EnforcerException: Request has one or more errors
    Body is not allowed ]

I am using the requestBody property so I can't see where my error is.

ghost commented 4 years ago

I forgot to specify error option.