Skip to content

23 typescript profile as an adapter#25

Closed
octoshikari wants to merge 5 commits intomainfrom
23-typescript-profile-as-an-adapter
Closed

23 typescript profile as an adapter#25
octoshikari wants to merge 5 commits intomainfrom
23-typescript-profile-as-an-adapter

Conversation

@octoshikari
Copy link
Copy Markdown
Collaborator

No description provided.

@octoshikari octoshikari linked an issue Nov 17, 2025 that may be closed by this pull request
@octoshikari octoshikari force-pushed the 23-typescript-profile-as-an-adapter branch from 54d2ef4 to 7e5484e Compare November 17, 2025 10:16
@octoshikari octoshikari force-pushed the 23-typescript-profile-as-an-adapter branch from f8d4b12 to 36315eb Compare November 19, 2025 19:26
Copy link
Copy Markdown
Collaborator

@ryukzak ryukzak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is possible on the current stage, it will be nice to split this PR into three:

  1. Logger tests.
  2. Refactoring of TS generator.
  3. Profile generation implementation.


if (needsExtensionForExtensions) {
const isSamePackage = "hl7.fhir.r4.core" === schemaPackage;
const extensionPath = isSamePackage ? "../Extension" : "../../hl7-fhir-r4-core/Extension";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like importing always via ../../<package> will be more regular. Here and in other place

if (["complex-type", "resource", "logical"].includes(dep.kind)) {
let tsPackage: string;
if (isSamePackage) {
tsPackage = isProfile ? `../${pascalCase(dep.name)}` : `./${pascalCase(dep.name)}`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to wrap it in a more domain-specific function, like tsPackageName.

const needsExtensionForExtensions = isProfile && schema.extensions && schema.extensions.length > 0;

if (needsExtensionForExtensions) {
const isSamePackage = "hl7.fhir.r4.core" === schemaPackage;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package names shouldn't be hardcoded here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript: Profile as an Adapter

2 participants