@kubb/plugin-ts 5.5.0-canary.20261111T115959 → 5.5.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.cjs +697 -825
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +698 -826
- package/dist/index.js.map +1 -1
- package/docs/guides/customization.md +2 -2
- package/docs/options.md +2 -1
- package/kubb-extension.json +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -72,6 +72,14 @@ type PrinterTsOptions = {
|
|
|
72
72
|
* JSDoc comment to attach to the generated type.
|
|
73
73
|
*/
|
|
74
74
|
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* `@example` values for the generated type, such as a media type's `examples`. Replaces the schema's own.
|
|
77
|
+
*/
|
|
78
|
+
examples?: Array<unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* JSDoc lines put before the schema's own, such as a response's `@summary`.
|
|
81
|
+
*/
|
|
82
|
+
comments?: Array<string>;
|
|
75
83
|
/**
|
|
76
84
|
* Properties to exclude using `Omit<Type, Keys>`.
|
|
77
85
|
* Forces type alias syntax regardless of `syntaxType` setting.
|
|
@@ -174,9 +182,16 @@ type ResolverTs = Resolver & {
|
|
|
174
182
|
* Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
|
|
175
183
|
*
|
|
176
184
|
* @example Response status names
|
|
177
|
-
* `resolver.response.status(node, 200) // → 'ListPetsStatus200'`
|
|
185
|
+
* `resolver.response.status(node, '200') // → 'ListPetsStatus200'`
|
|
178
186
|
*/
|
|
179
187
|
status(node: ast.OperationNode, statusCode: ast.StatusCode): string;
|
|
188
|
+
/**
|
|
189
|
+
* Resolves the name for the headers a response declares.
|
|
190
|
+
*
|
|
191
|
+
* @example Response headers names
|
|
192
|
+
* `resolver.response.headers(node, '200') // → 'ListPetsStatus200Headers'`
|
|
193
|
+
*/
|
|
194
|
+
headers(node: ast.OperationNode, statusCode: ast.StatusCode): string;
|
|
180
195
|
/**
|
|
181
196
|
* Resolves the name for an operation's grouped request options type (`Options`), the
|
|
182
197
|
* `{ body, path, query, headers, cookies }` bag passed to call an operation.
|
|
@@ -815,12 +830,16 @@ type EnumTypeNameProps = {
|
|
|
815
830
|
export declare function enumTypeName({ resolver, name, enumOptions, isEnum }: EnumTypeNameProps): string;
|
|
816
831
|
type BuildParamsSchemaOptions = {
|
|
817
832
|
params: Array<ast.ParameterNode>;
|
|
833
|
+
/**
|
|
834
|
+
* Adds each serialized example to `examples` as a `<caption>Serialized</caption>` JSDoc line.
|
|
835
|
+
* Leave it off when `examples` must hold values, such as for mocks.
|
|
836
|
+
*/
|
|
837
|
+
serializedExamples?: boolean;
|
|
818
838
|
};
|
|
819
839
|
/**
|
|
820
|
-
* Builds the object schema for
|
|
821
|
-
*
|
|
822
|
-
* separate per-param type — the group itself is the only type these params get exported as.
|
|
840
|
+
* Builds the object schema for one parameter group or a response's headers. Each entry embeds its own schema and JSDoc,
|
|
841
|
+
* so the group is the only type these entries are exported as.
|
|
823
842
|
*/
|
|
824
|
-
export declare function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
843
|
+
export declare function buildParams({ params, serializedExamples }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
825
844
|
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
|
826
845
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,14 @@ type PrinterTsOptions = {
|
|
|
72
72
|
* JSDoc comment to attach to the generated type.
|
|
73
73
|
*/
|
|
74
74
|
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* `@example` values for the generated type, such as a media type's `examples`. Replaces the schema's own.
|
|
77
|
+
*/
|
|
78
|
+
examples?: Array<unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* JSDoc lines put before the schema's own, such as a response's `@summary`.
|
|
81
|
+
*/
|
|
82
|
+
comments?: Array<string>;
|
|
75
83
|
/**
|
|
76
84
|
* Properties to exclude using `Omit<Type, Keys>`.
|
|
77
85
|
* Forces type alias syntax regardless of `syntaxType` setting.
|
|
@@ -174,9 +182,16 @@ type ResolverTs = Resolver & {
|
|
|
174
182
|
* Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
|
|
175
183
|
*
|
|
176
184
|
* @example Response status names
|
|
177
|
-
* `resolver.response.status(node, 200) // → 'ListPetsStatus200'`
|
|
185
|
+
* `resolver.response.status(node, '200') // → 'ListPetsStatus200'`
|
|
178
186
|
*/
|
|
179
187
|
status(node: ast.OperationNode, statusCode: ast.StatusCode): string;
|
|
188
|
+
/**
|
|
189
|
+
* Resolves the name for the headers a response declares.
|
|
190
|
+
*
|
|
191
|
+
* @example Response headers names
|
|
192
|
+
* `resolver.response.headers(node, '200') // → 'ListPetsStatus200Headers'`
|
|
193
|
+
*/
|
|
194
|
+
headers(node: ast.OperationNode, statusCode: ast.StatusCode): string;
|
|
180
195
|
/**
|
|
181
196
|
* Resolves the name for an operation's grouped request options type (`Options`), the
|
|
182
197
|
* `{ body, path, query, headers, cookies }` bag passed to call an operation.
|
|
@@ -815,12 +830,16 @@ type EnumTypeNameProps = {
|
|
|
815
830
|
export declare function enumTypeName({ resolver, name, enumOptions, isEnum }: EnumTypeNameProps): string;
|
|
816
831
|
type BuildParamsSchemaOptions = {
|
|
817
832
|
params: Array<ast.ParameterNode>;
|
|
833
|
+
/**
|
|
834
|
+
* Adds each serialized example to `examples` as a `<caption>Serialized</caption>` JSDoc line.
|
|
835
|
+
* Leave it off when `examples` must hold values, such as for mocks.
|
|
836
|
+
*/
|
|
837
|
+
serializedExamples?: boolean;
|
|
818
838
|
};
|
|
819
839
|
/**
|
|
820
|
-
* Builds the object schema for
|
|
821
|
-
*
|
|
822
|
-
* separate per-param type — the group itself is the only type these params get exported as.
|
|
840
|
+
* Builds the object schema for one parameter group or a response's headers. Each entry embeds its own schema and JSDoc,
|
|
841
|
+
* so the group is the only type these entries are exported as.
|
|
823
842
|
*/
|
|
824
|
-
export declare function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
843
|
+
export declare function buildParams({ params, serializedExamples }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
825
844
|
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
|
826
845
|
//# sourceMappingURL=index.d.ts.map
|