Conversation
Collaborator
ryukzak
commented
Feb 26, 2026
- Add static factory methods (from, createResource, create) and getter/setter methods to generated profile classes, enabling fluent construction and manipulation of profiled FHIR resources
- Add support for generating extension profile classes (e.g., birthPlace, nationality) with proper value type resolution via slicing fallback
- Capture pattern/fixed values from FHIR StructureDefinitions into TypeSchema fields, enabling auto-population in factory methods
- Fix cross-version type resolution fallback in TypeSchemaIndex.resolveByUrl and improve extension deduplication to prefer canonical URLs
- Use identifier.name instead of URL-extracted names for profile class and module naming
Add PatternValue type that preserves the kind (pattern vs fixed) alongside the type and value from FHIR element definitions.
…classes Profile classes now generate three static methods: - from(resource) — wraps an existing resource in the profile class - createResource(args) — creates a plain resource with auto-set fields (resourceType for resources, url from patternValue for extensions) and required fields as a typed params object - create(args) — shorthand that returns the resource wrapped in the profile Required fields are collected into a separate exported Params type. Extension profiles auto-set their url and accept required values as params. Resource profiles auto-set resourceType and accept required fields. Also adds R4 extension profile examples and tests covering all four extension profiles (patient-birthPlace, patient-birthTime, patient-nationality, humanname-own-prefix).
…traction Profile classes now generate getter/setter methods for required fields (e.g., getValueAddress/setValueAddress for extension profiles, getStatus/setStatus for resource profiles). Setters return `this` for chaining. Fix transformer to extract sub-extension URLs and value types from slicing data when the extensions object entries lack a url field. This enables complex extension profiles like patient-nationality to generate proper getter/setter methods for their sub-extensions (code, period).
Derive profile class names and file names from schema.identifier.name instead of extractNameFromCanonical(url). This produces cleaner names for extensions by dropping redundant prefixes (e.g., birthPlaceProfile instead of patient_birthPlaceProfile).
- Replace non-null assertion with null guard for choice field access - Extract generateExtensionSetterMethods to reduce cognitive complexity - Use resolveFieldTsType for factory params to include enum/reference types - Add casts in getter/setter for narrowed profile types - Use 'as unknown as' in createResource for cross-version compatibility - Wrap pattern values in arrays for array fields - Cast extension value fields for cross-version type compatibility
- Add fallback in resolveByUrl to search across all packages when type is not found in the specified package (fixes CodeableReference imports) - Change extension dedup key from path|name|url to path|name, preferring entries with full canonical URLs to prevent duplicate method generation
- Fix profile.test.ts import to use new naming (Observation_observation_bodyweight) - Regenerate profile files with corrected types and casts
Move profile extension extraction functions from transformer.ts to profile-extensions.ts for better separation of concerns.
Add rollup override to force >=4.59.0 for all transitive dependencies, resolving the arbitrary file write via path traversal vulnerability.
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.