TypeSchema: better error + skip R5 types in R4-target extensions#153
Open
TypeSchema: better error + skip R5 types in R4-target extensions#153
Conversation
- Multi-line error with package, schema, field, type rows - R5_ONLY_TYPES set + dependsOnR4Core helper to gate the hint - Hint suggests skip-hack.ts entry or upgrading to R5
Add biologicallyderivedproduct-manipulation and -processing from hl7.fhir.uv.extensions.r4 to the skip list. Both reference CodeableReference, which is R5-only and unavailable when generating against R4.
Replace the explicit hl7.fhir.r4.core dep (now pulled transitively) with de.basisprofil.r4@1.6.0-ballot2 and kbv.basis@1.8.0 to exercise the cross-package version graph from PR #151.
c231a5e to
7d70bb9
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.
Context
Generating against
kbv.ita.for@1.3.1together withde.basisprofil.r4@1.6.0-ballot2pulls in the transitive dephl7.fhir.uv.extensions.r4@5.2.0. That package ships R4-targeted extensions whosevalue[x]choices are typed as R5-only datatypes (CodeableReference,Availability). On R4 generation those types do not resolve — codegen aborts with an unhelpful single-line error.Changes
TypeSchema: improve field type resolution errorReplace the single-line throw in
field-builder.tswith a structured multi-line message and an R4-context-gated hint.Before
After
The hint only fires when:
element.typeis inR5_ONLY_TYPES(Availability,CodeableReference,ExtendedContactDetail,MonetaryComponent,RatioRange,VirtualServiceDetail), ANDhl7.fhir.r4.core(otherwise the hint would mislead R5 generation).TypeSchema: skip biologicallyderivedproduct R5-typed extensionsTwo more entries in
src/typeschema/skip-hack.tsforhl7.fhir.uv.extensions.r4:biologicallyderivedproduct-manipulationbiologicallyderivedproduct-processingBoth reference
CodeableReference. Joins the existing six entries (extended-contact-availability,immunization-procedure,specimen-additive,workflow-barrier,workflow-protectiveFactor,workflow-reason).TypeSchema: extend kbv-r4 example with de.basisprofil + kbv.basisUpdate
examples/on-the-fly/kbv-r4/generate.tsto pin the cross-package version graph that surfaced the issue:hl7.fhir.r4.coreis now pulled transitively. The example now exercises the R4/R5-extensions interaction so future regressions are caught.Notes