-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple entry points for single TypeSpec project #4973
Comments
is this more a question for the azure spec repo organization? You can have as many entrypoint as you'd want for TypeSpec. |
I am happy to re-direct the question if this is not the right place. I just wanted to figure out how with the current tooling (if possible) we could have many In the link I provided in the description, we use a monolithic TSP definition, from which we would want to derive separate libraries. Would it be simply a matter of changing the The difficulty I have found is that there needs to be a |
I think so, though I do not know much about the tsp-client configuration and what is possible there(@catalinaperalta do you know). In the azure spec repo some services are organized like that if that helps knowing what is possible
|
It seems to me like you need separate tspconfig.yaml files for each sub project you want to generate. So with tsp-client you could call the command with the specific tspconfig.yaml for the service section and likewise that should create an appropriate tsp-location.yaml for you. So using Tim's example above, I think you could have something like:
So if you want to generate service1 you'll use the tspconfig.yaml under it and your tsp-location directory should be: |
Clear and concise description of the problem
What is this about
We are currently trying to normalize all language client libraries for Azure OpenAI services to use the same TypeSpec definition found in this repository. This TypeSpec project defines 2 layers, one for pure OpenAI (under the
./.typespec
folder) and the Azure elements extending the OpenAI service definitions (under./.typespec.azure
).Currently, there are several libraries that are defined in the base OpenAI TypeSpec definition. Since this definition is an upstream dependency, we can't really split the definition itself. What would be very useful to us, is to be able to define multiple entry points for all our libraries generated from this monolithic TypeSpec spec (this spec is generated and parts are handcrafted from the OpenAI and the Azure OpenAI rest API swagger docs).
Proposal
For us, it would be ideal to be able to define multiple
main.tsp
andclien.tsp
files with their respectivetsp-config.yaml
files in subfolders of the repository. For example, being able to define these files under.typespec/realtime
would allow us to ship a separate client library from that spec of what, from the service side, is a beta feature.Our idea for consuming the new entry point for the spec in a separate hypothetical library, would be to have an additional key in the
tsp-location.yaml
file from the new client library repository folder, specifying whichmain.tsp
orclient.tsp
file the code generation tree should start branching from. Currently, usingtsp-client sync && tsp-client generate
will run code generation from either themain.tsp
orclient.tsp
file located at the root of thedirectory
specified in thetsp-location.yaml
file.Alternatives
We could try leveraging namespaces to define the client library boundaries. This is not without the risk of running into the situation in the future that there are shared elements across different libraries defined in the same spec.
cc: @srnagar , @trrwilson
Checklist
The text was updated successfully, but these errors were encountered: