-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fhir-ts-codegen): rewrite to target io-ts
Rewrite the codegen to target io-ts runtime types rather than TypeScript interfaces. Refactored to use lighter-weight CLI library. Generating code through string interpolation rather than the TypeScript AST.
- Loading branch information
Showing
16 changed files
with
490 additions
and
46,216 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env node | ||
|
||
const program = require("commander"); | ||
const config = require("../package.json"); | ||
const { Generator } = require("../dist"); | ||
|
||
program | ||
.name("fhir-ts-codegen") | ||
.option("-i, --input <dir>", "input pattern to StructureDefinitions") | ||
.option("-o, --output <dir>", "path to output directory") | ||
.version(config.version) | ||
.parse(process.argv); | ||
|
||
if (program.input && program.output) { | ||
const generator = new Generator(program.input, program.output); | ||
generator.run(); | ||
} else { | ||
program.help() | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* FHIR Conformance Types | ||
*/ | ||
|
||
export enum FHIRPrimitives { | ||
base64binary = "base64binary", | ||
boolean = "boolean", | ||
canonical = "canonical", | ||
code = "code", | ||
date = "date", | ||
dateTime = "dateTime", | ||
decimal = "decimal", | ||
id = "id", | ||
instant = "instant", | ||
integer = "integer", | ||
markdown = "markdown", | ||
oid = "oid", | ||
positiveInt = "positiveInt", | ||
string = "string", | ||
time = "time", | ||
unsignedInt = "unsignedInt", | ||
uri = "uri", | ||
url = "url", | ||
uuid = "uuid" | ||
} | ||
|
||
export interface StructureDefinition { | ||
resourceType: string; | ||
url: string; | ||
version?: string; | ||
name: string; | ||
title?: string; | ||
status: string; | ||
experimental?: boolean; | ||
date?: string; | ||
description?: string; | ||
fhirVersion?: string; | ||
kind: string; | ||
abstract: boolean; | ||
contextType?: string; | ||
context?: string[]; | ||
contextInvariant?: string[]; | ||
type: string; | ||
baseDefinition?: string; | ||
derivation?: string; | ||
snapshot?: { element: ElementDefinition[] }; | ||
differential?: { element: ElementDefinition[] }; | ||
} | ||
|
||
export interface ElementDefinition { | ||
id?: string; | ||
path: string; | ||
min?: number; | ||
max?: string; | ||
type?: Array<{ | ||
code: string; | ||
}>; | ||
short?: string; | ||
contentReference?: string; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.