You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Go and Rust deal with the namespace in the emitter, they are asking how to determine a root namespace that could let language know where a package should start from. Current TCGC's namespace concept is just to represent TypeSpec namespace or user specific namespace. We do not have root namespace concept. So, we want to know if all languages have such requirement and does TCGC need a rootNamespace config for emitter, and provide getRootNamespaces with calculating longest common prefix for all root clients' namespaces?
When no namespace in tspconfig, Java would generate client and model to their namespace specified by TCGC (we may do some hack for models from TypeSpec or Azure namespace -- here is the only place a rootNamespace may matter -- we need to put them somewhere, if not to typespec.rest package). This part would be fine without a rootNamespace.
The remaining problem I see, is the artifactId in the generated pom.xml.
E.g. for source
@service(#{ title: "Pet Store" })
namespace PetStore {
model Dog { ... }
}
@service(#{ title: "Toy Store" })
namespace ToyStore {
model Car { ... }
}
The 2 client would be generated under petstore and toystore package. No surprise.
But we are not able to decide whether the artifactId (you can think it as package name) should be petstore or toystore.
In addition, if the project uses TypeSpec.Rest.ResourceCreateModel<>, we either generate it under typespec.rest package, or use the guessed root namespace.
Hence for Java, there is not as much a problem of rootNamespace, but packageName. E.g. if we had a package-name tspconfig, the problem thus be solved without knowing a rootNamespace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib:tcgcIssues for @azure-tools/typespec-client-generator-core library
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Go and Rust deal with the
namespacein the emitter, they are asking how to determine a root namespace that could let language know where a package should start from. Current TCGC's namespace concept is just to represent TypeSpec namespace or user specific namespace. We do not have root namespace concept. So, we want to know if all languages have such requirement and does TCGC need arootNamespaceconfig for emitter, and providegetRootNamespaceswith calculating longest common prefix for all root clients' namespaces?