Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

C# byte type incorrectly translated to OpenAPI type:string/format:byte #235

Open
@nickmcummins

Description

@nickmcummins

In the Data Types - Format section of the OpenAPI/Swagger spec, it defines the byte as a format of the string type:

  • byte – base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==

However in C# a byte is an 8-bit unsigned integer (i.e. numeric value of 0 to 255). With the current implementation, calling an API using the generated API client (from the OpenAPI spec generated by this tool) will result in an error when parsing the JSON payload of an object which has a byte field, as the payload has this property as a numeric rather than string:

"byteProperty": 0,

Lines 23 and 38 of TypeExtensions.cs should likely be changed such that the generated OpenAPI schema result in byte properties as:

byteProperty:
  type: integer
  minimum: 0
  maximum: 255

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