Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sebastien-rosset opened this issue May 19, 2020 · 1 comment

Comments

@sebastien-rosset
Copy link
Contributor

sebastien-rosset commented May 19, 2020

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.

@sebastien-rosset sebastien-rosset changed the title swagger-v2-converter incorrectly converts schemas without the 'type' keyword swagger-v2-converter incorrectly converts 2.0 schemas that don't have the 'type' keyword May 19, 2020
@sebastien-rosset sebastien-rosset changed the title swagger-v2-converter incorrectly converts 2.0 schemas that don't have the 'type' keyword swagger-v2-converter incorrectly converts 2.0 schemas that do not have the 'type' keyword May 19, 2020
@spacether
Copy link
Contributor

spacether commented Mar 22, 2021

This makes it impossible to tell if the source schema was:
{type: object} which only allows objects in or {} which allows in any type
And it does not conform to the docs describing AnyType here: https://swagger.io/docs/specification/data-models/data-types/#any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants