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

Does not convert "type: null" correctly in most common use case. #21

Closed
dskvr opened this issue Feb 14, 2019 · 3 comments
Closed

Does not convert "type: null" correctly in most common use case. #21

dskvr opened this issue Feb 14, 2019 · 3 comments

Comments

@dskvr
Copy link

dskvr commented Feb 14, 2019

Written in yaml because json is exhausting

someObject: 
  type: object 
  property: 
    nullableProperty: 
      oneOf:
        - type: "null"
        - type: object 
          properties: 
            yay: 
              type: string 

Resulting output (Incorrect )

someObject: 
  type: object 
  property: 
    nullableProperty: 
      oneOf:
        - nullable: true
        - type: object 
          properties: 
            yay: 
              type: string 

Expected Output (correct)

someObject: 
  type: object 
  property: 
    nullableProperty: 
      type: object 
      nullable: true
      properties: 
        yay: 
          type: string 

While this will validate (loosely) against Swagger 3.0 specification, it will indeed break code generators.

@philsturgeon
Copy link
Contributor

I dunno if this is the most common use case? I’ve never seen this :)

Could you get a PR going?

@MikeRalphson
Copy link
Contributor

I dunno if this is the most common use case? I’ve never seen this :)

Exactly, as JSON Schema supports an array for type, the oneOf is pretty redundant.

@dskvr
Copy link
Author

dskvr commented Feb 18, 2019

You're absolutely right :)

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

3 participants