Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Conversation

@kylef
Copy link
Member

@kylef kylef commented Jul 19, 2019

This PR adds support for generating message body assets for text types like text/plain and text/html.

Example usage:

responses:
  200:
    content:
      text/plain:
        schema:
          type: string
          example: The request was successful

To produce message body, such as if the response was:

Content-Type: text/plain

The request was successful

@kylef kylef added the openapi3 label Jul 19, 2019
const jsonMediaType = /^application\/\S*json$/i;
return jsonMediaType.test(type.type);
const contentType = contentTyper.parse(mediaType);
const { type, suffix, subtype } = mediaTyper.parse(contentType.type);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored isJSONMediaType to use mediaTyper so it is implemented in the same way that isTextMediaType is implemented. I think it can be a bit safer to use mediaTyper than custom regex.

@kylef kylef force-pushed the kylef/oas3-text-type branch from 3210fe9 to 479e2e6 Compare July 19, 2019 13:44
@kylef kylef force-pushed the kylef/oas3-text-type branch from 479e2e6 to c89d21d Compare July 19, 2019 13:46
@coveralls
Copy link

coveralls commented Jul 19, 2019

Coverage Status

Coverage increased (+0.03%) to 84.842% when pulling c89d21d on kylef/oas3-text-type into b95481f on master.

@apiaryio apiaryio deleted a comment from coveralls Jul 19, 2019
@pksunkara pksunkara merged commit b3b49be into master Jul 19, 2019
@pksunkara pksunkara deleted the kylef/oas3-text-type branch July 19, 2019 13:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants