microsoft / microsoft/typespec

how to specify serialization format for model type path/query parameters ?

Open
#2,476 0 comments 1 reaction 0 assignees View on GitHub
design:needed triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

In OpenAPI3, it has specify that both path/query parameters/headers can be primitive types, arrays and objects. https://swagger.io/docs/specification/describing-parameters

But I am not sure how to serialize the object path/query parameter as the collectionFormat is not enough for us.

For example, objects can be serialized as:
```
form – /points?color=R,100,G,200,B,150 or /points?R=100&G=200&B=150, depending on the explode keyword,
deepObject – /points?color[R]=100&color[G]=200&color[B]=150
```

Also, there's label and matrix style of path parameter for object and more serialization details can be found [here](https://swagger.io/docs/specification/serialization/), not sure how to specify those.

See original customer issue from https://github.com/Azure/autorest.typescript/issues/2033

Items to take into account:
- Ability to add a prefix to the param name if serialized as individual entires(explode) https://github.com/Azure/typespec-azure/issues/21
- Ability to serialize as a media type(json, xml, etc.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.