Merged
Conversation
0f18651 to
fb45f80
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@manzt pointed out some broken generation in the python client in #78. After investigating this for a bit, it looks like it's due to mix enum styles in the rust code.
Here's a basic example
My typescript generation code outputs the following for this case
Typescript has the advantage of allowing for anonymous objects in unions. What should the second object be in python? Currently my code is spitting out a class called
undefinedbecause I don't have a name for it.As with #108, often the solution is to simplify the rust data structures to simplify the generation. The final structure I ended up with for the above example is
All of the mixed enums had to do with size, so unifying the enums actually reduced some duplication anyway.
This PR also introduces ast-grep to the codebase. I've been using ast-grep significantly more at val.town and it's quickly becoming one of my go-to tools for code quality. I added a
no-mixed-enumsrule which ensure this pattern doesn't get reintroduced in the future.