Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

APIB: Use a default media type for requests and responses when none is specified #34

Open
chiiya opened this issue Jul 25, 2019 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@chiiya
Copy link
Owner

chiiya commented Jul 25, 2019

The following Response definition in API Blueprint does not have a media type specified, but is still parsed correctly by Drafter.

+ Response 200
   + Body
        ```json
        [
            {
                "id": 2
            },
            {
                "id": 4
            }
        ]
        ```    
    + Schema
        ```json
        :[](schemas/account/responses/users.json)
        ```

The body definition is ignored by comet. A default media type (* or default) should be used in this case.
Relevant section: packages/adapter-api-blueprint/src/transformers/ResponseTransformer:39

if (mediaType !== null) {
  // This block is never entered
}
@chiiya chiiya added enhancement New feature or request good first issue Good for newcomers labels Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant