@kubb/plugin-oas 3.0.0-alpha.15 → 3.0.0-alpha.16
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/{OperationGenerator-BqfyX5-8.d.cts → OperationGenerator-B5CoXmjA.d.cts} +22 -20
- package/dist/{OperationGenerator-BqfyX5-8.d.ts → OperationGenerator-B5CoXmjA.d.ts} +22 -20
- package/dist/{Schema-BgpIlA79.d.cts → Schema-BsgDay0E.d.cts} +1 -12
- package/dist/{Schema-ExMIJOhD.d.ts → Schema-Dvt6i_X3.d.ts} +1 -12
- package/dist/chunk-2QECZEUD.js +76 -0
- package/dist/chunk-2QECZEUD.js.map +1 -0
- package/dist/chunk-4OQEPWOG.js +38 -0
- package/dist/chunk-4OQEPWOG.js.map +1 -0
- package/dist/chunk-7Q5B67MW.cjs +1110 -0
- package/dist/chunk-7Q5B67MW.cjs.map +1 -0
- package/dist/chunk-7XBQZ7AX.js +1098 -0
- package/dist/chunk-7XBQZ7AX.js.map +1 -0
- package/dist/{chunk-AAIEMW6V.cjs → chunk-CQDZGAA6.cjs} +28 -798
- package/dist/chunk-CQDZGAA6.cjs.map +1 -0
- package/dist/{chunk-M3V3WMCW.js → chunk-CYF724QJ.js} +11 -773
- package/dist/chunk-CYF724QJ.js.map +1 -0
- package/dist/{chunk-PZTS5YZV.js → chunk-D2N6LDLT.js} +15 -13
- package/dist/chunk-D2N6LDLT.js.map +1 -0
- package/dist/{chunk-I3ZL3GUQ.cjs → chunk-LCPCIS3S.cjs} +19 -17
- package/dist/chunk-LCPCIS3S.cjs.map +1 -0
- package/dist/chunk-PUFCST25.cjs +84 -0
- package/dist/chunk-PUFCST25.cjs.map +1 -0
- package/dist/chunk-TYQZ2BD7.cjs +42 -0
- package/dist/chunk-TYQZ2BD7.cjs.map +1 -0
- package/dist/components.cjs +5 -6
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +2 -3
- package/dist/generators.cjs +4 -5
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +3 -4
- package/dist/hooks.cjs +102 -31
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +39 -6
- package/dist/hooks.d.ts +39 -6
- package/dist/hooks.js +92 -20
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +25 -410
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -400
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +12 -12
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -3
- package/dist/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/OperationGenerator.ts +11 -15
- package/src/SchemaGenerator.ts +14 -5
- package/src/components/Schema.tsx +1 -98
- package/src/generator.tsx +22 -14
- package/src/generators/jsonGenerator.ts +4 -4
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useOperationManager.ts +76 -29
- package/src/hooks/useSchemaManager.ts +76 -0
- package/src/utils/getParams.ts +1 -1
- package/dist/chunk-2PMRS7PB.cjs +0 -8
- package/dist/chunk-2PMRS7PB.cjs.map +0 -1
- package/dist/chunk-2V64GHQ4.js +0 -32
- package/dist/chunk-2V64GHQ4.js.map +0 -1
- package/dist/chunk-4JIFKRM5.js +0 -6
- package/dist/chunk-4JIFKRM5.js.map +0 -1
- package/dist/chunk-5ULY3TQB.cjs +0 -90
- package/dist/chunk-5ULY3TQB.cjs.map +0 -1
- package/dist/chunk-AAIEMW6V.cjs.map +0 -1
- package/dist/chunk-CFU6KMOB.cjs +0 -38
- package/dist/chunk-CFU6KMOB.cjs.map +0 -1
- package/dist/chunk-GAPWY2CE.js +0 -84
- package/dist/chunk-GAPWY2CE.js.map +0 -1
- package/dist/chunk-I3ZL3GUQ.cjs.map +0 -1
- package/dist/chunk-M3V3WMCW.js.map +0 -1
- package/dist/chunk-PZTS5YZV.js.map +0 -1
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { __commonJS, init_esm_shims, __toESM
|
|
2
|
-
import {
|
|
3
|
-
import transformers, { pascalCase } from '@kubb/core/transformers';
|
|
4
|
-
import { getUniqueName } from '@kubb/core/utils';
|
|
5
|
-
import { isReference } from '@kubb/oas';
|
|
6
|
-
import { uniqueWith, isDeepEqual, isNumber } from 'remeda';
|
|
7
|
-
import { createContext, useApp, File, useFile, useContext } from '@kubb/react';
|
|
1
|
+
import { __commonJS, init_esm_shims, __toESM } from './chunk-4OQEPWOG.js';
|
|
2
|
+
import { createContext } from '@kubb/react';
|
|
8
3
|
|
|
9
4
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
|
|
10
5
|
var require_react_production_min = __commonJS({
|
|
@@ -1323,7 +1318,7 @@ var require_react_development = __commonJS({
|
|
|
1323
1318
|
}
|
|
1324
1319
|
return dispatcher;
|
|
1325
1320
|
}
|
|
1326
|
-
function
|
|
1321
|
+
function useContext(Context) {
|
|
1327
1322
|
var dispatcher = resolveDispatcher();
|
|
1328
1323
|
{
|
|
1329
1324
|
if (Context._context !== void 0) {
|
|
@@ -2129,7 +2124,7 @@ var require_react_development = __commonJS({
|
|
|
2129
2124
|
exports.startTransition = startTransition;
|
|
2130
2125
|
exports.unstable_act = act;
|
|
2131
2126
|
exports.useCallback = useCallback;
|
|
2132
|
-
exports.useContext =
|
|
2127
|
+
exports.useContext = useContext;
|
|
2133
2128
|
exports.useDebugValue = useDebugValue;
|
|
2134
2129
|
exports.useDeferredValue = useDeferredValue;
|
|
2135
2130
|
exports.useEffect = useEffect;
|
|
@@ -3067,10 +3062,10 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
3067
3062
|
}
|
|
3068
3063
|
}
|
|
3069
3064
|
var jsx4 = jsxWithValidationDynamic;
|
|
3070
|
-
var
|
|
3065
|
+
var jsxs = jsxWithValidationStatic;
|
|
3071
3066
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
3072
3067
|
exports.jsx = jsx4;
|
|
3073
|
-
exports.jsxs =
|
|
3068
|
+
exports.jsxs = jsxs;
|
|
3074
3069
|
})();
|
|
3075
3070
|
}
|
|
3076
3071
|
}
|
|
@@ -3088,692 +3083,11 @@ var require_jsx_runtime = __commonJS({
|
|
|
3088
3083
|
}
|
|
3089
3084
|
});
|
|
3090
3085
|
|
|
3091
|
-
// src/
|
|
3086
|
+
// src/components/index.ts
|
|
3092
3087
|
init_esm_shims();
|
|
3093
|
-
var schemaKeywords = {
|
|
3094
|
-
any: "any",
|
|
3095
|
-
strict: "strict",
|
|
3096
|
-
unknown: "unknown",
|
|
3097
|
-
number: "number",
|
|
3098
|
-
integer: "integer",
|
|
3099
|
-
string: "string",
|
|
3100
|
-
boolean: "boolean",
|
|
3101
|
-
undefined: "undefined",
|
|
3102
|
-
nullable: "nullable",
|
|
3103
|
-
null: "null",
|
|
3104
|
-
nullish: "nullish",
|
|
3105
|
-
array: "array",
|
|
3106
|
-
tuple: "tuple",
|
|
3107
|
-
enum: "enum",
|
|
3108
|
-
union: "union",
|
|
3109
|
-
datetime: "datetime",
|
|
3110
|
-
date: "date",
|
|
3111
|
-
email: "email",
|
|
3112
|
-
uuid: "uuid",
|
|
3113
|
-
url: "url",
|
|
3114
|
-
/* intersection */
|
|
3115
|
-
default: "default",
|
|
3116
|
-
const: "const",
|
|
3117
|
-
and: "and",
|
|
3118
|
-
describe: "describe",
|
|
3119
|
-
min: "min",
|
|
3120
|
-
max: "max",
|
|
3121
|
-
optional: "optional",
|
|
3122
|
-
readOnly: "readOnly",
|
|
3123
|
-
// custom ones
|
|
3124
|
-
object: "object",
|
|
3125
|
-
ref: "ref",
|
|
3126
|
-
matches: "matches",
|
|
3127
|
-
firstName: "firstName",
|
|
3128
|
-
lastName: "lastName",
|
|
3129
|
-
password: "password",
|
|
3130
|
-
phone: "phone",
|
|
3131
|
-
blob: "blob",
|
|
3132
|
-
deprecated: "deprecated",
|
|
3133
|
-
example: "example",
|
|
3134
|
-
schema: "schema",
|
|
3135
|
-
catchall: "catchall",
|
|
3136
|
-
time: "time",
|
|
3137
|
-
name: "name"
|
|
3138
|
-
};
|
|
3139
|
-
function isKeyword(meta, keyword) {
|
|
3140
|
-
return meta.keyword === keyword;
|
|
3141
|
-
}
|
|
3142
3088
|
|
|
3143
|
-
// src/
|
|
3089
|
+
// src/components/Oas.tsx
|
|
3144
3090
|
init_esm_shims();
|
|
3145
|
-
var SchemaGenerator = class _SchemaGenerator extends BaseGenerator {
|
|
3146
|
-
// Collect the types of all referenced schemas, so we can export them later
|
|
3147
|
-
refs = {};
|
|
3148
|
-
// Keep track of already used type aliases
|
|
3149
|
-
#usedAliasNames = {};
|
|
3150
|
-
/**
|
|
3151
|
-
* Creates a type node from a given schema.
|
|
3152
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
3153
|
-
* optionally adds a union with null.
|
|
3154
|
-
*/
|
|
3155
|
-
parse(props) {
|
|
3156
|
-
const options = this.#getOptions(props);
|
|
3157
|
-
const defaultSchemas = this.#parseSchemaObject(props);
|
|
3158
|
-
const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || [];
|
|
3159
|
-
return uniqueWith(schemas, isDeepEqual);
|
|
3160
|
-
}
|
|
3161
|
-
deepSearch(tree, keyword) {
|
|
3162
|
-
return _SchemaGenerator.deepSearch(tree, keyword);
|
|
3163
|
-
}
|
|
3164
|
-
find(tree, keyword) {
|
|
3165
|
-
return _SchemaGenerator.find(tree, keyword);
|
|
3166
|
-
}
|
|
3167
|
-
static deepSearch(tree, keyword) {
|
|
3168
|
-
const foundItems = [];
|
|
3169
|
-
tree?.forEach((schema) => {
|
|
3170
|
-
if (schema.keyword === keyword) {
|
|
3171
|
-
foundItems.push(schema);
|
|
3172
|
-
}
|
|
3173
|
-
if (schema.keyword === schemaKeywords.object) {
|
|
3174
|
-
const subItem = schema;
|
|
3175
|
-
Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
|
|
3176
|
-
foundItems.push(..._SchemaGenerator.deepSearch(entrySchema, keyword));
|
|
3177
|
-
});
|
|
3178
|
-
Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {
|
|
3179
|
-
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
3180
|
-
});
|
|
3181
|
-
}
|
|
3182
|
-
if (schema.keyword === schemaKeywords.array) {
|
|
3183
|
-
const subItem = schema;
|
|
3184
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
3185
|
-
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
3186
|
-
});
|
|
3187
|
-
}
|
|
3188
|
-
if (schema.keyword === schemaKeywords.and) {
|
|
3189
|
-
const subItem = schema;
|
|
3190
|
-
subItem.args.forEach((entrySchema) => {
|
|
3191
|
-
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
3192
|
-
});
|
|
3193
|
-
}
|
|
3194
|
-
if (schema.keyword === schemaKeywords.tuple) {
|
|
3195
|
-
const subItem = schema;
|
|
3196
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
3197
|
-
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
|
-
if (schema.keyword === schemaKeywords.union) {
|
|
3201
|
-
const subItem = schema;
|
|
3202
|
-
subItem.args.forEach((entrySchema) => {
|
|
3203
|
-
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
});
|
|
3207
|
-
return foundItems;
|
|
3208
|
-
}
|
|
3209
|
-
static findInObject(tree, keyword) {
|
|
3210
|
-
let foundItem = void 0;
|
|
3211
|
-
tree?.forEach((schema) => {
|
|
3212
|
-
if (!foundItem && schema.keyword === keyword) {
|
|
3213
|
-
foundItem = schema;
|
|
3214
|
-
}
|
|
3215
|
-
if (schema.keyword === schemaKeywords.object) {
|
|
3216
|
-
const subItem = schema;
|
|
3217
|
-
Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
|
|
3218
|
-
if (!foundItem) {
|
|
3219
|
-
foundItem = _SchemaGenerator.find(entrySchema, keyword);
|
|
3220
|
-
}
|
|
3221
|
-
});
|
|
3222
|
-
Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {
|
|
3223
|
-
if (!foundItem) {
|
|
3224
|
-
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
3225
|
-
}
|
|
3226
|
-
});
|
|
3227
|
-
}
|
|
3228
|
-
});
|
|
3229
|
-
return foundItem;
|
|
3230
|
-
}
|
|
3231
|
-
static find(tree, keyword) {
|
|
3232
|
-
let foundItem = void 0;
|
|
3233
|
-
tree?.forEach((schema) => {
|
|
3234
|
-
if (!foundItem && schema.keyword === keyword) {
|
|
3235
|
-
foundItem = schema;
|
|
3236
|
-
}
|
|
3237
|
-
if (schema.keyword === schemaKeywords.array) {
|
|
3238
|
-
const subItem = schema;
|
|
3239
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
3240
|
-
if (!foundItem) {
|
|
3241
|
-
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
3242
|
-
}
|
|
3243
|
-
});
|
|
3244
|
-
}
|
|
3245
|
-
if (schema.keyword === schemaKeywords.and) {
|
|
3246
|
-
const subItem = schema;
|
|
3247
|
-
subItem.args.forEach((entrySchema) => {
|
|
3248
|
-
if (!foundItem) {
|
|
3249
|
-
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
3250
|
-
}
|
|
3251
|
-
});
|
|
3252
|
-
}
|
|
3253
|
-
if (schema.keyword === schemaKeywords.tuple) {
|
|
3254
|
-
const subItem = schema;
|
|
3255
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
3256
|
-
if (!foundItem) {
|
|
3257
|
-
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
3258
|
-
}
|
|
3259
|
-
});
|
|
3260
|
-
}
|
|
3261
|
-
if (schema.keyword === schemaKeywords.union) {
|
|
3262
|
-
const subItem = schema;
|
|
3263
|
-
subItem.args.forEach((entrySchema) => {
|
|
3264
|
-
if (!foundItem) {
|
|
3265
|
-
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
3266
|
-
}
|
|
3267
|
-
});
|
|
3268
|
-
}
|
|
3269
|
-
});
|
|
3270
|
-
return foundItem;
|
|
3271
|
-
}
|
|
3272
|
-
#getUsedEnumNames(props) {
|
|
3273
|
-
const options = this.#getOptions(props);
|
|
3274
|
-
return options.usedEnumNames || {};
|
|
3275
|
-
}
|
|
3276
|
-
#getOptions({ name }) {
|
|
3277
|
-
const { override = [] } = this.context;
|
|
3278
|
-
return {
|
|
3279
|
-
...this.options,
|
|
3280
|
-
...override.find(({ pattern, type }) => {
|
|
3281
|
-
if (name && type === "schemaName") {
|
|
3282
|
-
return !!name.match(pattern);
|
|
3283
|
-
}
|
|
3284
|
-
return false;
|
|
3285
|
-
})?.options || {}
|
|
3286
|
-
};
|
|
3287
|
-
}
|
|
3288
|
-
#getUnknownReturn(props) {
|
|
3289
|
-
const options = this.#getOptions(props);
|
|
3290
|
-
if (options.unknownType === "any") {
|
|
3291
|
-
return schemaKeywords.any;
|
|
3292
|
-
}
|
|
3293
|
-
return schemaKeywords.unknown;
|
|
3294
|
-
}
|
|
3295
|
-
/**
|
|
3296
|
-
* Recursively creates a type literal with the given props.
|
|
3297
|
-
*/
|
|
3298
|
-
#parseProperties({ schema, name }) {
|
|
3299
|
-
const properties = schema?.properties || {};
|
|
3300
|
-
const additionalProperties = schema?.additionalProperties;
|
|
3301
|
-
const required = schema?.required;
|
|
3302
|
-
const propertiesSchemas = Object.keys(properties).map((propertyName) => {
|
|
3303
|
-
const validationFunctions = [];
|
|
3304
|
-
const propertySchema = properties[propertyName];
|
|
3305
|
-
const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required;
|
|
3306
|
-
const nullable = propertySchema.nullable ?? propertySchema["x-nullable"] ?? false;
|
|
3307
|
-
validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }));
|
|
3308
|
-
validationFunctions.push({
|
|
3309
|
-
keyword: schemaKeywords.name,
|
|
3310
|
-
args: propertyName
|
|
3311
|
-
});
|
|
3312
|
-
if (!isRequired && nullable) {
|
|
3313
|
-
validationFunctions.push({ keyword: schemaKeywords.nullish });
|
|
3314
|
-
} else if (!isRequired) {
|
|
3315
|
-
validationFunctions.push({ keyword: schemaKeywords.optional });
|
|
3316
|
-
}
|
|
3317
|
-
return {
|
|
3318
|
-
[propertyName]: validationFunctions
|
|
3319
|
-
};
|
|
3320
|
-
}).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
3321
|
-
let additionalPropertiesSchemas = [];
|
|
3322
|
-
if (additionalProperties) {
|
|
3323
|
-
additionalPropertiesSchemas = additionalProperties === true ? [{ keyword: this.#getUnknownReturn({ schema, name }) }] : this.parse({ schema: additionalProperties, parentName: name });
|
|
3324
|
-
}
|
|
3325
|
-
return [
|
|
3326
|
-
{
|
|
3327
|
-
keyword: schemaKeywords.object,
|
|
3328
|
-
args: {
|
|
3329
|
-
properties: propertiesSchemas,
|
|
3330
|
-
additionalProperties: additionalPropertiesSchemas
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
];
|
|
3334
|
-
}
|
|
3335
|
-
/**
|
|
3336
|
-
* Create a type alias for the schema referenced by the given ReferenceObject
|
|
3337
|
-
*/
|
|
3338
|
-
#getRefAlias(obj) {
|
|
3339
|
-
const { $ref } = obj;
|
|
3340
|
-
let ref = this.refs[$ref];
|
|
3341
|
-
const originalName = getUniqueName($ref.replace(/.+\//, ""), this.#usedAliasNames);
|
|
3342
|
-
const propertyName = this.context.pluginManager.resolveName({
|
|
3343
|
-
name: originalName,
|
|
3344
|
-
pluginKey: this.context.plugin.key,
|
|
3345
|
-
type: "function"
|
|
3346
|
-
});
|
|
3347
|
-
if (ref) {
|
|
3348
|
-
return [
|
|
3349
|
-
{
|
|
3350
|
-
keyword: schemaKeywords.ref,
|
|
3351
|
-
args: { name: ref.propertyName, path: ref.path }
|
|
3352
|
-
}
|
|
3353
|
-
];
|
|
3354
|
-
}
|
|
3355
|
-
const fileName = this.context.pluginManager.resolveName({
|
|
3356
|
-
name: originalName,
|
|
3357
|
-
pluginKey: this.context.plugin.key,
|
|
3358
|
-
type: "file"
|
|
3359
|
-
});
|
|
3360
|
-
const file = this.context.pluginManager.getFile({
|
|
3361
|
-
name: fileName,
|
|
3362
|
-
pluginKey: this.context.plugin.key,
|
|
3363
|
-
extName: ".ts"
|
|
3364
|
-
});
|
|
3365
|
-
ref = this.refs[$ref] = {
|
|
3366
|
-
propertyName,
|
|
3367
|
-
originalName,
|
|
3368
|
-
path: file.path
|
|
3369
|
-
};
|
|
3370
|
-
return [
|
|
3371
|
-
{
|
|
3372
|
-
keyword: schemaKeywords.ref,
|
|
3373
|
-
args: { name: ref.propertyName, path: ref?.path }
|
|
3374
|
-
}
|
|
3375
|
-
];
|
|
3376
|
-
}
|
|
3377
|
-
#getParsedSchemaObject(schema) {
|
|
3378
|
-
const parsedSchema = getSchemaFactory(this.context.oas)(schema);
|
|
3379
|
-
return parsedSchema;
|
|
3380
|
-
}
|
|
3381
|
-
/**
|
|
3382
|
-
* This is the very core of the OpenAPI to TS conversion - it takes a
|
|
3383
|
-
* schema and returns the appropriate type.
|
|
3384
|
-
*/
|
|
3385
|
-
#parseSchemaObject({ schema: _schema, name, parentName }) {
|
|
3386
|
-
const options = this.#getOptions({ schema: _schema, name });
|
|
3387
|
-
const unknownReturn = this.#getUnknownReturn({ schema: _schema, name });
|
|
3388
|
-
const { schema, version } = this.#getParsedSchemaObject(_schema);
|
|
3389
|
-
if (!schema) {
|
|
3390
|
-
return [{ keyword: unknownReturn }];
|
|
3391
|
-
}
|
|
3392
|
-
const baseItems = [
|
|
3393
|
-
{
|
|
3394
|
-
keyword: schemaKeywords.schema,
|
|
3395
|
-
args: {
|
|
3396
|
-
type: schema.type,
|
|
3397
|
-
format: schema.format
|
|
3398
|
-
}
|
|
3399
|
-
}
|
|
3400
|
-
];
|
|
3401
|
-
const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
|
|
3402
|
-
const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
|
|
3403
|
-
const nullable = schema.nullable ?? schema["x-nullable"] ?? false;
|
|
3404
|
-
if (schema.default !== void 0 && !Array.isArray(schema.default)) {
|
|
3405
|
-
if (typeof schema.default === "string") {
|
|
3406
|
-
baseItems.push({
|
|
3407
|
-
keyword: schemaKeywords.default,
|
|
3408
|
-
args: transformers.stringify(schema.default)
|
|
3409
|
-
});
|
|
3410
|
-
} else if (typeof schema.default === "boolean") {
|
|
3411
|
-
baseItems.push({
|
|
3412
|
-
keyword: schemaKeywords.default,
|
|
3413
|
-
args: schema.default ?? false
|
|
3414
|
-
});
|
|
3415
|
-
} else {
|
|
3416
|
-
baseItems.push({
|
|
3417
|
-
keyword: schemaKeywords.default,
|
|
3418
|
-
args: schema.default
|
|
3419
|
-
});
|
|
3420
|
-
}
|
|
3421
|
-
}
|
|
3422
|
-
if (schema.description) {
|
|
3423
|
-
baseItems.push({
|
|
3424
|
-
keyword: schemaKeywords.describe,
|
|
3425
|
-
args: schema.description
|
|
3426
|
-
});
|
|
3427
|
-
}
|
|
3428
|
-
if (schema.pattern) {
|
|
3429
|
-
baseItems.unshift({
|
|
3430
|
-
keyword: schemaKeywords.matches,
|
|
3431
|
-
args: schema.pattern
|
|
3432
|
-
});
|
|
3433
|
-
}
|
|
3434
|
-
if (max !== void 0) {
|
|
3435
|
-
baseItems.unshift({ keyword: schemaKeywords.max, args: max });
|
|
3436
|
-
}
|
|
3437
|
-
if (min !== void 0) {
|
|
3438
|
-
baseItems.unshift({ keyword: schemaKeywords.min, args: min });
|
|
3439
|
-
}
|
|
3440
|
-
if (nullable) {
|
|
3441
|
-
baseItems.push({ keyword: schemaKeywords.nullable });
|
|
3442
|
-
}
|
|
3443
|
-
if (schema.type && Array.isArray(schema.type)) {
|
|
3444
|
-
const [_schema2, nullable2] = schema.type;
|
|
3445
|
-
if (nullable2 === "null") {
|
|
3446
|
-
baseItems.push({ keyword: schemaKeywords.nullable });
|
|
3447
|
-
}
|
|
3448
|
-
}
|
|
3449
|
-
if (schema.readOnly) {
|
|
3450
|
-
baseItems.push({ keyword: schemaKeywords.readOnly });
|
|
3451
|
-
}
|
|
3452
|
-
if (isReference(schema)) {
|
|
3453
|
-
return [
|
|
3454
|
-
...this.#getRefAlias(schema),
|
|
3455
|
-
nullable && { keyword: schemaKeywords.nullable },
|
|
3456
|
-
{
|
|
3457
|
-
keyword: schemaKeywords.schema,
|
|
3458
|
-
args: {
|
|
3459
|
-
type: schema.type,
|
|
3460
|
-
format: schema.format
|
|
3461
|
-
}
|
|
3462
|
-
}
|
|
3463
|
-
].filter(Boolean);
|
|
3464
|
-
}
|
|
3465
|
-
if (schema.oneOf) {
|
|
3466
|
-
const schemaWithoutOneOf = { ...schema, oneOf: void 0 };
|
|
3467
|
-
const union = {
|
|
3468
|
-
keyword: schemaKeywords.union,
|
|
3469
|
-
args: schema.oneOf.map((item) => {
|
|
3470
|
-
return item && this.parse({ schema: item, name, parentName })[0];
|
|
3471
|
-
}).filter(Boolean).filter((item) => {
|
|
3472
|
-
return item && item.keyword !== unknownReturn;
|
|
3473
|
-
})
|
|
3474
|
-
};
|
|
3475
|
-
if (schemaWithoutOneOf.properties) {
|
|
3476
|
-
return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems];
|
|
3477
|
-
}
|
|
3478
|
-
return [union, ...baseItems];
|
|
3479
|
-
}
|
|
3480
|
-
if (schema.anyOf) {
|
|
3481
|
-
const schemaWithoutAnyOf = { ...schema, anyOf: void 0 };
|
|
3482
|
-
const union = {
|
|
3483
|
-
keyword: schemaKeywords.union,
|
|
3484
|
-
args: schema.anyOf.map((item) => {
|
|
3485
|
-
return item && this.parse({ schema: item, name, parentName })[0];
|
|
3486
|
-
}).filter(Boolean).filter((item) => {
|
|
3487
|
-
return item && item.keyword !== unknownReturn;
|
|
3488
|
-
}).map((item) => {
|
|
3489
|
-
if (isKeyword(item, schemaKeywords.object)) {
|
|
3490
|
-
return {
|
|
3491
|
-
...item,
|
|
3492
|
-
args: {
|
|
3493
|
-
...item.args,
|
|
3494
|
-
strict: true
|
|
3495
|
-
}
|
|
3496
|
-
};
|
|
3497
|
-
}
|
|
3498
|
-
return item;
|
|
3499
|
-
})
|
|
3500
|
-
};
|
|
3501
|
-
if (schemaWithoutAnyOf.properties) {
|
|
3502
|
-
return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems];
|
|
3503
|
-
}
|
|
3504
|
-
return [union, ...baseItems];
|
|
3505
|
-
}
|
|
3506
|
-
if (schema.allOf) {
|
|
3507
|
-
const schemaWithoutAllOf = { ...schema, allOf: void 0 };
|
|
3508
|
-
const and = {
|
|
3509
|
-
keyword: schemaKeywords.and,
|
|
3510
|
-
args: schema.allOf.map((item) => {
|
|
3511
|
-
return item && this.parse({ schema: item, name, parentName })[0];
|
|
3512
|
-
}).filter(Boolean).filter((item) => {
|
|
3513
|
-
return item && item.keyword !== unknownReturn;
|
|
3514
|
-
})
|
|
3515
|
-
};
|
|
3516
|
-
if (schemaWithoutAllOf.properties) {
|
|
3517
|
-
return [
|
|
3518
|
-
{
|
|
3519
|
-
...and,
|
|
3520
|
-
args: [...and.args || [], ...this.parse({ schema: schemaWithoutAllOf, name, parentName })]
|
|
3521
|
-
},
|
|
3522
|
-
...baseItems
|
|
3523
|
-
];
|
|
3524
|
-
}
|
|
3525
|
-
return [and, ...baseItems];
|
|
3526
|
-
}
|
|
3527
|
-
if (schema.enum) {
|
|
3528
|
-
const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(" ")), this.#getUsedEnumNames({ schema, name }));
|
|
3529
|
-
const typeName = this.context.pluginManager.resolveName({
|
|
3530
|
-
name: enumName,
|
|
3531
|
-
pluginKey: this.context.plugin.key,
|
|
3532
|
-
type: "type"
|
|
3533
|
-
});
|
|
3534
|
-
const nullableEnum = schema.enum.includes(null);
|
|
3535
|
-
if (nullableEnum) {
|
|
3536
|
-
baseItems.push({ keyword: schemaKeywords.nullable });
|
|
3537
|
-
}
|
|
3538
|
-
const filteredValues = schema.enum.filter((value) => value !== null);
|
|
3539
|
-
const extensionEnums = ["x-enumNames", "x-enum-varnames"].filter((extensionKey) => extensionKey in schema).map((extensionKey) => {
|
|
3540
|
-
return [
|
|
3541
|
-
{
|
|
3542
|
-
keyword: schemaKeywords.enum,
|
|
3543
|
-
args: {
|
|
3544
|
-
name,
|
|
3545
|
-
typeName,
|
|
3546
|
-
asConst: false,
|
|
3547
|
-
items: [...new Set(schema[extensionKey])].map((name2, index) => ({
|
|
3548
|
-
name: transformers.stringify(name2),
|
|
3549
|
-
value: schema.enum?.[index],
|
|
3550
|
-
format: isNumber(schema.enum?.[index]) ? "number" : "string"
|
|
3551
|
-
}))
|
|
3552
|
-
}
|
|
3553
|
-
},
|
|
3554
|
-
...baseItems.filter(
|
|
3555
|
-
(item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches
|
|
3556
|
-
)
|
|
3557
|
-
];
|
|
3558
|
-
});
|
|
3559
|
-
if (schema.type === "number" || schema.type === "integer") {
|
|
3560
|
-
const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum));
|
|
3561
|
-
return [
|
|
3562
|
-
{
|
|
3563
|
-
keyword: schemaKeywords.enum,
|
|
3564
|
-
args: {
|
|
3565
|
-
name: enumName,
|
|
3566
|
-
typeName,
|
|
3567
|
-
asConst: true,
|
|
3568
|
-
items: enumNames?.args?.items ? [...new Set(enumNames.args.items)].map(({ name: name2, value }) => ({
|
|
3569
|
-
name: name2,
|
|
3570
|
-
value,
|
|
3571
|
-
format: "number"
|
|
3572
|
-
})) : [...new Set(filteredValues)].map((value) => {
|
|
3573
|
-
return {
|
|
3574
|
-
name: value,
|
|
3575
|
-
value,
|
|
3576
|
-
format: "number"
|
|
3577
|
-
};
|
|
3578
|
-
})
|
|
3579
|
-
}
|
|
3580
|
-
},
|
|
3581
|
-
...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches)
|
|
3582
|
-
];
|
|
3583
|
-
}
|
|
3584
|
-
if (extensionEnums.length > 0 && extensionEnums[0]) {
|
|
3585
|
-
return extensionEnums[0];
|
|
3586
|
-
}
|
|
3587
|
-
return [
|
|
3588
|
-
{
|
|
3589
|
-
keyword: schemaKeywords.enum,
|
|
3590
|
-
args: {
|
|
3591
|
-
name: enumName,
|
|
3592
|
-
typeName,
|
|
3593
|
-
asConst: false,
|
|
3594
|
-
items: [...new Set(filteredValues)].map((value) => ({
|
|
3595
|
-
name: transformers.stringify(value),
|
|
3596
|
-
value,
|
|
3597
|
-
format: isNumber(value) ? "number" : "string"
|
|
3598
|
-
}))
|
|
3599
|
-
}
|
|
3600
|
-
},
|
|
3601
|
-
...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches)
|
|
3602
|
-
];
|
|
3603
|
-
}
|
|
3604
|
-
if ("prefixItems" in schema) {
|
|
3605
|
-
const prefixItems = schema.prefixItems;
|
|
3606
|
-
const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
|
|
3607
|
-
const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
|
|
3608
|
-
return [
|
|
3609
|
-
{
|
|
3610
|
-
keyword: schemaKeywords.tuple,
|
|
3611
|
-
args: {
|
|
3612
|
-
min: min2,
|
|
3613
|
-
max: max2,
|
|
3614
|
-
items: prefixItems.map((item) => {
|
|
3615
|
-
return this.parse({ schema: item, name, parentName })[0];
|
|
3616
|
-
}).filter(Boolean)
|
|
3617
|
-
}
|
|
3618
|
-
},
|
|
3619
|
-
...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max)
|
|
3620
|
-
];
|
|
3621
|
-
}
|
|
3622
|
-
if (version === "3.1" && "const" in schema) {
|
|
3623
|
-
if (schema["const"]) {
|
|
3624
|
-
return [
|
|
3625
|
-
{
|
|
3626
|
-
keyword: schemaKeywords.const,
|
|
3627
|
-
args: {
|
|
3628
|
-
name: schema["const"],
|
|
3629
|
-
format: typeof schema["const"] === "number" ? "number" : "string",
|
|
3630
|
-
value: schema["const"]
|
|
3631
|
-
}
|
|
3632
|
-
},
|
|
3633
|
-
...baseItems
|
|
3634
|
-
];
|
|
3635
|
-
}
|
|
3636
|
-
return [{ keyword: schemaKeywords.null }];
|
|
3637
|
-
}
|
|
3638
|
-
if (schema.format) {
|
|
3639
|
-
switch (schema.format) {
|
|
3640
|
-
case "binary":
|
|
3641
|
-
baseItems.push({ keyword: schemaKeywords.blob });
|
|
3642
|
-
return baseItems;
|
|
3643
|
-
case "date-time":
|
|
3644
|
-
if (options.dateType) {
|
|
3645
|
-
if (options.dateType === "date") {
|
|
3646
|
-
baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "date" } });
|
|
3647
|
-
return baseItems;
|
|
3648
|
-
}
|
|
3649
|
-
if (options.dateType === "stringOffset") {
|
|
3650
|
-
baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } });
|
|
3651
|
-
return baseItems;
|
|
3652
|
-
}
|
|
3653
|
-
if (options.dateType === "stringLocal") {
|
|
3654
|
-
baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } });
|
|
3655
|
-
return baseItems;
|
|
3656
|
-
}
|
|
3657
|
-
baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } });
|
|
3658
|
-
return baseItems;
|
|
3659
|
-
}
|
|
3660
|
-
break;
|
|
3661
|
-
case "date":
|
|
3662
|
-
if (options.dateType) {
|
|
3663
|
-
if (options.dateType === "date") {
|
|
3664
|
-
baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "date" } });
|
|
3665
|
-
return baseItems;
|
|
3666
|
-
}
|
|
3667
|
-
baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "string" } });
|
|
3668
|
-
return baseItems;
|
|
3669
|
-
}
|
|
3670
|
-
break;
|
|
3671
|
-
case "time":
|
|
3672
|
-
if (options.dateType) {
|
|
3673
|
-
if (options.dateType === "date") {
|
|
3674
|
-
baseItems.unshift({ keyword: schemaKeywords.time, args: { type: "date" } });
|
|
3675
|
-
return baseItems;
|
|
3676
|
-
}
|
|
3677
|
-
baseItems.unshift({ keyword: schemaKeywords.time, args: { type: "string" } });
|
|
3678
|
-
return baseItems;
|
|
3679
|
-
}
|
|
3680
|
-
break;
|
|
3681
|
-
case "uuid":
|
|
3682
|
-
baseItems.unshift({ keyword: schemaKeywords.uuid });
|
|
3683
|
-
break;
|
|
3684
|
-
case "email":
|
|
3685
|
-
case "idn-email":
|
|
3686
|
-
baseItems.unshift({ keyword: schemaKeywords.email });
|
|
3687
|
-
break;
|
|
3688
|
-
case "uri":
|
|
3689
|
-
case "ipv4":
|
|
3690
|
-
case "ipv6":
|
|
3691
|
-
case "uri-reference":
|
|
3692
|
-
case "hostname":
|
|
3693
|
-
case "idn-hostname":
|
|
3694
|
-
baseItems.unshift({ keyword: schemaKeywords.url });
|
|
3695
|
-
break;
|
|
3696
|
-
}
|
|
3697
|
-
}
|
|
3698
|
-
if ("items" in schema || schema.type === "array") {
|
|
3699
|
-
const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
|
|
3700
|
-
const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
|
|
3701
|
-
const items = this.parse({ schema: "items" in schema ? schema.items : [], name, parentName });
|
|
3702
|
-
return [
|
|
3703
|
-
{
|
|
3704
|
-
keyword: schemaKeywords.array,
|
|
3705
|
-
args: {
|
|
3706
|
-
items,
|
|
3707
|
-
min: min2,
|
|
3708
|
-
max: max2
|
|
3709
|
-
}
|
|
3710
|
-
},
|
|
3711
|
-
...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max)
|
|
3712
|
-
];
|
|
3713
|
-
}
|
|
3714
|
-
if (schema.properties || schema.additionalProperties) {
|
|
3715
|
-
return [...this.#parseProperties({ schema, name }), ...baseItems];
|
|
3716
|
-
}
|
|
3717
|
-
if (schema.type) {
|
|
3718
|
-
if (Array.isArray(schema.type)) {
|
|
3719
|
-
const [type] = schema.type;
|
|
3720
|
-
return [
|
|
3721
|
-
...this.parse({
|
|
3722
|
-
schema: {
|
|
3723
|
-
...schema,
|
|
3724
|
-
type
|
|
3725
|
-
},
|
|
3726
|
-
name,
|
|
3727
|
-
parentName
|
|
3728
|
-
}),
|
|
3729
|
-
...baseItems
|
|
3730
|
-
].filter(Boolean);
|
|
3731
|
-
}
|
|
3732
|
-
if (!["boolean", "object", "number", "string", "integer"].includes(schema.type)) {
|
|
3733
|
-
this.context.pluginManager.logger.emit("warning", `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`);
|
|
3734
|
-
}
|
|
3735
|
-
return [{ keyword: schema.type }, ...baseItems];
|
|
3736
|
-
}
|
|
3737
|
-
return [{ keyword: unknownReturn }];
|
|
3738
|
-
}
|
|
3739
|
-
async build(...generators) {
|
|
3740
|
-
const { oas, contentType, include } = this.context;
|
|
3741
|
-
const schemas = getSchemas({ oas, contentType, includes: include });
|
|
3742
|
-
const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {
|
|
3743
|
-
const options = this.#getOptions({ name });
|
|
3744
|
-
const promiseOperation = this.schema.call(this, name, schema, {
|
|
3745
|
-
...this.options,
|
|
3746
|
-
...options
|
|
3747
|
-
});
|
|
3748
|
-
if (promiseOperation) {
|
|
3749
|
-
acc.push(promiseOperation);
|
|
3750
|
-
}
|
|
3751
|
-
generators?.forEach((generator) => {
|
|
3752
|
-
const promise = generator.schema?.({
|
|
3753
|
-
instance: this,
|
|
3754
|
-
name,
|
|
3755
|
-
schema,
|
|
3756
|
-
options: {
|
|
3757
|
-
...this.options,
|
|
3758
|
-
...options
|
|
3759
|
-
}
|
|
3760
|
-
});
|
|
3761
|
-
if (promise) {
|
|
3762
|
-
acc.push(promise);
|
|
3763
|
-
}
|
|
3764
|
-
});
|
|
3765
|
-
return acc;
|
|
3766
|
-
}, []);
|
|
3767
|
-
const files = await Promise.all(promises);
|
|
3768
|
-
return files.flat().filter(Boolean);
|
|
3769
|
-
}
|
|
3770
|
-
/**
|
|
3771
|
-
* Schema
|
|
3772
|
-
*/
|
|
3773
|
-
async schema(name, object, options) {
|
|
3774
|
-
return [];
|
|
3775
|
-
}
|
|
3776
|
-
};
|
|
3777
3091
|
|
|
3778
3092
|
// src/components/Operation.tsx
|
|
3779
3093
|
init_esm_shims();
|
|
@@ -3784,9 +3098,6 @@ function Operation({ operation, children }) {
|
|
|
3784
3098
|
}
|
|
3785
3099
|
Operation.Context = OperationContext;
|
|
3786
3100
|
|
|
3787
|
-
// src/hooks/useSchema.ts
|
|
3788
|
-
init_esm_shims();
|
|
3789
|
-
|
|
3790
3101
|
// src/components/Schema.tsx
|
|
3791
3102
|
init_esm_shims();
|
|
3792
3103
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -3797,82 +3108,9 @@ var SchemaContext = createContext({
|
|
|
3797
3108
|
function Schema({ name, value, tree = [], children }) {
|
|
3798
3109
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SchemaContext.Provider, { value: { name, schema: value, tree }, children });
|
|
3799
3110
|
}
|
|
3800
|
-
Schema.File = function({ isTypeOnly, children }) {
|
|
3801
|
-
const { plugin, pluginManager, mode } = useApp();
|
|
3802
|
-
const { name } = useSchema();
|
|
3803
|
-
if (mode === "single") {
|
|
3804
|
-
const baseName2 = `${pluginManager.resolveName({
|
|
3805
|
-
name,
|
|
3806
|
-
pluginKey: plugin.key,
|
|
3807
|
-
type: "file"
|
|
3808
|
-
})}.ts`;
|
|
3809
|
-
const resolvedPath2 = pluginManager.resolvePath({
|
|
3810
|
-
baseName: "",
|
|
3811
|
-
pluginKey: plugin.key
|
|
3812
|
-
});
|
|
3813
|
-
if (!resolvedPath2) {
|
|
3814
|
-
return null;
|
|
3815
|
-
}
|
|
3816
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3817
|
-
File,
|
|
3818
|
-
{
|
|
3819
|
-
baseName: baseName2,
|
|
3820
|
-
path: resolvedPath2,
|
|
3821
|
-
meta: {
|
|
3822
|
-
pluginKey: plugin.key
|
|
3823
|
-
},
|
|
3824
|
-
children
|
|
3825
|
-
}
|
|
3826
|
-
);
|
|
3827
|
-
}
|
|
3828
|
-
const baseName = `${pluginManager.resolveName({
|
|
3829
|
-
name,
|
|
3830
|
-
pluginKey: plugin.key,
|
|
3831
|
-
type: "file"
|
|
3832
|
-
})}.ts`;
|
|
3833
|
-
const resolvedPath = pluginManager.resolvePath({
|
|
3834
|
-
baseName,
|
|
3835
|
-
pluginKey: plugin.key
|
|
3836
|
-
});
|
|
3837
|
-
if (!resolvedPath) {
|
|
3838
|
-
return null;
|
|
3839
|
-
}
|
|
3840
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3841
|
-
File,
|
|
3842
|
-
{
|
|
3843
|
-
baseName,
|
|
3844
|
-
path: resolvedPath,
|
|
3845
|
-
meta: {
|
|
3846
|
-
pluginKey: plugin.key
|
|
3847
|
-
},
|
|
3848
|
-
children: [
|
|
3849
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Schema.Imports, { isTypeOnly }),
|
|
3850
|
-
children
|
|
3851
|
-
]
|
|
3852
|
-
}
|
|
3853
|
-
);
|
|
3854
|
-
};
|
|
3855
|
-
Schema.Imports = ({ isTypeOnly }) => {
|
|
3856
|
-
const { tree } = useSchema();
|
|
3857
|
-
const { path: root } = useFile();
|
|
3858
|
-
const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref);
|
|
3859
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: refs?.map((item, i) => {
|
|
3860
|
-
if (!item.args.path) {
|
|
3861
|
-
return void 0;
|
|
3862
|
-
}
|
|
3863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Import, { root, name: [item.args.name], path: item.args.path, isTypeOnly }, i);
|
|
3864
|
-
}).filter(Boolean) });
|
|
3865
|
-
};
|
|
3866
3111
|
Schema.Context = SchemaContext;
|
|
3867
3112
|
|
|
3868
|
-
// src/hooks/useSchema.ts
|
|
3869
|
-
function useSchema() {
|
|
3870
|
-
const props = useContext(Schema.Context);
|
|
3871
|
-
return props;
|
|
3872
|
-
}
|
|
3873
|
-
|
|
3874
3113
|
// src/components/Oas.tsx
|
|
3875
|
-
init_esm_shims();
|
|
3876
3114
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
3877
3115
|
var OasContext = createContext({});
|
|
3878
3116
|
function Oas({ oas, children, operations, generator }) {
|
|
@@ -3928,6 +3166,6 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
3928
3166
|
*)
|
|
3929
3167
|
*/
|
|
3930
3168
|
|
|
3931
|
-
export { Oas, Operation, Schema,
|
|
3932
|
-
//# sourceMappingURL=chunk-
|
|
3933
|
-
//# sourceMappingURL=chunk-
|
|
3169
|
+
export { Oas, Operation, Schema, require_jsx_runtime };
|
|
3170
|
+
//# sourceMappingURL=chunk-CYF724QJ.js.map
|
|
3171
|
+
//# sourceMappingURL=chunk-CYF724QJ.js.map
|