Repository navigation
fix(enums)!: keep namespace in enum type names - #141
Merged
Merged
Conversation
Enum type names were built from the demodulized model name, so Course::Build and Project::Build both produced BuildState and one enum silently replaced the other. Use the full class name instead (CourseBuildState) and warn when two enums with different values still share a name. BREAKING CHANGE: enum types of namespaced models are renamed. Closes #138
Deploying typelizer with
|
| Latest commit: |
ca26a81
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f417d4d8.typelizer.pages.dev |
| Branch Preview URL: | https://fix-namespaced-enum-names.typelizer.pages.dev |
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.
Closes #138.
Problem
Enum type names were built from the model name without its namespace.
Course::BuildandProject::Buildwith astateenum both producedBuildState, and only one of them was written toEnums.ts. Nothing warned about it.Change
Course::Build+stategivesCourseBuildState. This matches how serializer type names already keep the namespace.Course::BuildandCourseBuild). The first one is generated, as before.Breaking
Enum types of namespaced models are renamed, so imports of those types need updating. Models without a namespace are not affected. Planned for 0.15.0.
Tests
New
spec/typelizer/namespaced_enum_spec.rbwith two examples: same-named models in different namespaces get separate enum names, and the warning fires on a remaining clash. Both fail without the fix.