@kubb/oas 4.12.10 → 4.12.11
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 +57 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -23
- package/dist/index.d.ts +41 -23
- package/dist/index.js +56 -31
- package/dist/index.js.map +1 -1
- package/package.json +3 -13
- package/src/Oas.ts +118 -68
- package/src/index.ts +0 -1
- package/src/types.ts +29 -6
- package/src/utils.ts +10 -10
- package/dist/index-BuoKUWab.d.cts +0 -376
- package/dist/index-CT3Sz4Y8.d.ts +0 -376
- package/dist/infer.cjs +0 -1
- package/dist/infer.d.cts +0 -2
- package/dist/infer.d.ts +0 -2
- package/dist/infer.js +0 -1
- package/src/infer/index.ts +0 -7
- package/src/infer/infer.ts +0 -51
- package/src/infer/mappers.ts +0 -75
- package/src/infer/model.ts +0 -38
- package/src/infer/requestParams.ts +0 -137
- package/src/infer/response.ts +0 -30
- package/src/infer/security.ts +0 -157
package/dist/index.d.cts
CHANGED
|
@@ -1,40 +1,58 @@
|
|
|
1
|
-
import { c as HttpMethods, d as OpenAPIV3_1, f as Operation, h as Infer, l as OasTypes, m as contentType, n as RequestParams, p as SchemaObject, r as Model, s as HttpMethod, t as Response, u as OpenAPIV3 } from "./index-BuoKUWab.cjs";
|
|
2
1
|
import { findSchemaDefinition, matchesMimeType } from "oas/utils";
|
|
3
|
-
import { OASDocument, ParameterObject, SchemaObject as SchemaObject$1, User } from "oas/types";
|
|
4
|
-
import { Operation as Operation$1 } from "oas/operation";
|
|
5
|
-
import { OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 as OpenAPIV3_1$1 } from "openapi-types";
|
|
6
2
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
3
|
import BaseOas from "oas";
|
|
4
|
+
import { Operation as Operation$1 } from "oas/operation";
|
|
5
|
+
import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1, OpenAPIV3_1 as OpenAPIV3_1$1 } from "openapi-types";
|
|
6
|
+
import * as OasTypes from "oas/types";
|
|
7
|
+
import { DiscriminatorObject as DiscriminatorObject$1, HttpMethods as HttpMethods$1, MediaTypeObject as MediaTypeObject$1, OASDocument, ParameterObject, ResponseObject as ResponseObject$1, SchemaObject as SchemaObject$1 } from "oas/types";
|
|
8
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
9
|
import { Fabric } from "@kubb/react-fabric";
|
|
10
10
|
|
|
11
|
+
//#region src/types.d.ts
|
|
12
|
+
type contentType = 'application/json' | (string & {});
|
|
13
|
+
type SchemaObject = SchemaObject$1 & {
|
|
14
|
+
'x-nullable'?: boolean;
|
|
15
|
+
$ref?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const HttpMethods: {
|
|
18
|
+
GET: "get";
|
|
19
|
+
POST: "post";
|
|
20
|
+
PUT: "put";
|
|
21
|
+
PATCH: "patch";
|
|
22
|
+
DELETE: "delete";
|
|
23
|
+
HEAD: "head";
|
|
24
|
+
OPTIONS: "options";
|
|
25
|
+
TRACE: "trace";
|
|
26
|
+
};
|
|
27
|
+
type HttpMethod = HttpMethods$1;
|
|
28
|
+
type Document = OASDocument;
|
|
29
|
+
type Operation = Operation$1;
|
|
30
|
+
type DiscriminatorObject = DiscriminatorObject$1;
|
|
31
|
+
type ReferenceObject = OpenAPIV3$1.ReferenceObject;
|
|
32
|
+
type ResponseObject = ResponseObject$1;
|
|
33
|
+
type MediaTypeObject = MediaTypeObject$1;
|
|
34
|
+
//#endregion
|
|
11
35
|
//#region src/Oas.d.ts
|
|
12
36
|
type Options$1 = {
|
|
13
37
|
contentType?: contentType;
|
|
14
38
|
discriminator?: 'strict' | 'inherit';
|
|
15
39
|
};
|
|
16
|
-
declare class Oas
|
|
40
|
+
declare class Oas extends BaseOas {
|
|
17
41
|
#private;
|
|
18
|
-
document:
|
|
19
|
-
constructor(
|
|
20
|
-
oas,
|
|
21
|
-
user
|
|
22
|
-
}: {
|
|
23
|
-
oas: TOAS | OASDocument | string;
|
|
24
|
-
user?: User;
|
|
25
|
-
});
|
|
42
|
+
document: Document;
|
|
43
|
+
constructor(document: Document);
|
|
26
44
|
setOptions(options: Options$1): void;
|
|
27
45
|
get options(): Options$1;
|
|
28
|
-
get($ref: string):
|
|
46
|
+
get<T = unknown>($ref: string): T | null;
|
|
29
47
|
getKey($ref: string): string | undefined;
|
|
30
48
|
set($ref: string, value: unknown): false | undefined;
|
|
31
|
-
getDiscriminator(schema:
|
|
32
|
-
dereferenceWithRef(schema?:
|
|
33
|
-
getResponseSchema(operation: Operation
|
|
34
|
-
getRequestSchema(operation: Operation
|
|
35
|
-
getParametersSchema(operation: Operation
|
|
49
|
+
getDiscriminator(schema: SchemaObject | null): DiscriminatorObject | null;
|
|
50
|
+
dereferenceWithRef<T = unknown>(schema?: T): T;
|
|
51
|
+
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
52
|
+
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
53
|
+
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
36
54
|
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
37
|
-
flattenSchema(schema
|
|
55
|
+
flattenSchema(schema: SchemaObject | null): SchemaObject | null;
|
|
38
56
|
}
|
|
39
57
|
//#endregion
|
|
40
58
|
//#region ../core/src/Kubb.d.ts
|
|
@@ -663,7 +681,7 @@ declare function isDiscriminator(obj?: any): obj is SchemaObject$1 & {
|
|
|
663
681
|
*/
|
|
664
682
|
declare function isRequired(schema?: SchemaObject$1): boolean;
|
|
665
683
|
declare function isOptional(schema?: SchemaObject$1): boolean;
|
|
666
|
-
declare function parse(pathOrApi: string |
|
|
684
|
+
declare function parse(pathOrApi: string | Document, {
|
|
667
685
|
oasClass,
|
|
668
686
|
canBundle,
|
|
669
687
|
enablePaths
|
|
@@ -672,12 +690,12 @@ declare function parse(pathOrApi: string | OASDocument, {
|
|
|
672
690
|
canBundle?: boolean;
|
|
673
691
|
enablePaths?: boolean;
|
|
674
692
|
}): Promise<Oas>;
|
|
675
|
-
declare function merge(pathOrApi: Array<string |
|
|
693
|
+
declare function merge(pathOrApi: Array<string | Document>, {
|
|
676
694
|
oasClass
|
|
677
695
|
}?: {
|
|
678
696
|
oasClass?: typeof Oas;
|
|
679
697
|
}): Promise<Oas>;
|
|
680
698
|
declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>;
|
|
681
699
|
//#endregion
|
|
682
|
-
export {
|
|
700
|
+
export { DiscriminatorObject, Document, HttpMethod, HttpMethods, MediaTypeObject, Oas, type OasTypes, type OpenAPIV3, type OpenAPIV3_1, Operation, ReferenceObject, ResponseObject, SchemaObject, contentType, findSchemaDefinition, isDiscriminator, isNullable, isOpenApiV3_1Document, isOptional, isParameterObject, isReference, isRequired, matchesMimeType, merge, parse, parseFromConfig };
|
|
683
701
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,58 @@
|
|
|
1
|
-
import { c as HttpMethods, d as OpenAPIV3_1, f as Operation, h as Infer, l as OasTypes, m as contentType, n as RequestParams, p as SchemaObject, r as Model, s as HttpMethod, t as Response, u as OpenAPIV3 } from "./index-CT3Sz4Y8.js";
|
|
2
1
|
import { findSchemaDefinition, matchesMimeType } from "oas/utils";
|
|
3
2
|
import BaseOas from "oas";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 as OpenAPIV3_1$1 } from "openapi-types";
|
|
3
|
+
import * as OasTypes from "oas/types";
|
|
4
|
+
import { DiscriminatorObject as DiscriminatorObject$1, HttpMethods as HttpMethods$1, MediaTypeObject as MediaTypeObject$1, OASDocument, ParameterObject, ResponseObject as ResponseObject$1, SchemaObject as SchemaObject$1 } from "oas/types";
|
|
7
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
|
+
import { Operation as Operation$1 } from "oas/operation";
|
|
7
|
+
import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1, OpenAPIV3_1 as OpenAPIV3_1$1 } from "openapi-types";
|
|
8
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
9
|
import { Fabric } from "@kubb/react-fabric";
|
|
10
10
|
|
|
11
|
+
//#region src/types.d.ts
|
|
12
|
+
type contentType = 'application/json' | (string & {});
|
|
13
|
+
type SchemaObject = SchemaObject$1 & {
|
|
14
|
+
'x-nullable'?: boolean;
|
|
15
|
+
$ref?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const HttpMethods: {
|
|
18
|
+
GET: "get";
|
|
19
|
+
POST: "post";
|
|
20
|
+
PUT: "put";
|
|
21
|
+
PATCH: "patch";
|
|
22
|
+
DELETE: "delete";
|
|
23
|
+
HEAD: "head";
|
|
24
|
+
OPTIONS: "options";
|
|
25
|
+
TRACE: "trace";
|
|
26
|
+
};
|
|
27
|
+
type HttpMethod = HttpMethods$1;
|
|
28
|
+
type Document = OASDocument;
|
|
29
|
+
type Operation = Operation$1;
|
|
30
|
+
type DiscriminatorObject = DiscriminatorObject$1;
|
|
31
|
+
type ReferenceObject = OpenAPIV3$1.ReferenceObject;
|
|
32
|
+
type ResponseObject = ResponseObject$1;
|
|
33
|
+
type MediaTypeObject = MediaTypeObject$1;
|
|
34
|
+
//#endregion
|
|
11
35
|
//#region src/Oas.d.ts
|
|
12
36
|
type Options$1 = {
|
|
13
37
|
contentType?: contentType;
|
|
14
38
|
discriminator?: 'strict' | 'inherit';
|
|
15
39
|
};
|
|
16
|
-
declare class Oas
|
|
40
|
+
declare class Oas extends BaseOas {
|
|
17
41
|
#private;
|
|
18
|
-
document:
|
|
19
|
-
constructor(
|
|
20
|
-
oas,
|
|
21
|
-
user
|
|
22
|
-
}: {
|
|
23
|
-
oas: TOAS | OASDocument | string;
|
|
24
|
-
user?: User;
|
|
25
|
-
});
|
|
42
|
+
document: Document;
|
|
43
|
+
constructor(document: Document);
|
|
26
44
|
setOptions(options: Options$1): void;
|
|
27
45
|
get options(): Options$1;
|
|
28
|
-
get($ref: string):
|
|
46
|
+
get<T = unknown>($ref: string): T | null;
|
|
29
47
|
getKey($ref: string): string | undefined;
|
|
30
48
|
set($ref: string, value: unknown): false | undefined;
|
|
31
|
-
getDiscriminator(schema:
|
|
32
|
-
dereferenceWithRef(schema?:
|
|
33
|
-
getResponseSchema(operation: Operation
|
|
34
|
-
getRequestSchema(operation: Operation
|
|
35
|
-
getParametersSchema(operation: Operation
|
|
49
|
+
getDiscriminator(schema: SchemaObject | null): DiscriminatorObject | null;
|
|
50
|
+
dereferenceWithRef<T = unknown>(schema?: T): T;
|
|
51
|
+
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
52
|
+
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
53
|
+
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
36
54
|
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
37
|
-
flattenSchema(schema
|
|
55
|
+
flattenSchema(schema: SchemaObject | null): SchemaObject | null;
|
|
38
56
|
}
|
|
39
57
|
//#endregion
|
|
40
58
|
//#region ../core/src/Kubb.d.ts
|
|
@@ -663,7 +681,7 @@ declare function isDiscriminator(obj?: any): obj is SchemaObject$1 & {
|
|
|
663
681
|
*/
|
|
664
682
|
declare function isRequired(schema?: SchemaObject$1): boolean;
|
|
665
683
|
declare function isOptional(schema?: SchemaObject$1): boolean;
|
|
666
|
-
declare function parse(pathOrApi: string |
|
|
684
|
+
declare function parse(pathOrApi: string | Document, {
|
|
667
685
|
oasClass,
|
|
668
686
|
canBundle,
|
|
669
687
|
enablePaths
|
|
@@ -672,12 +690,12 @@ declare function parse(pathOrApi: string | OASDocument, {
|
|
|
672
690
|
canBundle?: boolean;
|
|
673
691
|
enablePaths?: boolean;
|
|
674
692
|
}): Promise<Oas>;
|
|
675
|
-
declare function merge(pathOrApi: Array<string |
|
|
693
|
+
declare function merge(pathOrApi: Array<string | Document>, {
|
|
676
694
|
oasClass
|
|
677
695
|
}?: {
|
|
678
696
|
oasClass?: typeof Oas;
|
|
679
697
|
}): Promise<Oas>;
|
|
680
698
|
declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>;
|
|
681
699
|
//#endregion
|
|
682
|
-
export {
|
|
700
|
+
export { DiscriminatorObject, Document, HttpMethod, HttpMethods, MediaTypeObject, Oas, type OasTypes, type OpenAPIV3, type OpenAPIV3_1, Operation, ReferenceObject, ResponseObject, SchemaObject, contentType, findSchemaDefinition, isDiscriminator, isNullable, isOpenApiV3_1Document, isOptional, isParameterObject, isReference, isRequired, matchesMimeType, merge, parse, parseFromConfig };
|
|
683
701
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { findSchemaDefinition, matchesMimeType, matchesMimeType as matchesMimeType$1 } from "oas/utils";
|
|
3
3
|
import jsonpointer from "jsonpointer";
|
|
4
4
|
import BaseOas from "oas";
|
|
5
|
-
import OASNormalize from "oas-normalize";
|
|
6
5
|
import path from "node:path";
|
|
7
6
|
import { URLPath } from "@kubb/core/utils";
|
|
8
7
|
import { isRef } from "oas/types";
|
|
8
|
+
import OASNormalize from "oas-normalize";
|
|
9
9
|
import { isPlainObject, mergeDeep } from "remeda";
|
|
10
10
|
import swagger2openapi from "swagger2openapi";
|
|
11
11
|
|
|
@@ -4190,9 +4190,9 @@ async function parse(pathOrApi, { oasClass = Oas, canBundle = true, enablePaths
|
|
|
4190
4190
|
}).load();
|
|
4191
4191
|
if (isOpenApiV2Document(document)) {
|
|
4192
4192
|
const { openapi } = await swagger2openapi.convertObj(document, { anchors: true });
|
|
4193
|
-
return new oasClass(
|
|
4193
|
+
return new oasClass(openapi);
|
|
4194
4194
|
}
|
|
4195
|
-
return new oasClass(
|
|
4195
|
+
return new oasClass(document);
|
|
4196
4196
|
}
|
|
4197
4197
|
async function merge(pathOrApi, { oasClass = Oas } = {}) {
|
|
4198
4198
|
const instances = await Promise.all(pathOrApi.map((p) => parse(p, {
|
|
@@ -4231,11 +4231,10 @@ function parseFromConfig(config, oasClass = Oas) {
|
|
|
4231
4231
|
//#region src/Oas.ts
|
|
4232
4232
|
var Oas = class extends BaseOas {
|
|
4233
4233
|
#options = { discriminator: "strict" };
|
|
4234
|
-
document
|
|
4235
|
-
constructor(
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
this.document = oas;
|
|
4234
|
+
document;
|
|
4235
|
+
constructor(document) {
|
|
4236
|
+
super(document, void 0);
|
|
4237
|
+
this.document = document;
|
|
4239
4238
|
}
|
|
4240
4239
|
setOptions(options) {
|
|
4241
4240
|
this.#options = {
|
|
@@ -4250,7 +4249,7 @@ var Oas = class extends BaseOas {
|
|
|
4250
4249
|
get($ref) {
|
|
4251
4250
|
const origRef = $ref;
|
|
4252
4251
|
$ref = $ref.trim();
|
|
4253
|
-
if ($ref === "") return
|
|
4252
|
+
if ($ref === "") return null;
|
|
4254
4253
|
if ($ref.startsWith("#")) $ref = globalThis.decodeURIComponent($ref.substring(1));
|
|
4255
4254
|
else return null;
|
|
4256
4255
|
const current = jsonpointer.get(this.api, $ref);
|
|
@@ -4274,6 +4273,7 @@ var Oas = class extends BaseOas {
|
|
|
4274
4273
|
if (this.#options.discriminator === "inherit") Object.entries(mapping).forEach(([mappingKey, mappingValue]) => {
|
|
4275
4274
|
if (mappingValue) {
|
|
4276
4275
|
const childSchema = this.get(mappingValue);
|
|
4276
|
+
if (!childSchema) return;
|
|
4277
4277
|
if (!childSchema.properties) childSchema.properties = {};
|
|
4278
4278
|
const property = childSchema.properties[propertyName];
|
|
4279
4279
|
if (childSchema.properties) {
|
|
@@ -4281,33 +4281,58 @@ var Oas = class extends BaseOas {
|
|
|
4281
4281
|
...childSchema.properties ? childSchema.properties[propertyName] : {},
|
|
4282
4282
|
enum: [...property?.enum?.filter((value) => value !== mappingKey) ?? [], mappingKey]
|
|
4283
4283
|
};
|
|
4284
|
-
childSchema.required = [...new Set([...childSchema.required ?? [], propertyName])];
|
|
4284
|
+
childSchema.required = typeof childSchema.required === "boolean" ? childSchema.required : [...new Set([...childSchema.required ?? [], propertyName])];
|
|
4285
4285
|
this.set(mappingValue, childSchema);
|
|
4286
4286
|
}
|
|
4287
4287
|
}
|
|
4288
4288
|
});
|
|
4289
4289
|
}
|
|
4290
4290
|
getDiscriminator(schema) {
|
|
4291
|
-
if (!isDiscriminator(schema)) return;
|
|
4291
|
+
if (!isDiscriminator(schema) || !schema) return null;
|
|
4292
4292
|
const { mapping = {}, propertyName } = schema.discriminator;
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
if (
|
|
4304
|
-
const
|
|
4305
|
-
|
|
4306
|
-
const canAdd = key && !Object.values(mapping).includes(schema$1.$ref);
|
|
4307
|
-
if (canAdd && propertySchema?.enum?.length === 1) mapping[propertySchema.enum[0]] = schema$1.$ref;
|
|
4308
|
-
else if (canAdd) mapping[key] = schema$1.$ref;
|
|
4293
|
+
/**
|
|
4294
|
+
* Helper to extract discriminator value from a schema.
|
|
4295
|
+
* Checks in order:
|
|
4296
|
+
* 1. Extension property matching propertyName (e.g., x-linode-ref-name)
|
|
4297
|
+
* 2. Property with const value
|
|
4298
|
+
* 3. Property with single enum value
|
|
4299
|
+
* 4. Title as fallback
|
|
4300
|
+
*/
|
|
4301
|
+
const getDiscriminatorValue = (schema$1) => {
|
|
4302
|
+
if (!schema$1) return null;
|
|
4303
|
+
if (propertyName.startsWith("x-")) {
|
|
4304
|
+
const extensionValue = schema$1[propertyName];
|
|
4305
|
+
if (extensionValue && typeof extensionValue === "string") return extensionValue;
|
|
4309
4306
|
}
|
|
4310
|
-
|
|
4307
|
+
const propertySchema = schema$1.properties?.[propertyName];
|
|
4308
|
+
if (propertySchema && "const" in propertySchema && propertySchema.const !== void 0) return String(propertySchema.const);
|
|
4309
|
+
if (propertySchema && propertySchema.enum?.length === 1) return String(propertySchema.enum[0]);
|
|
4310
|
+
return schema$1.title || null;
|
|
4311
|
+
};
|
|
4312
|
+
/**
|
|
4313
|
+
* Process oneOf/anyOf items to build mapping.
|
|
4314
|
+
* Handles both $ref and inline schemas.
|
|
4315
|
+
*/
|
|
4316
|
+
const processSchemas = (schemas, existingMapping) => {
|
|
4317
|
+
schemas.forEach((schemaItem, index) => {
|
|
4318
|
+
if (isReference(schemaItem)) {
|
|
4319
|
+
const key = this.getKey(schemaItem.$ref);
|
|
4320
|
+
try {
|
|
4321
|
+
const discriminatorValue = getDiscriminatorValue(this.get(schemaItem.$ref));
|
|
4322
|
+
const canAdd = key && !Object.values(existingMapping).includes(schemaItem.$ref);
|
|
4323
|
+
if (canAdd && discriminatorValue) existingMapping[discriminatorValue] = schemaItem.$ref;
|
|
4324
|
+
else if (canAdd) existingMapping[key] = schemaItem.$ref;
|
|
4325
|
+
} catch (_error) {
|
|
4326
|
+
if (key && !Object.values(existingMapping).includes(schemaItem.$ref)) existingMapping[key] = schemaItem.$ref;
|
|
4327
|
+
}
|
|
4328
|
+
} else {
|
|
4329
|
+
const discriminatorValue = getDiscriminatorValue(schemaItem);
|
|
4330
|
+
if (discriminatorValue) existingMapping[discriminatorValue] = `#kubb-inline-${index}`;
|
|
4331
|
+
}
|
|
4332
|
+
});
|
|
4333
|
+
};
|
|
4334
|
+
if (schema.oneOf) processSchemas(schema.oneOf, mapping);
|
|
4335
|
+
if (schema.anyOf) processSchemas(schema.anyOf, mapping);
|
|
4311
4336
|
return {
|
|
4312
4337
|
...schema.discriminator,
|
|
4313
4338
|
mapping
|
|
@@ -4416,7 +4441,7 @@ var Oas = class extends BaseOas {
|
|
|
4416
4441
|
if (!params.length) return null;
|
|
4417
4442
|
return params.reduce((schema, pathParameters) => {
|
|
4418
4443
|
const property = pathParameters.content?.[contentType]?.schema ?? pathParameters.schema;
|
|
4419
|
-
const required = [...schema.required || [], pathParameters.required ? pathParameters.name : void 0].filter(Boolean);
|
|
4444
|
+
const required = typeof schema.required === "boolean" ? schema.required : [...schema.required || [], pathParameters.required ? pathParameters.name : void 0].filter(Boolean);
|
|
4420
4445
|
const getDefaultStyle = (location) => {
|
|
4421
4446
|
if (location === "query") return "form";
|
|
4422
4447
|
if (location === "path") return "simple";
|
|
@@ -4452,13 +4477,13 @@ var Oas = class extends BaseOas {
|
|
|
4452
4477
|
});
|
|
4453
4478
|
}
|
|
4454
4479
|
async valdiate() {
|
|
4455
|
-
return new
|
|
4480
|
+
return new (await (import("oas-normalize").then((m) => m.default)))(this.api, {
|
|
4456
4481
|
enablePaths: true,
|
|
4457
4482
|
colorizeErrors: true
|
|
4458
4483
|
}).validate({ parser: { validate: { errors: { colorize: true } } } });
|
|
4459
4484
|
}
|
|
4460
4485
|
flattenSchema(schema) {
|
|
4461
|
-
if (!schema?.allOf || schema.allOf.length === 0) return schema;
|
|
4486
|
+
if (!schema?.allOf || schema.allOf.length === 0) return schema || null;
|
|
4462
4487
|
if (schema.allOf.some((item) => isReference(item))) return schema;
|
|
4463
4488
|
const isPlainFragment = (item) => !Object.keys(item).some((key) => STRUCTURAL_KEYS.has(key));
|
|
4464
4489
|
if (!schema.allOf.every((item) => isPlainFragment(item))) return schema;
|