TypeSchema: Split dependency types for specializations and profiles#118
Merged
TypeSchema: Split dependency types for specializations and profiles#118
Conversation
…ier[] for profiles - SpecializationTypeSchema.dependencies is now Identifier[] (no nested) - ProfileTypeSchema.dependencies remains TypeIdentifier[] (includes nested) - Extract collectRawDeps helper; extractDependencies filters nested, extractProfileDependencies keeps them - Split transformFhirSchema into profile/specialization branches - Split treeShakeTypeSchema dependency recalculation by schema kind - Add nestedIndex fallback in resolveByUrl for constrainedChoice - Remove dead isNestedIdentifier/kind=nested branches in TS writer - Add casts in Python, C#, tree-shake for NestedTypeSchema boundaries
4be9052 to
a0a5650
Compare
- Replace schema.identifier.kind checks with isResourceTypeSchema, isSpecializationTypeSchema, isLogicalTypeSchema predicates - Make groupByPackages generic to preserve input type - Widen mutableSelectFields/mutableIgnoreFields to accept ProfileTypeSchema - Remove all as unknown as SpecializationTypeSchema/TypeSchema casts (NestedTypeSchema is structurally assignable to SpecializationTypeSchema)
…xtractProfileDependencies
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.
Dependency type split
SpecializationTypeSchema.dependenciesnarrowed fromTypeIdentifier[]toIdentifier[]— nested identifiers are filtered outProfileTypeSchema.dependenciesstaysTypeIdentifier[]— keeps nested identifiersextractDependenciesinto two functions:extractDependencies— filters out nested, returnsIdentifier[](for specializations)extractProfileDependencies— keeps nested, returnsTypeIdentifier[](for profiles)collectRawDepshelper extracts the common logictransformFhirSchemainto profile/specialization branches with correct dep extractiontreeShakeTypeSchemadependency recalculation by schema kindSpecialization dependencies no longer include nested identifiers:
Type safety improvements
schema.identifier.kindchecks with type predicates (isResourceTypeSchema,isSpecializationTypeSchema,isLogicalTypeSchema)as unknown as SpecializationTypeSchemacasts in writers —NestedTypeSchemais structurally assignableas unknown as TypeSchemacasts for nested schemasas ProfileIdentifiercast withassert(isProfileIdentifier(...))isNestedIdentifier/kind === "nested"branches in TS writergroupByPackagesgeneric to preserve input types, removingas Record<...>castsmutableSelectFields/mutableIgnoreFieldsto acceptSpecializationTypeSchema | ProfileTypeSchemaconcatIdentifiersgeneric (<T extends TypeIdentifier = TypeIdentifier>)extractDependenciesparam toIdentifier,extractProfileDependenciestoProfileIdentifierbasetoIdentifier | undefinedintransformFhirSchemawith assertcollectRawDeps,extractDependencies,extractProfileDependenciesBug fix: constrained choice on nested types
nestedIndexfallback inresolveByUrlsoconstrainedChoiceresolves nested typescomponentslices now correctly detectvalue[x]→valueQuantityconstraint: