Skip to content

Support for Record with union value types #8228

@annatisch

Description

@annatisch

Clear and concise description of the problem

I have an API the supports sending and receiving simple JSON payloads - the values of which will always be a union of string, int, float and boolean.
It's not currently possible to define this in tsp, and I must default to using Record<unknown>, which is itself an error that must be suppressed.
I think an arbitrary JSON payload would be a relatively common scenario, so allowing a union of basic types here seems reasonable. Otherwise, if supporting a union type here isn't an option, then Record<unknown> should be a valid payload declaration that does not require suppression.

The API in question here is the Azure Tables API - this question applies to all entity operations:
https://learn.microsoft.com/en-us/rest/api/storageservices/operations-on-entities
Existing swagger spec:
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/data-plane/Microsoft.Tables/preview/2019-02-02/table.json

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

Labels

needs-areaneeds-infoMark an issue that needs reply from the author or it will be closed automatically

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions