Skip to content

Commit f0c31d9

Browse files
committed
feat: Incorporate optional and nullable properties into generated types
Update to @seamapi/blueprint@0.60.0, which adds isOptional and isNullable properties to the blueprint, and update the codegen to generate types that accurately reflect optionality and nullability: - Compute isOptionalParamsOk from the blueprint request parameters instead of falling back to true. Endpoint methods now require the parameters argument when an endpoint has required parameters. - Generate response types directly from RouteResponse instead of wrapping in SetNonNullable<Required<...>>, which stripped the optional and nullable markers from response keys that are genuinely optional or nullable (e.g., /events/get may return either event or message). Remove the now-unused SetNonNullable helper type. - Update to @seamapi/types@1.974.0 and regenerate all routes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ymgiD6xCZXPhepJy9Fprz
1 parent 9540ba7 commit f0c31d9

84 files changed

Lines changed: 863 additions & 1345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codegen/layouts/partials/route-class-endpoint-export.hbs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ export type {{legacyRequestTypeName}} = {{parametersTypeName}}
88
/**
99
* @deprecated Use {{requestTypeName}} instead.
1010
*/
11-
export type {{responseTypeName}} = SetNonNullable<
12-
Required<RouteResponse<'{{path}}'>>
13-
>
11+
export type {{responseTypeName}} = RouteResponse<'{{path}}'>
1412

1513
export type {{requestTypeName}} = SeamHttpRequest<{{#if returnsVoid}}void, undefined{{else}}{{responseTypeName}}, '{{responseKey}}'{{/if}}>
1614

codegen/layouts/partials/route-imports.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type {
44
RouteRequestParams,
55
RouteResponse,
66
} from '@seamapi/types/connect'
7-
import type { SetNonNullable } from 'lib/types.js'
87

98
import {
109
getAuthHeadersForClientSessionToken,

codegen/lib/layouts/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ export const getEndpointLayoutContext = (
113113
responseTypeName: `${prefix}Response`,
114114
optionsTypeName: `${prefix}Options`,
115115
requestTypeName: `${prefix}Request`,
116-
// UPSTREAM: Needs support in blueprint, fallback to true for now.
117-
// https://github.com/seamapi/blueprint/issues/205
118-
isOptionalParamsOk: true,
116+
isOptionalParamsOk: endpoint.request.parameters.every(
117+
(parameter) => !parameter.isRequired,
118+
),
119119
isUndocumented: endpoint.isUndocumented,
120120
...getResponseContext(endpoint),
121121
}

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"npm": ">=10.9.4"
8787
},
8888
"peerDependencies": {
89-
"@seamapi/types": "^1.941.0"
89+
"@seamapi/types": "^1.974.0"
9090
},
9191
"peerDependenciesMeta": {
9292
"@seamapi/types": {
@@ -99,10 +99,10 @@
9999
"axios-retry": "^4.4.2"
100100
},
101101
"devDependencies": {
102-
"@seamapi/blueprint": "^0.52.2",
102+
"@seamapi/blueprint": "^0.60.0",
103103
"@seamapi/fake-seam-connect": "^1.77.0",
104104
"@seamapi/smith": "^0.5.2",
105-
"@seamapi/types": "1.941.0",
105+
"@seamapi/types": "1.974.0",
106106
"@swc/core": "^1.11.29",
107107
"@types/jsonwebtoken": "^9.0.6",
108108
"@types/node": "^24.10.9",

src/lib/seam/connect/routes/access-codes/access-codes.ts

Lines changed: 26 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/seam/connect/routes/access-codes/simulate/simulate.ts

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)