Skip to content

nullable on double conversions #581

Description

@baywet

Right now we're converting OData Edm.Double to

oneOf:
  - type: number
    format: double
  - type: string
  - $ref: '#/components/schemas/ReferenceNumeric'
nullable: true

Reference numeric being

ReferenceNumeric:
  enum:
    - '-INF'
    - INF
    - NaN

While this is not technically invalid, it doesn't mean anything as per

A true value adds "null" to the allowed type specified by the type keyword, only if type is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of null as a value. A false value leaves the specified or default type unmodified. The default value is false.

source

I believe we should instead emit

oneOf:
  - type: number
    format: double
    nullable: true
  - type: string
     nullable: true
  - $ref: '#/components/schemas/ReferenceNumeric'

Reference numeric being

ReferenceNumeric:
  type: string
  nullable: true
  enum:
    - '-INF'
    - INF
    - NaN

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions