@hey-api/openapi-ts 0.56.3 → 0.57.1

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'
@@ -3833,12 +3833,29 @@ interface Config$a extends PluginName<'@hey-api/schemas'> {
3833
3833
 
3834
3834
  type IRMediaType = 'form-data' | 'json' | 'url-search-params';
3835
3835
 
3836
+ interface IRPathsObject {
3837
+ [path: `/${string}`]: IRPathItemObject;
3838
+ }
3839
+
3840
+ interface IRPathItemObject {
3841
+ delete?: IROperationObject;
3842
+ get?: IROperationObject;
3843
+ head?: IROperationObject;
3844
+ options?: IROperationObject;
3845
+ patch?: IROperationObject;
3846
+ post?: IROperationObject;
3847
+ put?: IROperationObject;
3848
+ trace?: IROperationObject;
3849
+ }
3850
+
3836
3851
  interface IROperationObject {
3837
3852
  body?: IRBodyObject;
3838
3853
  deprecated?: boolean;
3839
3854
  description?: string;
3840
3855
  id: string;
3856
+ method: keyof IRPathItemObject;
3841
3857
  parameters?: IRParametersObject;
3858
+ path: keyof IRPathsObject;
3842
3859
  responses?: IRResponsesObject;
3843
3860
  // TODO: parser - add more properties
3844
3861
  // security?: ReadonlyArray<SecurityRequirementObject>;
@@ -3866,7 +3883,8 @@ interface IRParametersObject {
3866
3883
  query?: Record<string, IRParameterObject>;
3867
3884
  }
3868
3885
 
3869
- interface IRParameterObject {
3886
+ interface IRParameterObject
3887
+ extends Pick<JsonSchemaDraft2020_12, 'deprecated' | 'description'> {
3870
3888
  /**
3871
3889
  * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of `contentType` (implicit or explicit) SHALL be ignored.
3872
3890
  */
@@ -3984,24 +4002,24 @@ interface IRSchemaObject
3984
4002
  | 'void';
3985
4003
  }
3986
4004
 
3987
- interface Config$9 extends PluginName<'@hey-api/services'> {
4005
+ interface Config$9 extends PluginName<'@hey-api/sdk'> {
3988
4006
  /**
3989
- * Group operation methods into service classes? When enabled, you can
3990
- * select which classes to export with `services.include` and/or
3991
- * transform their names with `services.name`.
4007
+ * Group operation methods into classes? When enabled, you can
4008
+ * select which classes to export with `sdk.include` and/or
4009
+ * transform their names with `sdk.serviceNameBuilder`.
3992
4010
  *
3993
- * Note that by enabling this option, your services will **NOT**
4011
+ * Note that by enabling this option, your SDKs will **NOT**
3994
4012
  * support {@link https://developer.mozilla.org/docs/Glossary/Tree_shaking tree-shaking}.
3995
4013
  * For this reason, it is disabled by default.
3996
4014
  * @default false
3997
4015
  */
3998
4016
  asClass?: boolean;
3999
4017
  /**
4000
- * Filter endpoints to be included in the generated services.
4001
- * The provided string should be a regular expression where matched
4002
- * results will be included in the output. The input pattern this
4003
- * string will be tested against is `{method} {path}`. For example,
4004
- * you can match `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4018
+ * Filter endpoints to be included in the generated SDK. The provided
4019
+ * string should be a regular expression where matched results will be
4020
+ * included in the output. The input pattern this string will be tested
4021
+ * against is `{method} {path}`. For example, you can match
4022
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4005
4023
  *
4006
4024
  * This option does not work with the experimental parser.
4007
4025
  *
@@ -4011,7 +4029,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4011
4029
  /**
4012
4030
  * Include only service classes with names matching regular expression
4013
4031
  *
4014
- * This option has no effect if `services.asClass` is `false`.
4032
+ * This option has no effect if `sdk.asClass` is `false`.
4015
4033
  */
4016
4034
  include?: string;
4017
4035
  /**
@@ -4026,7 +4044,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4026
4044
  operationId?: boolean;
4027
4045
  /**
4028
4046
  * Name of the generated file.
4029
- * @default 'services'
4047
+ * @default 'sdk'
4030
4048
  */
4031
4049
  output?: string;
4032
4050
  /**
@@ -4039,7 +4057,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4039
4057
  * Customize the generated service class names. The name variable is
4040
4058
  * obtained from your OpenAPI specification tags.
4041
4059
  *
4042
- * This option has no effect if `services.asClass` is `false`.
4060
+ * This option has no effect if `sdk.asClass` is `false`.
4043
4061
  * @default '{{name}}Service'
4044
4062
  */
4045
4063
  serviceNameBuilder?: string;
@@ -4058,12 +4076,25 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
4058
4076
  output?: string;
4059
4077
  }
4060
4078
 
4061
- interface Config$7 extends PluginName<'@hey-api/types'> {
4079
+ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4062
4080
  /**
4063
- * Generate enum definitions?
4081
+ * By default, enums are generated as TypeScript types. In addition to that,
4082
+ * you can choose to generate them as JavaScript objects, TypeScript enums,
4083
+ * or TypeScript enums contained within namespaces.
4064
4084
  * @default false
4065
4085
  */
4066
4086
  enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
4087
+ /**
4088
+ * By default, inline enums (enums not defined as reusable components in
4089
+ * the input file) are generated as inlined union types. You can set
4090
+ * `exportInlineEnums` to `true` to treat inline enums as reusable components.
4091
+ * When `true`, the exported enums will follow the style defined in `enums`.
4092
+ *
4093
+ * This option works only with the experimental parser.
4094
+ *
4095
+ * @default false
4096
+ */
4097
+ exportInlineEnums?: boolean;
4067
4098
  /**
4068
4099
  * Include only types matching regular expression.
4069
4100
  *
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'
@@ -3833,12 +3833,29 @@ interface Config$a extends PluginName<'@hey-api/schemas'> {
3833
3833
 
3834
3834
  type IRMediaType = 'form-data' | 'json' | 'url-search-params';
3835
3835
 
3836
+ interface IRPathsObject {
3837
+ [path: `/${string}`]: IRPathItemObject;
3838
+ }
3839
+
3840
+ interface IRPathItemObject {
3841
+ delete?: IROperationObject;
3842
+ get?: IROperationObject;
3843
+ head?: IROperationObject;
3844
+ options?: IROperationObject;
3845
+ patch?: IROperationObject;
3846
+ post?: IROperationObject;
3847
+ put?: IROperationObject;
3848
+ trace?: IROperationObject;
3849
+ }
3850
+
3836
3851
  interface IROperationObject {
3837
3852
  body?: IRBodyObject;
3838
3853
  deprecated?: boolean;
3839
3854
  description?: string;
3840
3855
  id: string;
3856
+ method: keyof IRPathItemObject;
3841
3857
  parameters?: IRParametersObject;
3858
+ path: keyof IRPathsObject;
3842
3859
  responses?: IRResponsesObject;
3843
3860
  // TODO: parser - add more properties
3844
3861
  // security?: ReadonlyArray<SecurityRequirementObject>;
@@ -3866,7 +3883,8 @@ interface IRParametersObject {
3866
3883
  query?: Record<string, IRParameterObject>;
3867
3884
  }
3868
3885
 
3869
- interface IRParameterObject {
3886
+ interface IRParameterObject
3887
+ extends Pick<JsonSchemaDraft2020_12, 'deprecated' | 'description'> {
3870
3888
  /**
3871
3889
  * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of `contentType` (implicit or explicit) SHALL be ignored.
3872
3890
  */
@@ -3984,24 +4002,24 @@ interface IRSchemaObject
3984
4002
  | 'void';
3985
4003
  }
3986
4004
 
3987
- interface Config$9 extends PluginName<'@hey-api/services'> {
4005
+ interface Config$9 extends PluginName<'@hey-api/sdk'> {
3988
4006
  /**
3989
- * Group operation methods into service classes? When enabled, you can
3990
- * select which classes to export with `services.include` and/or
3991
- * transform their names with `services.name`.
4007
+ * Group operation methods into classes? When enabled, you can
4008
+ * select which classes to export with `sdk.include` and/or
4009
+ * transform their names with `sdk.serviceNameBuilder`.
3992
4010
  *
3993
- * Note that by enabling this option, your services will **NOT**
4011
+ * Note that by enabling this option, your SDKs will **NOT**
3994
4012
  * support {@link https://developer.mozilla.org/docs/Glossary/Tree_shaking tree-shaking}.
3995
4013
  * For this reason, it is disabled by default.
3996
4014
  * @default false
3997
4015
  */
3998
4016
  asClass?: boolean;
3999
4017
  /**
4000
- * Filter endpoints to be included in the generated services.
4001
- * The provided string should be a regular expression where matched
4002
- * results will be included in the output. The input pattern this
4003
- * string will be tested against is `{method} {path}`. For example,
4004
- * you can match `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4018
+ * Filter endpoints to be included in the generated SDK. The provided
4019
+ * string should be a regular expression where matched results will be
4020
+ * included in the output. The input pattern this string will be tested
4021
+ * against is `{method} {path}`. For example, you can match
4022
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
4005
4023
  *
4006
4024
  * This option does not work with the experimental parser.
4007
4025
  *
@@ -4011,7 +4029,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4011
4029
  /**
4012
4030
  * Include only service classes with names matching regular expression
4013
4031
  *
4014
- * This option has no effect if `services.asClass` is `false`.
4032
+ * This option has no effect if `sdk.asClass` is `false`.
4015
4033
  */
4016
4034
  include?: string;
4017
4035
  /**
@@ -4026,7 +4044,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4026
4044
  operationId?: boolean;
4027
4045
  /**
4028
4046
  * Name of the generated file.
4029
- * @default 'services'
4047
+ * @default 'sdk'
4030
4048
  */
4031
4049
  output?: string;
4032
4050
  /**
@@ -4039,7 +4057,7 @@ interface Config$9 extends PluginName<'@hey-api/services'> {
4039
4057
  * Customize the generated service class names. The name variable is
4040
4058
  * obtained from your OpenAPI specification tags.
4041
4059
  *
4042
- * This option has no effect if `services.asClass` is `false`.
4060
+ * This option has no effect if `sdk.asClass` is `false`.
4043
4061
  * @default '{{name}}Service'
4044
4062
  */
4045
4063
  serviceNameBuilder?: string;
@@ -4058,12 +4076,25 @@ interface Config$8 extends PluginName<'@hey-api/transformers'> {
4058
4076
  output?: string;
4059
4077
  }
4060
4078
 
4061
- interface Config$7 extends PluginName<'@hey-api/types'> {
4079
+ interface Config$7 extends PluginName<'@hey-api/typescript'> {
4062
4080
  /**
4063
- * Generate enum definitions?
4081
+ * By default, enums are generated as TypeScript types. In addition to that,
4082
+ * you can choose to generate them as JavaScript objects, TypeScript enums,
4083
+ * or TypeScript enums contained within namespaces.
4064
4084
  * @default false
4065
4085
  */
4066
4086
  enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
4087
+ /**
4088
+ * By default, inline enums (enums not defined as reusable components in
4089
+ * the input file) are generated as inlined union types. You can set
4090
+ * `exportInlineEnums` to `true` to treat inline enums as reusable components.
4091
+ * When `true`, the exported enums will follow the style defined in `enums`.
4092
+ *
4093
+ * This option works only with the experimental parser.
4094
+ *
4095
+ * @default false
4096
+ */
4097
+ exportInlineEnums?: boolean;
4067
4098
  /**
4068
4099
  * Include only types matching regular expression.
4069
4100
  *