Wildcard content-type "*/*" leads to unparsed JSON responses

Open
#418 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby
Domain
api

Research direction

The bug is that a response declared with the wildcard content-type */* is not parsed, so an object schema fails against a String body. Start where the response parser is chosen from the OAD's response content-type, and check how the wildcard is handled there. Done means a */* response with type: object gets its body parsed and validates. The issue has been open for about a year with one comment and no answer, so confirm the expected behaviour with the maintainer first.

Written by the indexing model from the issue text.

Description

Currently openapi_first picks a response parser based on the content-type defined in your OAD. If you specify a content-type like application/json: your response will be parsed with JSON.

When your OAD has a response content-type specified like */* openapi_first current does not parse the response body at all and just returns the plain body (as a String).

This leads to having a response definition like this always failing validation, because a the string (String) is not an object (Hash):

          content:
            "*/*":
              schema:
                type: object
Dominant language
Ruby
Stars
222
Forks
27
Avg merge
17h 15m
Merged PRs (30d)
6

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ahx/openapi_first

All issues in ahx/openapi_first

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.