Skip to content

typescript client does not respect optional parameters by default #18191

@AmazingTurtle

Description

@AmazingTurtle

According to the OpenAPI Spec, request parameters should be treated optional by default.

The client-generator for typescript treats them as mandatory by default, thus converting unspecified parameters to string undefined which may break the API:

requestContext.setHeaderParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}"));

My suggestion is:

  1. check if the parameter is required and if not:
  2. check if the value is undefined or not before calling setHeaderParam.

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