@kubb/swagger-ts 2.0.0-beta.4 → 2.0.0-beta.5
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/components.cjs +13 -5
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +14 -5
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/TypeGenerator.ts +24 -5
- package/src/components/Mutation.tsx +1 -1
- package/src/components/Query.tsx +1 -2
package/dist/index.js
CHANGED
@@ -7,6 +7,7 @@ import { pluginName as pluginName$1, OasBuilder, OperationGenerator as Operation
|
|
7
7
|
import { createRoot, usePlugin, usePluginManager, File } from '@kubb/react';
|
8
8
|
import { print } from '@kubb/parser';
|
9
9
|
import * as factory from '@kubb/parser/factory';
|
10
|
+
import { keywordTypeNodes } from '@kubb/parser/factory';
|
10
11
|
import { useSchemas, useOas, useOperationFile, useOperationName, useOperation } from '@kubb/swagger/hooks';
|
11
12
|
import { refsSorter, isReference, getSchemaFactory } from '@kubb/swagger/utils';
|
12
13
|
|
@@ -58,9 +59,9 @@ var __privateMethod = (obj, member, method) => {
|
|
58
59
|
return method;
|
59
60
|
};
|
60
61
|
|
61
|
-
// ../../node_modules/.pnpm/tsup@8.0.
|
62
|
+
// ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js
|
62
63
|
var init_esm_shims = __esm({
|
63
|
-
"../../node_modules/.pnpm/tsup@8.0.
|
64
|
+
"../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js"() {
|
64
65
|
}
|
65
66
|
});
|
66
67
|
|
@@ -3424,6 +3425,17 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
3424
3425
|
if (schema.properties || schema.additionalProperties) {
|
3425
3426
|
return __privateMethod(this, _getTypeFromProperties, getTypeFromProperties_fn).call(this, schema, baseName);
|
3426
3427
|
}
|
3428
|
+
if (version === "3.1" && "const" in schema) {
|
3429
|
+
if (schema["const"]) {
|
3430
|
+
if (typeof schema["const"] === "string") {
|
3431
|
+
return factory.createLiteralTypeNode(factory.createStringLiteral(schema["const"]));
|
3432
|
+
} else if (typeof schema["const"] === "number") {
|
3433
|
+
return factory.createLiteralTypeNode(factory.createNumericLiteral(schema["const"]));
|
3434
|
+
}
|
3435
|
+
} else {
|
3436
|
+
return keywordTypeNodes.null;
|
3437
|
+
}
|
3438
|
+
}
|
3427
3439
|
if (schema.type) {
|
3428
3440
|
if (Array.isArray(schema.type)) {
|
3429
3441
|
const [type, nullable] = schema.type;
|
@@ -3450,9 +3462,6 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
3450
3462
|
if (schema.format === "binary") {
|
3451
3463
|
return factory.createTypeReferenceNode("Blob", []);
|
3452
3464
|
}
|
3453
|
-
if (version === "3.1" && typeof schema["const"] === "string") {
|
3454
|
-
return factory.createLiteralTypeNode(factory.createStringLiteral(schema["const"]));
|
3455
|
-
}
|
3456
3465
|
return factory.keywordTypeNodes.any;
|
3457
3466
|
};
|
3458
3467
|
|