Skip to content

Use discriminated Unions for method specific parameters. #430

@janpaepke

Description

@janpaepke

There are several method specific parameters when creating unions.

It would enhance DX if those are only available when the respective method is chosen (defined using the method param).
This is a perfect usecase for discriminated unions.

The advantages are clear: Instead of being optional params, the specific params would become required for the respective method.
There would also be a little less clutter in the list of common params.

There are two things to clear up before:

  1. The method param can also be an array of methods.
    How would this work here? Can I provide params for multiple methods?
    Or are these methods not intended to be used in conjunction with others?

  2. The docs page is currently unclear about which params are optional and which required when using the respective method. This will need to be clarified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovements and changes outside of API endpoints.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions