Skip to content
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,31 @@ jobs:
git diff examples/python/generated
exit 1
fi

test-mustache-java-r4-example:
runs-on: ubuntu-latest

strategy:
matrix:
bun-version: [latest]
java-version: [21, 25]

steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun-version }}

- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: "temurin"

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run tests
run: make test-mustache-java-r4-example
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ examples/csharp/obj
examples/typescript-ccda/fhir-types
examples/typescript-ccda/tree.yaml
examples/typescript-ccda/type-schemas

examples/typescript-sql-on-fhir/fhir-types
examples/typescript-sql-on-fhir/tree.yaml

examples/mustache/mustache-java-r4-output
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ test-typescript-ccda-example: typecheck format lint
bun run examples/typescript-ccda/generate.ts
$(TYPECHECK) --project examples/typescript-ccda/tsconfig.json

test-mustache-java-r4-example: typecheck format lint
bun run examples/mustache/mustache-java-r4-gen.ts
$(TYPECHECK) --project examples/mustache/tsconfig.examples-mustache.json

test-csharp-sdk: typecheck format prepare-aidbox-runme lint
$(TYPECHECK) --project examples/csharp/tsconfig.json
bun run examples/csharp/generate.ts
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Field-Level Tree Shaking](#field-level-tree-shaking)
- [Generation](#generation)
- [1. Writer-Based Generation (Programmatic)](#1-writer-based-generation-programmatic)
- [2. Mustache Template-Based Generation (Declarative)](#2-mustache-template-based-generation-declarative)
- [Roadmap](#roadmap)
- [Support](#support)
- [Footnotes](#footnotes)
Expand All @@ -33,6 +34,7 @@ A powerful, extensible code generation toolkit for FHIR ([Fast Healthcare Intero
Guides:

- **[Writer Generator Guide](docs/guides/writer-generator.md)** - Build custom code generators with the Writer base class
- **[Mustache Generator Guide](docs/guides/mustache-generator.md)** - Template-based code generation for any language
- **[TypeSchemaIndex Guide](docs/guides/typeschema-index.md)** - Type Schema structure and utilities
- **[Testing Generators Guide](docs/guides/testing-generators.md)** - Unit tests, snapshot testing, and best practices
- **[Contributing Guide](CONTRIBUTING.md)** - Development setup and workflow
Expand Down Expand Up @@ -98,6 +100,7 @@ See the [examples/](examples/) directory for working demonstrations:
- **[typescript-sql-on-fhir/](examples/typescript-sql-on-fhir/)** - SQL on FHIR ViewDefinition with tree shaking
- **[python/](examples/python/)** - Python/Pydantic model generation with configurable field formats
- **[csharp/](examples/csharp/)** - C# class generation with namespace configuration
- **[mustache/](examples/mustache/)** - Java generation with Mustache templates and post-generation hooks
- **[local-package-folder/](examples/local-package-folder/)** - Loading unpublished local FHIR packages

For detailed documentation, see [examples/README.md](examples/README.md).
Expand Down Expand Up @@ -247,6 +250,20 @@ Each language writer maintains full control over output formatting while leverag

**When to use**: Full control needed, complex generation logic, performance-critical, language has a dedicated writer, production-grade output

#### 2. Mustache Template-Based Generation (Declarative)

For custom languages or formats, use Mustache templates to define code generation rules without programming:

- **Template Files**: Declarative Mustache templates that describe output structure
- **Configuration**: JSON config file controlling type filtering, naming, and post-generation hooks
- **ViewModels**: Type Schema automatically transformed into template-friendly data structures

Templates enable flexible code generation for any language or format (Go, Rust, GraphQL, documentation, configs) by describing the output format rather than implementing generation logic.

**When to use**: Custom language support, quick prototyping, template-driven customization, non-code output

---

## Roadmap

- [x] TypeScript generation
Expand Down
6 changes: 6 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading