Skip to content

Commit 4ec7a02

Browse files
Make sure route path is defined where needed, update types to 1.340.1
1 parent 2fe08cb commit 4ec7a02

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"zod": "^3.23.8"
7474
},
7575
"devDependencies": {
76-
"@seamapi/types": "1.338.1",
76+
"@seamapi/types": "1.340.1",
7777
"@types/node": "^20.8.10",
7878
"ava": "^6.0.1",
7979
"c8": "^10.1.2",

src/lib/blueprint.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ export const createResources = (
798798
parsedEvent.oneOf,
799799
)
800800
const eventSchema: OpenapiSchema = {
801+
'x-route-path': parsedEvent['x-route-path'],
801802
properties: commonProperties,
802803
type: 'object',
803804
}
@@ -826,7 +827,8 @@ const createResource = (
826827
schemaName: string,
827828
schema: OpenapiSchema,
828829
): Resource => {
829-
if (schema['x-route-path'] == null) {
830+
const routePath = schema['x-route-path']
831+
if (routePath == null || routePath.length === 0) {
830832
throw new Error(`Missing route path for ${schemaName}`)
831833
}
832834

@@ -835,7 +837,7 @@ const createResource = (
835837
properties: createProperties(schema.properties ?? {}, [schemaName]),
836838
description: schema.description ?? '',
837839
isDeprecated: schema.deprecated ?? false,
838-
routePath: schema['x-route-path'],
840+
routePath,
839841
deprecationMessage: schema['x-deprecated'] ?? '',
840842
isUndocumented: (schema['x-undocumented'] ?? '').length > 0,
841843
undocumentedMessage: schema['x-undocumented'] ?? '',
@@ -1159,6 +1161,7 @@ const createActionAttempts = (
11591161
processedActionTypes.add(actionType)
11601162

11611163
const schemaWithStandardStatus: OpenapiSchema = {
1164+
'x-route-path': actionAttemptSchema['x-route-path'],
11621165
...schema,
11631166
properties: {
11641167
...schema.properties,

src/lib/openapi/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const ResourceSchema = z.object({
115115
})
116116

117117
export const EventResourceSchema = z.object({
118+
'x-route-path': z.string().default(''),
118119
discriminator: z.object({ propertyName: z.string() }),
119120
oneOf: z.array(ResourceSchema),
120121
})

test/fixtures/types/openapi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export default {
130130
'x-route-path': '/undocumented/resources',
131131
},
132132
event: {
133+
'x-route-path': '/events',
133134
oneOf: [
134135
{
135136
type: 'object',

0 commit comments

Comments
 (0)