Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Wrong OAS30 object type definition which faultily inherits from string #43

Open
jsamr opened this issue Aug 2, 2018 · 2 comments
Open

Comments

@jsamr
Copy link

jsamr commented Aug 2, 2018

oas-raml-coverter version 1.1.35

The OAS parser used by ReDoc project complains about a forbidden definition:

Error: Incompatible types in allOf at "#/components/schemas/BarFromFoo"

BarFromFoo should not be of "type": "string"

Full reproduction

Raml definition

types:
  Foo:
    type: object
  BarFromFoo:
    type: Foo
    properties:
      foo: string

Expected output

{
  "components": {
    "schemas": {
      "Foo": {
        "type": "object"
      },
      "BarFromFoo": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Foo"
          },
          {
            "properties": {
              "foo": {
                "type": "string"
              }
            },
            "type": "object"
          }
        ]
      }
    }
  }
}

Observed output

{
  "components": {
    "schemas": {
      "Foo": {
        "type": "object"
      },
      "BarFromFoo": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Foo"
          },
          {
            "properties": {
              "foo": {
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "type": "string"
      }
    }
  }
}
@jsamr jsamr changed the title Wrong OAS30 output Wrong OAS30 object type definition which faultly inherits from string Aug 2, 2018
@jsamr jsamr changed the title Wrong OAS30 object type definition which faultly inherits from string Wrong OAS30 object type definition which faultily inherits from string Aug 2, 2018
@jsamr
Copy link
Author

jsamr commented Aug 9, 2018

Full reproduction available here: https://github.com/jsamr/oas-raml-converter-wrongly-inherits-string

@yingqiaoshop
Copy link

According to the OpenAPI 3.0 specification, for allOf, anyOf, oneOf keywords, there is no need to have the definition on type. So, maybe, one solution is just not to generate "type:" when those keywords are generated.

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

No branches or pull requests

2 participants