From aab4ad341534e0d130e747f6c81259f69179d299 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Fri, 30 Aug 2024 18:28:18 +0000 Subject: [PATCH 1/4] feat: Add name to Route and Endpoint (#75) --- src/lib/blueprint.ts | 15 ++++++++++++++- test/snapshots/blueprint.test.ts.md | 10 ++++++++++ test/snapshots/blueprint.test.ts.snap | Bin 3997 -> 4034 bytes test/snapshots/seam-blueprint.test.ts.md | 4 ++++ test/snapshots/seam-blueprint.test.ts.snap | Bin 3701 -> 3732 bytes 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/lib/blueprint.ts b/src/lib/blueprint.ts index 86bfbd2..83d9d8f 100644 --- a/src/lib/blueprint.ts +++ b/src/lib/blueprint.ts @@ -26,6 +26,7 @@ export interface Blueprint { export interface Route { path: string + name: string namespace: Namespace | null endpoints: Endpoint[] subroutes: Route[] @@ -44,6 +45,7 @@ export interface Namespace { export interface Endpoint { title: string path: string + name: string description: string isUndocumented: boolean isDeprecated: boolean @@ -290,9 +292,14 @@ const createRoute = async ( ): Promise => { const pathParts = path.split('/') const routePath = `/${pathParts.slice(1, -1).join('/')}` + const name = pathParts.at(-2) + if (name == null) { + throw new Error(`Could not resolve name for route at ${path}`) + } return { path: routePath, + name, namespace: { path: `/${pathParts[1]}` }, endpoints: await createEndpoints(path, pathItem, context), subroutes: [], @@ -335,6 +342,11 @@ const createEndpoint = async ( const pathParts = path.split('/') const endpointPath = `/${pathParts.slice(1).join('/')}` + const name = pathParts.at(-1) + if (name == null) { + throw new Error(`Could not resolve name for endpoint at ${path}`) + } + const parsedOperation = OpenapiOperationSchema.parse(operation) const title = parsedOperation['x-title'] @@ -349,8 +361,9 @@ const createEndpoint = async ( const request = createRequest(methods, operation) - const endpoint = { + const endpoint: Omit = { title, + name, path: endpointPath, description, isUndocumented, diff --git a/test/snapshots/blueprint.test.ts.md b/test/snapshots/blueprint.test.ts.md index 30b50bc..b4cb2f9 100644 --- a/test/snapshots/blueprint.test.ts.md +++ b/test/snapshots/blueprint.test.ts.md @@ -129,6 +129,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'get', path: '/foos/get', request: { methods: [ @@ -210,6 +211,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'get', path: '/foos/get', request: { methods: [ @@ -291,6 +293,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'list', path: '/foos/list', request: { methods: [ @@ -372,6 +375,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'list', path: '/foos/list', request: { methods: [ @@ -390,6 +394,7 @@ Generated by [AVA](https://avajs.dev). title: 'List foos', }, ], + name: 'foos', namespace: { path: '/foos', }, @@ -535,6 +540,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'get', path: '/foos/get', request: { methods: [ @@ -626,6 +632,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'get', path: '/foos/get', request: { methods: [ @@ -717,6 +724,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'list', path: '/foos/list', request: { methods: [ @@ -808,6 +816,7 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, + name: 'list', path: '/foos/list', request: { methods: [ @@ -826,6 +835,7 @@ Generated by [AVA](https://avajs.dev). title: 'List foos', }, ], + name: 'foos', namespace: { path: '/foos', }, diff --git a/test/snapshots/blueprint.test.ts.snap b/test/snapshots/blueprint.test.ts.snap index 3c66bbee360d1e3acc06b0547e6b38f1bcdbb11e..2c55dbae3a9ec8c53b6983087abeaa002ff01370 100644 GIT binary patch literal 4034 zcmZ9GcQhLe_s5Oegi^a`l^8K(OSsZmuiLljjrsE8P$f?737?NwWdgxV{pJsU;T zruJ@8kJ0}6d)~j^_nvdlx#!-`{hY6sxz?>`o=}*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3WSUuvms zI}5}zZgXGFR@SnyWS_R=lex3XbQ8u%f+S5lS84#G&Z42MVx)~G;aVz@%o?Wd?#aCs zoeMcS-p8mLgg{~T&QGv~?^Ih4x~tsPKyO$*^r3_KuV3p<9|X=E1R4(kHy#4seF*ro zL%`FAfHQ}H`omIo8wq?}G=3PEIt`SoqT&;DpdB2lp;lg&%*zpg_-lEr|W@2$5=#^nuqLa0fS T)HIU*f4%TKEUIU;n?V2oMj08; From 54e9fe6dfba77fe098605c0964e33116a0229e3f Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 30 Aug 2024 18:29:06 +0000 Subject: [PATCH 2/4] 0.16.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 918165f..2ec0d6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@seamapi/blueprint", - "version": "0.15.2", + "version": "0.16.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@seamapi/blueprint", - "version": "0.15.2", + "version": "0.16.0", "license": "MIT", "dependencies": { "change-case": "^5.4.4", diff --git a/package.json b/package.json index 11a4a63..535cd0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@seamapi/blueprint", - "version": "0.15.2", + "version": "0.16.0", "description": "Build tools for the Seam API using this blueprint.", "type": "module", "main": "index.js", From 36a00e13a1f707d6295d0b6ca25f502342d11d1c Mon Sep 17 00:00:00 2001 From: Mike Wu Date: Wed, 4 Sep 2024 16:45:31 +0900 Subject: [PATCH 3/4] fix: Missing object parameters / properties (#78) * fix missing object parameters / properties * ci: Generate code --------- Co-authored-by: Seam Bot --- src/lib/blueprint.ts | 10 +++---- test/snapshots/seam-blueprint.test.ts.md | 31 ++++++++++++++++++++- test/snapshots/seam-blueprint.test.ts.snap | Bin 3732 -> 3907 bytes 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/lib/blueprint.ts b/src/lib/blueprint.ts index 83d9d8f..ff4e7ba 100644 --- a/src/lib/blueprint.ts +++ b/src/lib/blueprint.ts @@ -483,13 +483,13 @@ const createParameters = ( case 'array': return { ...baseParam, format: 'list', jsonType: 'array' } case 'object': - if (parsedProp.properties !== undefined) { + if (property.properties !== undefined) { return { ...baseParam, format: 'object', jsonType: 'object', parameters: createParameters( - parsedProp.properties as Record, + property.properties as Record, ), } } @@ -646,14 +646,12 @@ export const createProperties = ( case 'array': return { ...baseProperty, format: 'list', jsonType: 'array' } case 'object': - if (parsedProp.properties !== undefined) { + if (prop.properties !== undefined) { return { ...baseProperty, format: 'object', jsonType: 'object', - properties: createProperties( - parsedProp.properties as Record, - ), + properties: createProperties(prop.properties), } } return { ...baseProperty, format: 'record', jsonType: 'object' } diff --git a/test/snapshots/seam-blueprint.test.ts.md b/test/snapshots/seam-blueprint.test.ts.md index d9a3620..f07087d 100644 --- a/test/snapshots/seam-blueprint.test.ts.md +++ b/test/snapshots/seam-blueprint.test.ts.md @@ -203,11 +203,40 @@ Generated by [AVA](https://avajs.dev). { deprecationMessage: '', description: '', - format: 'record', + format: 'object', isDeprecated: false, isUndocumented: false, jsonType: 'object', name: 'visionline_metadata', + properties: [ + { + deprecationMessage: '', + description: '', + format: 'string', + isDeprecated: false, + isUndocumented: false, + jsonType: 'string', + name: 'lan_address', + }, + { + deprecationMessage: '', + description: '', + format: 'string', + isDeprecated: false, + isUndocumented: false, + jsonType: 'string', + name: 'mobile_access_uuid', + }, + { + deprecationMessage: '', + description: '', + format: 'string', + isDeprecated: false, + isUndocumented: false, + jsonType: 'string', + name: 'system_id', + }, + ], }, { deprecationMessage: '', diff --git a/test/snapshots/seam-blueprint.test.ts.snap b/test/snapshots/seam-blueprint.test.ts.snap index 7c69502d6619dc30508132fa3d3687f9b5010fe8..109804339bb988b2600dfe42a5834670152eab68 100644 GIT binary patch literal 3907 zcmV-J54`X}RzV z!D?D0a36~Z00000000B+oO^5>*LB8!vt049D?UU@B1KWsP?RW2)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I${(E0E5A6MSN`;LUU}QKp7KT))}$yi*A`8q6ctHJ_vTmp+TzOp+|n!0 z>E^Ue7pZMi{fsM{pX)EV@!ZXFzTq@QOu@9WP|uLgY+v$V7 zUX3V|;&->E*WCmc2ww_A2)&Z(}Vxiq4FSUiVv9W-sBK z#7V-iR*Mbb)Lv%VCPvz15TPaGi3~Gz_k8gA=v>Xw@m{8Fa0K$JcXolzzi0d3F?W}{ z8ED7RO+y!sX5Zeed+;c5;VAILQJ`xMn4JS&J_p=02V9r~9-ou4Th#Z~(=&6xujhdM z$AAmRfQ!d~?;iu|jsv5|fm@DCDz5dZc=K`Kt;c~!j{~uJ;Es9Vb@RYO^T1>Cz>nr7 z6~}z<)?C?&oT0+C!n#Mw+i@olX8bIDWya~$161q|u*};ySJtfy1-JSSOB1WPTD#xp yEVd$%sMz(*&T?nH+YpdMAs|=!6t9wTd6s4fHAsRQERp-KBYq2M Date: Wed, 4 Sep 2024 07:46:17 +0000 Subject: [PATCH 4/4] 0.16.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ec0d6e..7a4c037 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@seamapi/blueprint", - "version": "0.16.0", + "version": "0.16.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@seamapi/blueprint", - "version": "0.16.0", + "version": "0.16.1", "license": "MIT", "dependencies": { "change-case": "^5.4.4", diff --git a/package.json b/package.json index 535cd0c..4557bbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@seamapi/blueprint", - "version": "0.16.0", + "version": "0.16.1", "description": "Build tools for the Seam API using this blueprint.", "type": "module", "main": "index.js",