Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/layouts/partials/request-scalar-type.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record<string, unknown>{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}}
{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record<string, {{#if valueTypes}}{{#each valueTypes}}{{#unless @first}} | {{/unless}}{{jsonSchemaType this}}{{/each}}{{else}}unknown{{/if}}>{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}}
{{json name}}{{else}}string{{/each}}{{else}}string{{/if}}
2 changes: 1 addition & 1 deletion codegen/layouts/partials/resource-scalar-type.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record<string, unknown>{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}}
{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record<string, {{#if valueTypes}}{{#each valueTypes}}{{#unless @first}} | {{/unless}}{{jsonSchemaType this}}{{/each}}{{else}}unknown{{/if}}>{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}}
{{json name}}{{else}}string{{/each}}{{else}}string{{/if}}
17 changes: 17 additions & 0 deletions codegen/lib/handlebars-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ export const identity = (x: unknown): unknown => x

export const json = (value: unknown): string => JSON.stringify(value)

export const jsonSchemaType = (type: string): string => {
switch (type) {
case 'string':
case 'boolean':
return type
case 'number':
case 'integer':
return 'number'
case 'object':
return 'Record<string, unknown>'
case 'array':
return 'unknown[]'
default:
throw new Error(`Unsupported JSON Schema type: ${type}`)
}
}

export const replaceExtension = (fileName: string, extension: string): string =>
fileName.replace(/\.[^.]+$/, extension)

Expand Down
8 changes: 4 additions & 4 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 @@ -84,7 +84,7 @@
"axios-retry": "^4.4.2"
},
"devDependencies": {
"@seamapi/blueprint": "^1.6.0",
"@seamapi/blueprint": "^1.7.0",
"@seamapi/fake-seam-connect": "^2.0.4",
"@seamapi/smith": "^1.1.0",
"@seamapi/types": "1.1019.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/resources/connect-webview.ts

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

2 changes: 1 addition & 1 deletion src/lib/resources/connected-account.ts

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

2 changes: 1 addition & 1 deletion src/lib/resources/device.ts

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

Loading
Loading