Skip to content

Case that is UNclear in the spec: Discriminator with array #3439

@Gallimathias

Description

@Gallimathias

I have the following case:

My Api call returns a Variant that contains a bool as discriminator. The two values are either an error object or an array of a value.

Example: (no valid code)

success: boolean
value:
  oneOf:
    {errorCode: number, message: string}
    arrayOf {description: string, data: {...} ...}

Descriminator:

discriminator:
  propertyName: success
  mapping:
   false: '#/components/shema/Error'
   true: ????? 

The problem is that in the discriminator mapping only the schema of the items contained in the array can be referenced because no seperate schema is made for arrays.

For the autogeneration, however, which pays attention to the discriminator, it is now necessary to recognise both fields separately or, from my point of view, responses and discriminator then contradict each other

Did i miss something and there is already a solution for that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions