swagger-api / swagger-api/swagger-parser

swagger-v2-converter incorrectly converts 2.0 schemas that do not have the 'type' keyword

Open
#1,378 1 comment 1 reaction 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

2.0 schemas without the type keyword are incorrectly converted to a ObjectSchema. For example, consider the following OAS 2.0 document:

swagger: '2.0'
info:
  title: AnyType test
  version: '1.0.0'
paths: {}
definitions:
  Foo:
    type: object
    properties:
      p1:
        type: object
      p2:
        description: test

Property p1 is an object, which is represented as a ObjectSchema. Property p2 does not have the type keyword specified, hence its value can be anything. It should be modeled an instance of the Schema class with the type property set to the null value. Currently it is modeled as an instance of ObjectSchema and the type property is set to object.

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

Start at the swagger-v2-converter entry point and reproduce the OAS 2.0 document from the issue, focusing on conversion of the Foo definition and its p1 and p2 properties. Done means p1 remains an ObjectSchema while p2 is represented by Schema with a null type.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.