-
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): initial commit for fhir-ts-codegen package
- Loading branch information
Showing
234 changed files
with
395,749 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
lerna-debug.log | ||
lerna-debug.log | ||
node_modules |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
{ | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "independent" | ||
"packages": ["packages/*"], | ||
"version": "independent", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"command": { | ||
"publish": { | ||
"conventionalCommits": true | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,24 @@ | ||
{ | ||
"name": "root", | ||
"name": "fhir-ts", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"bootstrap": "lerna bootstrap" | ||
}, | ||
"devDependencies": { | ||
"lerna": "^3.10.5" | ||
"@types/glob": "^5.0.35", | ||
"@types/jest": "^23.3.2", | ||
"@types/node": "^10.9.3", | ||
"jest": "^23.6.0", | ||
"lerna": "^3.10.5", | ||
"ts-jest": "^23.1.4", | ||
"tslint": "^5.11.0", | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "^3.0.1" | ||
}, | ||
"dependencies": { | ||
"fhir-ts-codegen": "file:packages/fhir-ts-codegen" | ||
} | ||
} |
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,5 @@ | ||
node_modules | ||
.vscode | ||
.DS_Store | ||
coverage | ||
dist |
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,2 @@ | ||
lib | ||
structure-definitions |
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 @@ | ||
nodejs 10.14.1 |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) [2018] [Andrew Tang] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,47 @@ | ||
# fhir-ts-codegen | ||
|
||
FHIR TypeScript definitions generator. | ||
|
||
## Disclaimer | ||
|
||
This project is still in early stages of development and should not be considered "production-ready". | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install fhir-ts-codegen -g | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
fhir-ts-codegen <pattern> <output-directory> | ||
``` | ||
|
||
Example: | ||
|
||
```sh | ||
fhir-ts-codegen "structure-defintions/**.profile.json" "types" | ||
``` | ||
|
||
## Roadmap | ||
|
||
- Resource Definitions | ||
- [x] Interface declaration from snapshot | ||
- [x] Property names | ||
- [x] Property type names | ||
- [x] Optional properties | ||
- [x] Array properties | ||
- [x] JSDoc comments | ||
- [x] Backbone Element properties | ||
- [ ] Interface declaration from differential | ||
- [ ] Default values | ||
- [x] Content reference | ||
- Primitive types | ||
- [x] Type aliases | ||
- [x] Extensions | ||
- CLI options | ||
|
||
## License | ||
|
||
[MIT licensed](./LICENSE). |
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,4 @@ | ||
import { Command } from "clime"; | ||
export default class extends Command { | ||
execute(inputPath: string, outputPath: string): void; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 @@ | ||
export declare const generateDefinitions: (pattern: string, outputPath: string, version?: string) => string[]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,48 @@ | ||
export declare const stringsToPascalCase: (strs: string[]) => string; | ||
export declare const stringsToCamelCase: (strs: string[]) => string; | ||
export declare const convertToPascalCase: (s: string) => string; | ||
export declare const convertToCamelCase: (s: string) => string; | ||
/** | ||
* Formats ElementDefinition path to camel case | ||
*/ | ||
export declare const pathToCamelCase: (path: string) => string; | ||
/** | ||
* Formats ElementDefinition path to pascal case | ||
*/ | ||
export declare const pathToPascalCase: (path: string) => string; | ||
export declare const loadFromFile: (pathString: string) => any; | ||
/** | ||
* Parses the parent element name from the ElementDefinition path | ||
*/ | ||
export declare const parentName: ({ path }: { | ||
path: any; | ||
}) => string; | ||
/** | ||
* Parses the element name from the ElementDefinition path and a given type | ||
*/ | ||
export declare const elementName: (elementDefinition: any, type: any) => any; | ||
/** | ||
* Whether an Element Definition is defining a BackboneElement | ||
*/ | ||
export declare const isBackboneElement: ({ type }: any) => any; | ||
/** | ||
* Whether an Element Definition is defining a Choice Type | ||
* https://www.hl7.org/fhir/formats.html#choice | ||
*/ | ||
export declare const isChoiceType: ({ path }: { | ||
path: any; | ||
}) => boolean; | ||
/** | ||
* Whether an Element Definition is required | ||
*/ | ||
export declare const isRequired: ({ min }: { | ||
min: any; | ||
}) => boolean; | ||
/** | ||
* Format a TS property type name from an Element Definition | ||
*/ | ||
export declare const propertyTypeName: (elementDefinition: any) => any; | ||
/** | ||
* Removes all line breaks from string | ||
*/ | ||
export declare const formatComment: (comment: string) => string; |
Oops, something went wrong.