Skip to content

feat: add sdk snippet generation integration#9717

Draft
shelby-moore wants to merge 3 commits intoKong:developfrom
shelby-moore:feat-sdk-snippet-gen
Draft

feat: add sdk snippet generation integration#9717
shelby-moore wants to merge 3 commits intoKong:developfrom
shelby-moore:feat-sdk-snippet-gen

Conversation

@shelby-moore
Copy link
Contributor

This PR introduces a secondary "mode" to the existing Generate Client Code feature for requests. When available, Stainless will be used to generate the client code snippet. When unavailable, the codepath falls back to the existing http snippet client code generation.

@shelby-moore shelby-moore force-pushed the feat-sdk-snippet-gen branch from 7328cb8 to 1ed4eb3 Compare March 17, 2026 19:10
...har.queryString.map(({ name, value }) => ({ in: 'query' as const, name, value })),
...har.headers.map(({ name, value }) => ({ in: 'header' as const, name, value })),
];
const body = har.postData?.text ? tryParseJson(har.postData.text) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will be empty for other body formats we support, should we only show the Stainless options if there is no body or a set request body's mimeType can be parsed as JSON? (Maybe this is more a question for Stainless) can we translate from other formats to make the generate call?

Generating an SDK snippet without the body when the request itself has it doesn't feel right to me

objc: 'clike',
ocaml: 'mllike',
typescript: 'javascript',
kotlin: 'clike',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕺🏻

},
});

expect(result.body).toEqual({ username: 'alice', age: '30' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yesss


if (har.postData) {
if (har.postData.params) {
body = Object.fromEntries(har.postData.params.map(({ name, value }) => [name, value ?? '']));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: how we'd support this[that][more] if the body structure in the spec is nested (and if this applies/works with the snippet api)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants