microsoft / microsoft/typespec
Allow different model property definitions per visibility
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
#2926 is a special case of a more general scenario - the ability to have fine-grained control over how a property appears in different visibilities. This might include optionality (e.g. optional on input, but normalized to a default value by service and always sent in output), or decorator metadata (e.g. a string with a free-form input format and more constrained output format).
If you could somehow declare different properties per visibility, you would have a lot of flexibility. You might consider something like declaring separate properties and using `@encodedName` to make them all the same name on the wire, except for two issues: `@encodedName` checks for conflicting declared member names and does not consider visibility, and also in this scenario the user doesn't care about the protocol but is modelling at the conceptual layer.
Contributor guide
Assessment
This issue has not been assessed yet.