fix: replace struct with typed enum for proper validation dispatch#8
Open
PritamP20 wants to merge 1 commit intoaccordproject:mainfrom
Open
fix: replace struct with typed enum for proper validation dispatch#8PritamP20 wants to merge 1 commit intoaccordproject:mainfrom
PritamP20 wants to merge 1 commit intoaccordproject:mainfrom
Conversation
Signed-off-by: Pritam <pritamp20@Pritams-MacBook-Air.local> Signed-off-by: Pritam P <pripritam7@gmail.com>
Author
|
@mttrbrts can you please review this once |
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.
Declarationwas a thin base struct with only_class,name,decorators, andlocation. Every time a typed declaration (ConceptDeclaration, AssetDeclaration, etc.) was added to a model, all its fields properties, superType, isAbstract got stripped away. Three methods in the codebase were working around this with hardcoded hacks.Declarationis now a proper enum with 13 variants, dispatching on$classfor deserialization and delegating to the inner struct for serialization.Changes
Declarationstruct with a typed enum (Concept, Asset, Participant, Transaction, Event, Enum, Map, and 6 scalar variants)validate_no_circular_inheritancewas hardcoded to only detect cycles between "Person" and "Employee", now works for any class namesas_concept_declarationandas_map_declarationwere always returningNonefind_properties_for_declarationhack fromModelFileModelFile::validatefrom ~30 lines of workarounds to a single lineCloneto 15 structs required by the enum variants#[ignore]d tests that now pass correctlyFlags
Declarationtype callers must now useDeclaration::Concept(d)instead of the base struct literalTested
25 tests pass, 0 failing
Author Checklist
--signoffoption of git commit.mainfromfork:fix/declaration-typed-enum