swagger-api / swagger-api/swagger-parser

Inlined content schema in RequestBody missing type

Open
#1,210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

In the Pet Store specification (https://petstore.swagger.io/v2/swagger.json) the only 2 inlined request body content schemas (i.e., POST of"/pet/{petId}/uploadImage" and POST of "/pet/{petId}") have type: object.

However, when parsing it with this library and priting the OpenAPI object, i noticed that type: null. This is not true for $ref 'ed request body content schemas which also have type: object and swagger-parser correctly detects their type.

It may be worth noting that this specification is Swagger v2 rather than OpenAPI v3, so swagger-parser still performs a conversion while parsing (which may or may not influence the outcome).

Contributor guide

Open the 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.

Research direction

Reproduce the issue by parsing the Pet Store Swagger v2 specification and inspecting the two inline request body content schemas. Compare their converted schema types with the corresponding $ref schemas, then trace the Swagger v2-to-OpenAPI conversion path. Done means both inline schemas retain type: object after parsing.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.