Skip to content

Commit

Permalink
Merge branch 'master' into comment-annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
digocesar authored Aug 19, 2022
2 parents ce3edc5 + cda53a0 commit 473c17b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ $ npm install --save csharp-models-to-typescript
"locale": "en-US"
},
"numericEnums": false,
"omitFilePathComment": false,
"stringLiteralTypesInsteadOfEnums": false,
"customTypeTranslations": {
"ProductName": "string",
Expand Down
8 changes: 6 additions & 2 deletions converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const createConverter = config => {
const members = [...(model.Fields || []), ...(model.Properties || [])];
const baseClasses = model.BaseClasses && model.BaseClasses.length ? ` extends ${model.BaseClasses.join(', ')}` : '';

rows.push(`// ${filename}`);
if (!config.omitFilePathComment) {
rows.push(`// ${filename}`);
}
let classCommentRows = formatComment(model.ExtraInfo, '')
if (classCommentRows) {
rows.push(classCommentRows);
Expand Down Expand Up @@ -95,7 +97,9 @@ const createConverter = config => {

const convertEnum = (enum_, filename) => {
const rows = [];
rows.push(`// ${filename}`);
if (!config.omitFilePathComment) {
rows.push(`// ${filename}`);
}

const entries = Object.entries(enum_.Values);

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const converter = createConverter({
camelCaseOptions: config.camelCaseOptions || {},
camelCaseEnums: config.camelCaseEnums || false,
numericEnums: config.numericEnums || false,
omitFilePathComment: config.omitFilePathComment || false,
stringLiteralTypesInsteadOfEnums: config.stringLiteralTypesInsteadOfEnums || false
});

Expand Down
31 changes: 29 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "csharp-models-to-typescript",
"version": "0.21.1",
"version": "0.22.0",
"title": "C# models to TypeScript",
"author": "Jonathan Svenheden <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 473c17b

Please sign in to comment.