Skip to content

Commit

Permalink
Fixed custom name function used when generating types
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
  • Loading branch information
JBBianchi committed Aug 30, 2024
1 parent 9d4748c commit cf1d42c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 195 deletions.
192 changes: 4 additions & 188 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
Expand Up @@ -56,7 +56,7 @@
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"json-schema-to-typescript": "^15.0.0",
"json-schema-to-typescript": "^15.0.1",
"lint-staged": "^15.2.7",
"node-fetch": "^3.3.2",
"prettier": "^3.3.3",
Expand Down
8 changes: 2 additions & 6 deletions tools/2_generate-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,11 @@ function mutateSchema(schema: any, path: string[] = ['#']): any {
*/
async function generate(srcFile: string, destFile: string): Promise<void> {
const options: Partial<Options> = {
customName: (schema: JSONSchema, keyNameFromDefinition: string | undefined) => {
customName: (schema: JSONSchema) /*, keyNameFromDefinition: string | undefined)*/ => {
if (schema.$id?.includes('serverlessworkflow.io')) {
return 'Workflow';
}
if (keyNameFromDefinition === 'oauth2Token') {
// seems to ignore the title from this object, so forcing it...
return schema.title;
}
return keyNameFromDefinition;
// don't return anything to keep the default behavior
},
bannerComment: `${fileHeader}
${inFileDisclaimer}
Expand Down

0 comments on commit cf1d42c

Please sign in to comment.