Skip to content

Migrate SDK generator to hey-api #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defaultPlugins, defineConfig } from '@hey-api/openapi-ts';

/*
Most of this config is just trying to make the generated code match
the openapi-generator code as much as possible.
We can gradually move to a pure `hey-api` solution over the course of a few PRs and as `hey` matures.
There are some openapi-generator features this project uses (at least currently)
that do not have parity in `hey` yet.
*/

export default defineConfig({
input: 'openapi.json',
output: 'src/generated-client',
plugins: [
...defaultPlugins,
'@hey-api/client-axios',
{
name: '@hey-api/typescript',
// Prevents enums from being generated as types
enums: 'typescript',
// By default all enum values are screaming snake case
enumsCase: 'PascalCase',
// Prevents types from being split into read-only and write-only variants.
// Not sure how much of an advantage this is, but setting this makes the output closer
// to the original
readOnlyWriteOnlyBehavior: 'off'
},
{
name: '@hey-api/sdk',
// Groups related methods into classes. Does NOT support tree shaking.
// Only doing this now to make the output SDK more closely match the openapi-generator code.
asClass: true,
// Aligns class names to match class names in current SDK
serviceNameBuilder: '{{name}}Api'
}
]
});
24 changes: 0 additions & 24 deletions openapitools.json

This file was deleted.

Loading