Skip to content

String field cannot be optional. #122

@yuto-katsuragi

Description

@yuto-katsuragi

Description

Primitive Types can be optional.
but string field can not be optional.

Repro steps

  1. Step A
    provide following this in swagger yaml
      number_value:
        type: number
        nullable: true
      string_value:
        type: string
        nullable: true
  1. Step B

read property by SwaggerProvider

type Provider = SwaggerProvider<schema, PreferAsync = true>
let client = Provider.Client()
let result = client.Operation() |> Asnyc.RunSynchronously

let numberValue = result.NumberValue // ==> the type is option float
let stringValue = result.StringValue // ==> the type is string

Expected behavior

nullable string field should be Option type.

Actual behavior

nullable string field is not Option type.

Known workarounds

  • null checking

Related information

  • Operating system
    Windows 10
  • NuGet Version
    0.10.0-beta05
  • .NET Framework 4.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions