Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bun-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.13
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -37,6 +39,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -52,6 +56,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Build and pack
run: |
Expand Down Expand Up @@ -83,6 +89,8 @@ jobs:
- name: Setup Bun
if: matrix.package-manager == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Setup Node.js
if: matrix.package-manager != 'bun'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down Expand Up @@ -76,6 +78,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Setup .NET
uses: actions/setup-dotnet@v5
Expand Down Expand Up @@ -50,6 +52,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down Expand Up @@ -78,6 +82,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand Down Expand Up @@ -107,6 +113,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -122,6 +130,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- uses: actions/setup-python@v6
with:
Expand Down Expand Up @@ -156,6 +166,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- uses: actions/setup-python@v6
with:
Expand Down Expand Up @@ -190,6 +202,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -205,6 +219,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -224,6 +240,8 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version

- name: Setup Java
uses: actions/setup-java@v5
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ FHIR Package → TypeSchema Generator → TypeSchema Format → Code Generators
- Unit tests for core functionality (transformers, builders)
- Tests mirror source structure in `test/unit/`
- API tests for high-level generators
- SQL-on-FHIR is split into per-language files (`sql-on-fhir-typescript.test.ts`, `sql-on-fhir-python.test.ts`, `sql-on-fhir-csharp.test.ts`) and the `test` Makefile target runs each as a separate `bun test` invocation. The combined file ran out of memory on `ubuntu-latest` (~7 GiB) because all three generators built simultaneously against R5 + the SQL-on-FHIR IG. Each file gets its own bun process so peak memory is bounded to one generator's output at a time. Do not recombine.

### Example Test Structure

Expand Down Expand Up @@ -354,6 +355,7 @@ Detection uses `mkIsFamilyType(tsIndex)` which checks `schema.typeFamily.resourc
3. **Choice Types**: Supported but representation differs by language
4. **Circular References**: Handled but may affect tree shaking
5. **Large Packages**: May require increased Node.js memory (`--max-old-space-size`)
6. **Bun version pinned via `.bun-version`**: Bun 1.3.14 introduced a memory regression that OOM-kills `make test` on `ubuntu-latest`. Stick to the version pinned in `.bun-version` until a fixed Bun release is verified to pass CI.

## Performance Optimization Tips

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ typecheck:
$(TYPECHECK)

test: typecheck
bun test
bun test --path-ignore-patterns '**/sql-on-fhir-*.test.ts'
bun test test/api/write-generator/multi-package/sql-on-fhir-typescript.test.ts
bun test test/api/write-generator/multi-package/sql-on-fhir-python.test.ts
bun test test/api/write-generator/multi-package/sql-on-fhir-csharp.test.ts

prepare-aidbox-runme:
@if [ ! -f "example/docker-compose.yaml" ]; then \
Expand Down
2 changes: 2 additions & 0 deletions test/api/write-generator/csharp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ describe("C# Writer Generator", async () => {
expect(files["generated/types/Helper.cs"]).toMatchSnapshot();
});
});

Bun.gc(true);
2 changes: 2 additions & 0 deletions test/api/write-generator/introspection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,5 @@ describe("IntrospectionWriter - StructureDefinition output", async () => {
expect(files["generated/structure-definitions.ndjson"]).toMatchSnapshot();
});
});

Bun.gc(true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots

exports[`SQL-on-FHIR C# Generation should generate ViewDefinition type (promoted logical) 1`] = `
"// WARNING: This file is autogenerated by @atomic-ehr/codegen.
// GitHub: https://github.com/atomic-ehr/codegen
// Any manual changes made to this file may be overwritten.


namespace Fhir.Types.OrgSqlOnFhirIg;

public class ViewDefinition : CanonicalResource {
public ViewDefinitionConstant[]? Constant { get; set; }
public ViewDefinitionFhirVersionBindingEnum[]? FhirVersion { get; set; }
public string? Name { get; set; }
public string[]? Profile { get; set; }
public required string Resource { get; set; }
public required ViewDefinitionSelect[] Select { get; set; }
public ViewDefinitionWhere[]? Where { get; set; }

public class ViewDefinitionConstant : BackboneElement {
public required string Name { get; set; }
public string? ValueBase64binary { get; set; }
public bool? ValueBoolean { get; set; }
public string? ValueCanonical { get; set; }
public string? ValueCode { get; set; }
public string? ValueDate { get; set; }
public string? ValueDateTime { get; set; }
public decimal? ValueDecimal { get; set; }
public string? ValueId { get; set; }
public string? ValueInstant { get; set; }
public int? ValueInteger { get; set; }
public long? ValueInteger64 { get; set; }
public string? ValueOid { get; set; }
public long? ValuePositiveInt { get; set; }
public string? ValueString { get; set; }
public string? ValueTime { get; set; }
public long? ValueUnsignedInt { get; set; }
public string? ValueUri { get; set; }
public string? ValueUrl { get; set; }
public string? ValueUuid { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

public class ViewDefinitionSelect : BackboneElement {
public ViewDefinitionSelectColumn[]? Column { get; set; }
public string? ForEach { get; set; }
public string? ForEachOrNull { get; set; }
public string[]? Repeat { get; set; }
public ViewDefinitionSelect[]? Select { get; set; }
public ViewDefinitionSelect[]? UnionAll { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

public class ViewDefinitionSelectColumn : BackboneElement {
public bool? Collection { get; set; }
public string? Description { get; set; }
public required string Name { get; set; }
public required string Path { get; set; }
public ViewDefinitionSelectColumnTag[]? Tag { get; set; }
public string? Type { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

public class ViewDefinitionSelectColumnTag : BackboneElement {
public required string Name { get; set; }
public required string Value { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

public class ViewDefinitionWhere : BackboneElement {
public string? Description { get; set; }
public required string Path { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}


public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

"
`;

exports[`SQL-on-FHIR C# Generation should generate DomainResource for R5 1`] = `
"// WARNING: This file is autogenerated by @atomic-ehr/codegen.
// GitHub: https://github.com/atomic-ehr/codegen
// Any manual changes made to this file may be overwritten.


namespace Fhir.Types.Hl7FhirR5Core;

public class DomainResource : Resource {
public Resource[]? Contained { get; set; }
public Extension[]? Extension { get; set; }
public Extension[]? ModifierExtension { get; set; }
public Narrative? Text { get; set; }

public override string ToString() =>
JsonSerializer.Serialize(this, Helper.JsonSerializerOptions);

}

"
`;
Loading
Loading