Skip to content

Commit 52d1d7c

Browse files
committed
fix: Remove workaround for semantic method
1 parent 72d90f8 commit 52d1d7c

File tree

3 files changed

+15
-35
lines changed

3 files changed

+15
-35
lines changed

codegen/lib/layouts/route.ts

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ const getEndpointLayoutContext = (
7777
): EndpointLayoutContext => {
7878
const prefix = pascalCase([route.path.split('/'), endpoint.name].join('_'))
7979

80-
const methodParamName = getMethodParamName(endpoint.name, route.name)
80+
const methodParamName = ['GET', 'DELETE'].includes(
81+
endpoint.request.semanticMethod,
82+
)
83+
? 'params'
84+
: 'body'
8185

8286
const requestFormat = ['GET', 'DELETE'].includes(
8387
endpoint.request.preferredMethod,
@@ -127,27 +131,3 @@ const getResponseContext = (
127131

128132
const getClassName = (name: string | null): string =>
129133
`SeamHttp${pascalCase(name ?? '')}`
130-
131-
const getMethodParamName = (
132-
endpointName: string,
133-
routeName: string,
134-
): 'params' | 'body' => {
135-
// UPSTREAM: This function implements a workaround, as the request format should always follow the semantic method.
136-
// Blocked on https://github.com/seamapi/nextlove/issues/117
137-
// and https://github.com/seamapi/javascript-http/issues/43
138-
//
139-
// The desired implementation:
140-
//
141-
// return ['GET', 'DELETE'].includes(endpoint.request.semanticMethod)
142-
// ? 'params'
143-
// : 'body'
144-
145-
if (routeName.includes('simulate')) return 'body'
146-
if (['get', 'list', 'view'].includes(endpointName)) return 'params'
147-
if (['delete'].includes(endpointName)) return 'params'
148-
if (endpointName.includes('revoke')) return 'params'
149-
if (endpointName.includes('remove')) return 'params'
150-
if (endpointName.includes('deactivate')) return 'params'
151-
if (endpointName.startsWith('list')) return 'params'
152-
return 'body'
153-
}

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@
9898
"axios-retry": "^4.4.2"
9999
},
100100
"devDependencies": {
101-
"@seamapi/blueprint": "^0.48.1",
101+
"@seamapi/blueprint": "^0.50.1",
102102
"@seamapi/fake-seam-connect": "^1.77.0",
103103
"@seamapi/smith": "^0.4.4",
104-
"@seamapi/types": "1.413.0",
104+
"@seamapi/types": "1.420.2",
105105
"@swc/core": "^1.11.29",
106106
"@types/eslint": "^8.44.2",
107107
"@types/jsonwebtoken": "^9.0.6",

0 commit comments

Comments
 (0)