apiaryio/snowcrash

Do not warn for empty GET request body

Closed this issue · 4 comments

As reported in danielgtaylor/aglio#142, we should not (I think) be generating a warning when the request is of type GET and there is no body. Interestingly the warning goes away if there is a header block but no body. Example blueprint:

FORMAT: 1A
# My API
## My resource [/foo]
### Get a foo [GET]
+ Request test
+ Response 200
    + Body

            {"foo": "bar"}

Generates >> Line 5: empty request message-body (warning code 6)

zdne commented

What is the use case for empty payload?

+ Request test
+ Response 200

I have the suspicion that this is a request to enable same status responses ...

. Interestingly the warning goes away if there is a header block but no body

This is because the request contains something – a header.

We give a warning when the request is an empty payload which should not be allowed in API Blueprint.

@zdne @pksunkara is the expected way to do this something like:

### Get a foo [GET]
+ Response 200
    + Attributes (Whatever)
+ Response 400
    ...
+ Response 403
    ...
+ Response 500
    ...

I thought we wanted request/response pairs?

@danielgtaylor Users should write request/response pairs when they need to shows two different responses for the same status code. When that happens the requests generally contain a different payload so there should be no warning.

Other than that, the example in the above comment looks good.