Skip to content

Commit 97f20b3

Browse files
razor-xseambot
andauthored
fix: Use POST for all endpoints with params (#44)
* Ensure post is used for all endpoints with parameters * ci: Generate code --------- Co-authored-by: Seam Bot <[email protected]>
1 parent 41b56a0 commit 97f20b3

File tree

5 files changed

+31
-43
lines changed

5 files changed

+31
-43
lines changed

generate-routes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,11 @@ const deriveResourceFromSchema = (properties: object): string | null =>
217217
Object.keys(properties).filter((key) => key !== 'ok')[0] ?? null
218218

219219
const deriveSemanticMethod = (methods: string[]): Method => {
220-
if (methods.includes('get')) return 'GET'
220+
// UPSTREAM: This should return GET before POST.
221+
// Blocked on https://github.com/seamapi/nextlove/issues/117
222+
// and https://github.com/seamapi/javascript-http/issues/43
221223
if (methods.includes('post')) return 'POST'
224+
if (methods.includes('get')) return 'GET'
222225
throw new Error(`Could not find valid method in ${methods.join(', ')}`)
223226
}
224227

@@ -458,7 +461,9 @@ const renderRequestType = ({
458461
pascalCase(requestFormatToRequestType(name, namespace)),
459462
].join('')
460463

461-
// UPSTREAM: Should be just requestFormat, but blocked on https://github.com/seamapi/nextlove/issues/117
464+
// UPSTREAM: This function is a workaround, as the request type should always match the request format.
465+
// Blocked on https://github.com/seamapi/nextlove/issues/117
466+
// and https://github.com/seamapi/javascript-http/issues/43
462467
const requestFormatToRequestType = (
463468
name: string,
464469
_namespace: string,

src/lib/seam/connect/routes/connected-accounts.ts

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

src/lib/seam/connect/routes/user-identities.ts

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

src/lib/seam/connect/routes/webhooks.ts

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

src/lib/seam/connect/routes/workspaces.ts

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

0 commit comments

Comments
 (0)