@hey-api/openapi-ts 0.56.2 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  type PluginNames =
2
2
  | '@hey-api/schemas'
3
- | '@hey-api/services'
3
+ | '@hey-api/sdk'
4
4
  | '@hey-api/transformers'
5
- | '@hey-api/types'
5
+ | '@hey-api/typescript'
6
6
  | '@tanstack/angular-query-experimental'
7
7
  | '@tanstack/react-query'
8
8
  | '@tanstack/solid-query'
@@ -3920,7 +3920,21 @@ interface IRResponseObject {
3920
3920
  interface IRSchemaObject
3921
3921
  extends Pick<
3922
3922
  JsonSchemaDraft2020_12,
3923
- '$ref' | 'const' | 'deprecated' | 'description' | 'required' | 'title'
3923
+ | '$ref'
3924
+ | 'const'
3925
+ | 'default'
3926
+ | 'deprecated'
3927
+ | 'description'
3928
+ | 'exclusiveMaximum'
3929
+ | 'exclusiveMinimum'
3930
+ | 'maximum'
3931
+ | 'maxItems'
3932
+ | 'maxLength'
3933
+ | 'minimum'
3934
+ | 'minItems'
3935
+ | 'minLength'
3936
+ | 'required'
3937
+ | 'title'
3924
3938
  > {
3925
3939
  /**
3926
3940
  * If the schema is intended to be used as an object property, it can be
@@ -3970,24 +3984,24 @@ interface IRSchemaObject
3970
3984
  | 'void';
3971
3985
  }
3972
3986
 
3973
- interface Config$9 extends PluginName<'@hey-api/services'> {
3987
+ interface Config$9 extends PluginName<'@hey-api/sdk'> {
3974
3988
  /**
3975
- * Group operation methods into service classes? When enabled, you can
3976
- * select which classes to export with `services.include` and/or
3977
- * transform their names with `services.name`.
3989
+ * Group operation methods into classes? When enabled, you can
3990
+ * select which classes to export with `sdk.include` and/or
3991
+ * transform their names with `sdk.serviceNameBuilder`.
3978
3992
  *
3979
- * Note that by enabling this option, your services will **NOT**
3993
+ * Note that by enabling this option, your SDKs will **NOT**
3980
3994
  * support {@link https://developer.mozilla.org/docs/Glossary/Tree_shaking tree-shaking}.
3981
3995
  * For this reason, it is disabled by default.
3982
3996
  * @default false
3983
3997
  */
3984
3998
  asClass?: boolean;
3985
3999
  /**
3986
- * Filter endpoints to be included in the generated services.
3987
- * The provided string should be a regular expression where matched
3988
- * results will be included in the output. The input pattern this
3989
- * string will be tested against is `{method} {path}`. For example,
3990
- * you can match `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4000
+ * Filter endpoints to be included in the generated SDK. The provided
4001
+ * string should be a regular expression where matched results will be
4002
+ * included in the output. The input pattern this string will be tested
4003
+ * against is `{method} {path}`. For example, you can match
4004
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
3991
4005
  *
3992
4006
  * This option does not work with the experimental parser.
3993
4007
  *
@@ -3997,7 +4011,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
3997
4011
  /**
3998
4012
  * Include only service classes with names matching regular expression
3999
4013
  *
4000
- * This option has no effect if `services.asClass` is `false`.
4014
+ * This option has no effect if `sdk.asClass` is `false`.
4001
4015
  */
4002
4016
  include?: string;
4003
4017
  /**
@@ -4012,7 +4026,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4012
4026
  operationId?: boolean;
4013
4027
  /**
4014
4028
  * Name of the generated file.
4015
- * @default 'services'
4029
+ * @default 'sdk'
4016
4030
  */
4017
4031
  output?: string;
4018
4032
  /**
@@ -4025,7 +4039,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4025
4039
  * Customize the generated service class names. The name variable is
4026
4040
  * obtained from your OpenAPI specification tags.
4027
4041
  *
4028
- * This option has no effect if `services.asClass` is `false`.
4042
+ * This option has no effect if `sdk.asClass` is `false`.
4029
4043
  * @default '{{name}}Service'
4030
4044
  */
4031
4045
  serviceNameBuilder?: string;
@@ -4044,12 +4058,25 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
4044
4058
  output?: string;
4045
4059
  }
4046
4060
 
4047
- interface Config$7 extends PluginName<'@hey-api/types'> {
4061
+ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4048
4062
  /**
4049
- * Generate enum definitions?
4063
+ * By default, enums are generated as TypeScript types. In addition to that,
4064
+ * you can choose to generate them as JavaScript objects, TypeScript enums,
4065
+ * or TypeScript enums contained within namespaces.
4050
4066
  * @default false
4051
4067
  */
4052
4068
  enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
4069
+ /**
4070
+ * By default, inline enums (enums not defined as reusable components in
4071
+ * the input file) are generated as inlined union types. You can set
4072
+ * `exportInlineEnums` to `true` to treat inline enums as reusable components.
4073
+ * When `true`, the exported enums will follow the style defined in `enums`.
4074
+ *
4075
+ * This option works only with the experimental parser.
4076
+ *
4077
+ * @default false
4078
+ */
4079
+ exportInlineEnums?: boolean;
4053
4080
  /**
4054
4081
  * Include only types matching regular expression.
4055
4082
  *
@@ -4207,7 +4234,15 @@ interface Config$1 extends PluginName<'fastify'> {
4207
4234
  output?: string;
4208
4235
  }
4209
4236
 
4237
+ // import type { IROperationObject, IRSchemaObject } from '../../ir/ir';
4238
+
4239
+
4210
4240
  interface Config extends PluginName<'zod'> {
4241
+ /**
4242
+ * Customise the Zod schema name. By default, `z{{name}}` is used,
4243
+ * where `name` is a definition name or an operation name.
4244
+ */
4245
+ // nameBuilder?: (model: IROperationObject | IRSchemaObject) => string;
4211
4246
  /**
4212
4247
  * Name of the generated file.
4213
4248
  * @default 'zod'
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  type PluginNames =
2
2
  | '@hey-api/schemas'
3
- | '@hey-api/services'
3
+ | '@hey-api/sdk'
4
4
  | '@hey-api/transformers'
5
- | '@hey-api/types'
5
+ | '@hey-api/typescript'
6
6
  | '@tanstack/angular-query-experimental'
7
7
  | '@tanstack/react-query'
8
8
  | '@tanstack/solid-query'
@@ -3920,7 +3920,21 @@ interface IRResponseObject {
3920
3920
  interface IRSchemaObject
3921
3921
  extends Pick<
3922
3922
  JsonSchemaDraft2020_12,
3923
- '$ref' | 'const' | 'deprecated' | 'description' | 'required' | 'title'
3923
+ | '$ref'
3924
+ | 'const'
3925
+ | 'default'
3926
+ | 'deprecated'
3927
+ | 'description'
3928
+ | 'exclusiveMaximum'
3929
+ | 'exclusiveMinimum'
3930
+ | 'maximum'
3931
+ | 'maxItems'
3932
+ | 'maxLength'
3933
+ | 'minimum'
3934
+ | 'minItems'
3935
+ | 'minLength'
3936
+ | 'required'
3937
+ | 'title'
3924
3938
  > {
3925
3939
  /**
3926
3940
  * If the schema is intended to be used as an object property, it can be
@@ -3970,24 +3984,24 @@ interface IRSchemaObject
3970
3984
  | 'void';
3971
3985
  }
3972
3986
 
3973
- interface Config$9 extends PluginName<'@hey-api/services'> {
3987
+ interface Config$9 extends PluginName<'@hey-api/sdk'> {
3974
3988
  /**
3975
- * Group operation methods into service classes? When enabled, you can
3976
- * select which classes to export with `services.include` and/or
3977
- * transform their names with `services.name`.
3989
+ * Group operation methods into classes? When enabled, you can
3990
+ * select which classes to export with `sdk.include` and/or
3991
+ * transform their names with `sdk.serviceNameBuilder`.
3978
3992
  *
3979
- * Note that by enabling this option, your services will **NOT**
3993
+ * Note that by enabling this option, your SDKs will **NOT**
3980
3994
  * support {@link https://developer.mozilla.org/docs/Glossary/Tree_shaking tree-shaking}.
3981
3995
  * For this reason, it is disabled by default.
3982
3996
  * @default false
3983
3997
  */
3984
3998
  asClass?: boolean;
3985
3999
  /**
3986
- * Filter endpoints to be included in the generated services.
3987
- * The provided string should be a regular expression where matched
3988
- * results will be included in the output. The input pattern this
3989
- * string will be tested against is `{method} {path}`. For example,
3990
- * you can match `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4000
+ * Filter endpoints to be included in the generated SDK. The provided
4001
+ * string should be a regular expression where matched results will be
4002
+ * included in the output. The input pattern this string will be tested
4003
+ * against is `{method} {path}`. For example, you can match
4004
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
3991
4005
  *
3992
4006
  * This option does not work with the experimental parser.
3993
4007
  *
@@ -3997,7 +4011,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
3997
4011
  /**
3998
4012
  * Include only service classes with names matching regular expression
3999
4013
  *
4000
- * This option has no effect if `services.asClass` is `false`.
4014
+ * This option has no effect if `sdk.asClass` is `false`.
4001
4015
  */
4002
4016
  include?: string;
4003
4017
  /**
@@ -4012,7 +4026,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4012
4026
  operationId?: boolean;
4013
4027
  /**
4014
4028
  * Name of the generated file.
4015
- * @default 'services'
4029
+ * @default 'sdk'
4016
4030
  */
4017
4031
  output?: string;
4018
4032
  /**
@@ -4025,7 +4039,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4025
4039
  * Customize the generated service class names. The name variable is
4026
4040
  * obtained from your OpenAPI specification tags.
4027
4041
  *
4028
- * This option has no effect if `services.asClass` is `false`.
4042
+ * This option has no effect if `sdk.asClass` is `false`.
4029
4043
  * @default '{{name}}Service'
4030
4044
  */
4031
4045
  serviceNameBuilder?: string;
@@ -4044,12 +4058,25 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
4044
4058
  output?: string;
4045
4059
  }
4046
4060
 
4047
- interface Config$7 extends PluginName<'@hey-api/types'> {
4061
+ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4048
4062
  /**
4049
- * Generate enum definitions?
4063
+ * By default, enums are generated as TypeScript types. In addition to that,
4064
+ * you can choose to generate them as JavaScript objects, TypeScript enums,
4065
+ * or TypeScript enums contained within namespaces.
4050
4066
  * @default false
4051
4067
  */
4052
4068
  enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
4069
+ /**
4070
+ * By default, inline enums (enums not defined as reusable components in
4071
+ * the input file) are generated as inlined union types. You can set
4072
+ * `exportInlineEnums` to `true` to treat inline enums as reusable components.
4073
+ * When `true`, the exported enums will follow the style defined in `enums`.
4074
+ *
4075
+ * This option works only with the experimental parser.
4076
+ *
4077
+ * @default false
4078
+ */
4079
+ exportInlineEnums?: boolean;
4053
4080
  /**
4054
4081
  * Include only types matching regular expression.
4055
4082
  *
@@ -4207,7 +4234,15 @@ interface Config$1 extends PluginName<'fastify'> {
4207
4234
  output?: string;
4208
4235
  }
4209
4236
 
4237
+ // import type { IROperationObject, IRSchemaObject } from '../../ir/ir';
4238
+
4239
+
4210
4240
  interface Config extends PluginName<'zod'> {
4241
+ /**
4242
+ * Customise the Zod schema name. By default, `z{{name}}` is used,
4243
+ * where `name` is a definition name or an operation name.
4244
+ */
4245
+ // nameBuilder?: (model: IROperationObject | IRSchemaObject) => string;
4211
4246
  /**
4212
4247
  * Name of the generated file.
4213
4248
  * @default 'zod'