|
16 | 16 | - [Quick Start](#quick-start) |
17 | 17 | - [Usage Examples](#usage-examples) |
18 | 18 | - [Architecture](#architecture) |
| 19 | + - [Generator Options](#generator-options) |
19 | 20 | - [Input - FHIR packages & resolves canonicals](#input---fhir-packages--resolves-canonicals) |
20 | 21 | - [Load Local StructureDefinitions & TGZ Archives](#load-local-structuredefinitions--tgz-archives) |
21 | 22 | - [Intermediate - Type Schema](#intermediate---type-schema) |
@@ -188,6 +189,44 @@ const builder = new APIBuilder() |
188 | 189 |
|
189 | 190 | Each method returns the builder instance, allowing method chaining. The `generate()` method executes the pipeline and returns a report with success status and generated file details. |
190 | 191 |
|
| 192 | +### Generator Options |
| 193 | + |
| 194 | +Each language generator accepts its own option object. All options are optional; the tables below list the defaults. |
| 195 | + |
| 196 | +**TypeScript** — `.typescript({ ... })` |
| 197 | + |
| 198 | +| Option | Type | Default | Description | |
| 199 | +|--------|------|---------|-------------| |
| 200 | +| `generateProfile` | `boolean` | `true` | Generate profile wrapper classes (factories, typed slice/extension accessors, `validate()`). | |
| 201 | +| `primitiveTypeExtension` | `boolean` | `true` | Emit sibling `_field` properties for [primitive element extensions](https://www.hl7.org/fhir/element.html#json). | |
| 202 | +| `openResourceTypeSet` | `boolean` | `false` | For resource families (`Resource`, `DomainResource`), keep the `resourceType` union open by adding a `string` fallback instead of a closed literal union. | |
| 203 | +| `extensionGetterDefault` | `"flat" \| "profile" \| "raw"` | `"flat"` | Default return shape for generated extension getters. | |
| 204 | +| `sliceGetterDefault` | `"flat" \| "raw"` | `"flat"` | Default return shape for generated slice getters (`flat` strips discriminators, `raw` returns the full FHIR element). | |
| 205 | +| `lineWidth` | `number` | `120` | Maximum line width before wrapping. | |
| 206 | +| `withDebugComment` | `boolean` | `false` | Emit comments tracing each generated type back to its source schema. | |
| 207 | + |
| 208 | +**Python** — `.python({ ... })` |
| 209 | + |
| 210 | +| Option | Type | Default | Description | |
| 211 | +|--------|------|---------|-------------| |
| 212 | +| `client` | `"fhirpy" \| "none"` | `"fhirpy"` | Client integration baked into the models: `"fhirpy"` makes models extend `FhirpyBaseModel` for the fhirpy async client; `"none"` emits plain Pydantic models. | |
| 213 | +| `fieldFormat` | `"camelCase" \| "snake_case" \| "PascalCase"` | `"camelCase"` | Naming convention for generated model fields. | |
| 214 | +| `generateProfile` | `boolean` | `false` | Generate profile wrapper classes (`create()`, typed accessors, `validate()`) around the Pydantic models. | |
| 215 | +| `primitiveTypeExtension` | `boolean` | `false` | Emit primitive element extension fields. | |
| 216 | +| `allowExtraFields` | `boolean` | `false` | Allow fields not present in the schema on generated models (Pydantic `extra`). | |
| 217 | +| `rootPackageName` | `string` | `"fhir_types"` | Root Python package name for the generated module tree. | |
| 218 | +| `withDebugComment` | `boolean` | `false` | Emit comments tracing each generated type back to its source schema. | |
| 219 | + |
| 220 | +> `fhirpyClient?: boolean` is **deprecated** — use `client` instead (`true` → `"fhirpy"`, `false` → `"none"`). |
| 221 | + |
| 222 | +**C#** — `.csharp({ ... })` |
| 223 | + |
| 224 | +| Option | Type | Default | Description | |
| 225 | +|--------|------|---------|-------------| |
| 226 | +| `rootNamespace` | `string` | `"Fhir.Types"` | Root namespace for generated classes. | |
| 227 | +| `staticSourceDir` | `string` | — | Directory of static `.cs` source files copied verbatim into the output. | |
| 228 | +| `withDebugComment` | `boolean` | `false` | Emit comments tracing each generated type back to its source schema. | |
| 229 | + |
191 | 230 | ### Input - FHIR packages & resolves canonicals |
192 | 231 |
|
193 | 232 | The input stage leverages [Canonical Manager](https://github.com/atomic-ehr/canonical-manager) to handle FHIR package management and dependency resolution. It processes FHIR packages from multiple sources (registry, local files, TGZ archives) and resolves all canonical URLs to their concrete definitions, ensuring all references between resources are properly linked before transformation. |
|
0 commit comments