microsoft / microsoft/typespec
Library options
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Currently we have a way for emitter to define options but no way for a library to do so.
We kept the design of option configuration open for this purpose but didn't have a real use case.
Dpg teams want to be able to define some shared DPG options.
```yaml
emit:
- @azure-tools/cadl-python
options:
@azure-tools/cadl-dpg
common-option: "abc"
@azure-tools/cadl-python:
python-specfic: "def"
@azure-tools/cadl-csharp:
csharp-specfic: "xyz"
```
And then the dpg library can expose those common options via an helper.
Would need to expand the `createLibrary` definition to include non emitter options and a way to retrieve the typed options for your library.
Alternative we could have:
- Don't allow any shared option and require the duplication all the time
- Have a `sharedOptions` field in the config that contains a free form option set(means no validation for typo or missing emitter/library)
Contributor guide
Assessment
This issue has not been assessed yet.