-
Notifications
You must be signed in to change notification settings - Fork 161
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
Emitter framework feedback #2729
Comments
In using the emitter framework (and separately but also very importantly, the emitter framework documentation) I found the following issues: 1. Understanding What You Need to Implement [Framework] There’s this line (emphasis mine):
If this is the case, why is it that all of these have default do-nothing implementations? This makes it hard to understand what you even can implement, much less what you should. Sometimes, the default implementation does some functional magic (like iterating through a collection) but other times it does nothing, which from a user perspective is frustrating. Other inconsistencies like having an I’m not sure users care about the distinction between 2. Improved Examples [Docs] https://microsoft.github.io/typespec/extending-typespec/emitter-framework#builders 3. Unnecessary Focus on Implementation Details [Docs] Largely, the documentation reads like a deep-dive into the inner workings of the TypeSpec emitter framework but is of limited value for an emitter author who simply wants to create an emitter using the framework. https://microsoft.github.io/typespec/extending-typespec/emitter-framework#implementing-your-emitter Why do we walk through these types? We mention 4. Emitter Output: Declarations [Framework] It doesn’t make sense to me why |
Two more additions: 5. Provide a way to know if a given type has been declared [Framework] We have a specific result call for 6. Emitter Framework Coverage is Incomplete [Framework] There are no methods to support emitting template declarations of any kind. Conceptually, I should be able to rewrite I think we should let emitter authors decide whether they want to emit template declarations rather than take that choice from them by not even exposing a method. |
Related to @tjprescott |
And one more: 7. Allow I have to create a source file when creating a context, but it's entirely possible that the source file ends up being empty. In that case, when |
8. AssetEmitter.writeOutput should automatically exit if the compiler is set to noEmit I spent a solid two hours trying to figure out why I kept getting bizarre errors when opening a |
Some more: 9. Need a way to track declarations that need to be emitted later In my repo, I created a For example:
In my emitter, nothing is every called for 10. Prefer getTypeEmitter over getAssetEmitter My emitters make extensive use of subclassing Given a It is reasonable to assume people will want to subclass My recommendation would be to change |
10.
|
Forgot to file this before but those are pain points I noted when migrating openapi3 to the emitter framework
There was some others that have either already been addressed in PRs or have dedicated issue(duplicate name tracker)
Brainstormed idea
The text was updated successfully, but these errors were encountered: