@hey-api/shared 0.0.0-next-20260408020233 → 0.0.0-next-20260408030107
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.mjs +148 -136
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -4375,16 +4375,16 @@ const discriminatorValues = ($ref, mapping, shouldUseRefAsValue) => {
|
|
|
4375
4375
|
};
|
|
4376
4376
|
//#endregion
|
|
4377
4377
|
//#region src/openApi/2.0.x/parser/schema.ts
|
|
4378
|
-
|
|
4378
|
+
function getSchemaType$1({ schema }) {
|
|
4379
4379
|
if (schema.type) return schema.type;
|
|
4380
4380
|
if (schema.properties) return "object";
|
|
4381
|
-
}
|
|
4382
|
-
|
|
4381
|
+
}
|
|
4382
|
+
function parseSchemaJsDoc$2({ irSchema, schema }) {
|
|
4383
4383
|
if (schema.example) irSchema.example = schema.example;
|
|
4384
4384
|
if (schema.description) irSchema.description = schema.description;
|
|
4385
4385
|
if (schema.title) irSchema.title = schema.title;
|
|
4386
|
-
}
|
|
4387
|
-
|
|
4386
|
+
}
|
|
4387
|
+
function parseSchemaMeta$2({ irSchema, schema }) {
|
|
4388
4388
|
if (schema.default !== void 0) irSchema.default = schema.default;
|
|
4389
4389
|
if (schema.exclusiveMaximum) {
|
|
4390
4390
|
if (schema.maximum !== void 0) irSchema.exclusiveMaximum = schema.maximum;
|
|
@@ -4399,8 +4399,8 @@ const parseSchemaMeta$2 = ({ irSchema, schema }) => {
|
|
|
4399
4399
|
if (schema.minLength !== void 0) irSchema.minLength = schema.minLength;
|
|
4400
4400
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
4401
4401
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
4402
|
-
}
|
|
4403
|
-
|
|
4402
|
+
}
|
|
4403
|
+
function parseArray$2({ context, irSchema = {}, schema, state }) {
|
|
4404
4404
|
if (schema.maxItems && schema.maxItems === schema.minItems) irSchema.type = "tuple";
|
|
4405
4405
|
else irSchema.type = "array";
|
|
4406
4406
|
let schemaItems = [];
|
|
@@ -4426,16 +4426,16 @@ const parseArray$2 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
4426
4426
|
schema: irSchema
|
|
4427
4427
|
});
|
|
4428
4428
|
return irSchema;
|
|
4429
|
-
}
|
|
4430
|
-
|
|
4429
|
+
}
|
|
4430
|
+
function parseBoolean$2({ irSchema = {} }) {
|
|
4431
4431
|
irSchema.type = "boolean";
|
|
4432
4432
|
return irSchema;
|
|
4433
|
-
}
|
|
4434
|
-
|
|
4433
|
+
}
|
|
4434
|
+
function parseNumber$2({ irSchema = {}, schema }) {
|
|
4435
4435
|
irSchema.type = schema.type;
|
|
4436
4436
|
return irSchema;
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4437
|
+
}
|
|
4438
|
+
function parseObject$2({ context, irSchema = {}, schema, state }) {
|
|
4439
4439
|
irSchema.type = "object";
|
|
4440
4440
|
const schemaProperties = {};
|
|
4441
4441
|
for (const name in schema.properties) {
|
|
@@ -4458,15 +4458,15 @@ const parseObject$2 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
4458
4458
|
});
|
|
4459
4459
|
if (schema.required) irSchema.required = schema.required;
|
|
4460
4460
|
return irSchema;
|
|
4461
|
-
}
|
|
4462
|
-
|
|
4461
|
+
}
|
|
4462
|
+
function parseString$2({ irSchema = {} }) {
|
|
4463
4463
|
irSchema.type = "string";
|
|
4464
4464
|
return irSchema;
|
|
4465
|
-
}
|
|
4466
|
-
|
|
4465
|
+
}
|
|
4466
|
+
function parseExtensions$2({ source, target }) {
|
|
4467
4467
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4468
|
+
}
|
|
4469
|
+
function initIrSchema$2({ schema }) {
|
|
4470
4470
|
const irSchema = {};
|
|
4471
4471
|
parseSchemaJsDoc$2({
|
|
4472
4472
|
irSchema,
|
|
@@ -4477,8 +4477,8 @@ const initIrSchema$2 = ({ schema }) => {
|
|
|
4477
4477
|
target: irSchema
|
|
4478
4478
|
});
|
|
4479
4479
|
return irSchema;
|
|
4480
|
-
}
|
|
4481
|
-
|
|
4480
|
+
}
|
|
4481
|
+
function parseAllOf$2({ context, schema, state }) {
|
|
4482
4482
|
let irSchema = initIrSchema$2({ schema });
|
|
4483
4483
|
const schemaItems = [];
|
|
4484
4484
|
const schemaType = getSchemaType$1({ schema });
|
|
@@ -4562,9 +4562,13 @@ const parseAllOf$2 = ({ context, schema, state }) => {
|
|
|
4562
4562
|
if (nestedItems[0].description) irSchema.description = nestedItems[0].description;
|
|
4563
4563
|
}
|
|
4564
4564
|
return irSchema;
|
|
4565
|
-
}
|
|
4566
|
-
|
|
4565
|
+
}
|
|
4566
|
+
function parseEnum$2({ context, schema, state }) {
|
|
4567
4567
|
let irSchema = initIrSchema$2({ schema });
|
|
4568
|
+
parseSchemaMeta$2({
|
|
4569
|
+
irSchema,
|
|
4570
|
+
schema
|
|
4571
|
+
});
|
|
4568
4572
|
irSchema.type = "enum";
|
|
4569
4573
|
const schemaItems = [];
|
|
4570
4574
|
for (const [index, enumValue] of schema.enum.entries()) {
|
|
@@ -4595,8 +4599,8 @@ const parseEnum$2 = ({ context, schema, state }) => {
|
|
|
4595
4599
|
schema: irSchema
|
|
4596
4600
|
});
|
|
4597
4601
|
return irSchema;
|
|
4598
|
-
}
|
|
4599
|
-
|
|
4602
|
+
}
|
|
4603
|
+
function parseRef$2({ context, schema, state }) {
|
|
4600
4604
|
const irSchema = {};
|
|
4601
4605
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
4602
4606
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
@@ -4626,8 +4630,8 @@ const parseRef$2 = ({ context, schema, state }) => {
|
|
|
4626
4630
|
state.$ref = originalRef;
|
|
4627
4631
|
}
|
|
4628
4632
|
return irSchema;
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4633
|
+
}
|
|
4634
|
+
function parseNullableType$1({ context, irSchema, schema, state }) {
|
|
4631
4635
|
if (!irSchema) irSchema = initIrSchema$2({ schema });
|
|
4632
4636
|
const typeIrSchema = {};
|
|
4633
4637
|
parseSchemaMeta$2({
|
|
@@ -4645,8 +4649,8 @@ const parseNullableType$1 = ({ context, irSchema, schema, state }) => {
|
|
|
4645
4649
|
schema: irSchema
|
|
4646
4650
|
});
|
|
4647
4651
|
return irSchema;
|
|
4648
|
-
}
|
|
4649
|
-
|
|
4652
|
+
}
|
|
4653
|
+
function parseType$2({ context, schema, state }) {
|
|
4650
4654
|
const irSchema = initIrSchema$2({ schema });
|
|
4651
4655
|
parseSchemaMeta$2({
|
|
4652
4656
|
irSchema,
|
|
@@ -4672,8 +4676,8 @@ const parseType$2 = ({ context, schema, state }) => {
|
|
|
4672
4676
|
},
|
|
4673
4677
|
state
|
|
4674
4678
|
});
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4679
|
+
}
|
|
4680
|
+
function parseOneType$2({ context, irSchema, schema, state }) {
|
|
4677
4681
|
if (!irSchema) {
|
|
4678
4682
|
irSchema = initIrSchema$2({ schema });
|
|
4679
4683
|
parseSchemaMeta$2({
|
|
@@ -4719,8 +4723,8 @@ const parseOneType$2 = ({ context, irSchema, schema, state }) => {
|
|
|
4719
4723
|
schema
|
|
4720
4724
|
});
|
|
4721
4725
|
}
|
|
4722
|
-
}
|
|
4723
|
-
|
|
4726
|
+
}
|
|
4727
|
+
function parseUnknown$2({ irSchema, schema }) {
|
|
4724
4728
|
if (!irSchema) irSchema = initIrSchema$2({ schema });
|
|
4725
4729
|
irSchema.type = "unknown";
|
|
4726
4730
|
parseSchemaMeta$2({
|
|
@@ -4728,8 +4732,8 @@ const parseUnknown$2 = ({ irSchema, schema }) => {
|
|
|
4728
4732
|
schema
|
|
4729
4733
|
});
|
|
4730
4734
|
return irSchema;
|
|
4731
|
-
}
|
|
4732
|
-
|
|
4735
|
+
}
|
|
4736
|
+
function schemaToIrSchema$2({ context, schema, state }) {
|
|
4733
4737
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
4734
4738
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
4735
4739
|
if (schema.$ref) return parseRef$2({
|
|
@@ -4756,8 +4760,8 @@ const schemaToIrSchema$2 = ({ context, schema, state }) => {
|
|
|
4756
4760
|
context,
|
|
4757
4761
|
schema
|
|
4758
4762
|
});
|
|
4759
|
-
}
|
|
4760
|
-
|
|
4763
|
+
}
|
|
4764
|
+
function parseSchema$2({ $ref, context, schema }) {
|
|
4761
4765
|
if (!context.ir.components) context.ir.components = {};
|
|
4762
4766
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
4763
4767
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema$2({
|
|
@@ -4768,7 +4772,7 @@ const parseSchema$2 = ({ $ref, context, schema }) => {
|
|
|
4768
4772
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
4769
4773
|
}
|
|
4770
4774
|
});
|
|
4771
|
-
}
|
|
4775
|
+
}
|
|
4772
4776
|
//#endregion
|
|
4773
4777
|
//#region src/openApi/2.0.x/parser/pagination.ts
|
|
4774
4778
|
const isPaginationType$2 = (schemaType) => schemaType === "boolean" || schemaType === "integer" || schemaType === "number" || schemaType === "string";
|
|
@@ -5489,15 +5493,15 @@ const mediaTypeObjects$1 = ({ content }) => {
|
|
|
5489
5493
|
};
|
|
5490
5494
|
//#endregion
|
|
5491
5495
|
//#region src/openApi/3.0.x/parser/schema.ts
|
|
5492
|
-
|
|
5496
|
+
function getSchemaType({ schema }) {
|
|
5493
5497
|
if (schema.type) return schema.type;
|
|
5494
5498
|
if (schema.properties) return "object";
|
|
5495
|
-
}
|
|
5499
|
+
}
|
|
5496
5500
|
/**
|
|
5497
5501
|
* Finds the type of a discriminator property by looking it up in the provided schemas.
|
|
5498
5502
|
* Searches through properties and allOf chains to find the property definition.
|
|
5499
5503
|
*/
|
|
5500
|
-
|
|
5504
|
+
function findDiscriminatorPropertyType$1({ context, propertyName, schemas }) {
|
|
5501
5505
|
for (const schema of schemas) {
|
|
5502
5506
|
const resolved = "$ref" in schema ? context.resolveRef(schema.$ref) : schema;
|
|
5503
5507
|
const property = resolved.properties?.[propertyName];
|
|
@@ -5515,13 +5519,13 @@ const findDiscriminatorPropertyType$1 = ({ context, propertyName, schemas }) =>
|
|
|
5515
5519
|
}
|
|
5516
5520
|
}
|
|
5517
5521
|
return "string";
|
|
5518
|
-
}
|
|
5522
|
+
}
|
|
5519
5523
|
/**
|
|
5520
5524
|
* Recursively finds discriminators in a schema, including nested allOf compositions.
|
|
5521
5525
|
* This is needed when a schema extends another schema via allOf, and that parent
|
|
5522
5526
|
* schema is itself an allOf composition with discriminators in inline schemas.
|
|
5523
5527
|
*/
|
|
5524
|
-
|
|
5528
|
+
function findDiscriminatorsInSchema$1({ context, discriminators = [], schema }) {
|
|
5525
5529
|
if (schema.discriminator) discriminators.push({
|
|
5526
5530
|
discriminator: schema.discriminator,
|
|
5527
5531
|
oneOf: schema.oneOf
|
|
@@ -5537,23 +5541,23 @@ const findDiscriminatorsInSchema$1 = ({ context, discriminators = [], schema })
|
|
|
5537
5541
|
});
|
|
5538
5542
|
}
|
|
5539
5543
|
return discriminators;
|
|
5540
|
-
}
|
|
5544
|
+
}
|
|
5541
5545
|
/**
|
|
5542
5546
|
* Gets the discriminator value for a schema.
|
|
5543
5547
|
* Returns only the schema's own discriminator value, not child values.
|
|
5544
5548
|
*/
|
|
5545
|
-
|
|
5549
|
+
function getAllDiscriminatorValues$1({ discriminator, schemaRef }) {
|
|
5546
5550
|
const values = [];
|
|
5547
5551
|
for (const [value, mappedSchemaRef] of Object.entries(discriminator.mapping || {})) if (mappedSchemaRef === schemaRef) values.push(value);
|
|
5548
5552
|
return values;
|
|
5549
|
-
}
|
|
5550
|
-
|
|
5553
|
+
}
|
|
5554
|
+
function parseSchemaJsDoc$1({ irSchema, schema }) {
|
|
5551
5555
|
if (schema.deprecated !== void 0) irSchema.deprecated = schema.deprecated;
|
|
5552
5556
|
if (schema.example) irSchema.example = schema.example;
|
|
5553
5557
|
if (schema.description) irSchema.description = schema.description;
|
|
5554
5558
|
if (schema.title) irSchema.title = schema.title;
|
|
5555
|
-
}
|
|
5556
|
-
|
|
5559
|
+
}
|
|
5560
|
+
function parseSchemaMeta$1({ irSchema, schema }) {
|
|
5557
5561
|
if (schema.default !== void 0) irSchema.default = schema.default;
|
|
5558
5562
|
if (schema.exclusiveMaximum) {
|
|
5559
5563
|
if (schema.maximum !== void 0) irSchema.exclusiveMaximum = schema.maximum;
|
|
@@ -5569,8 +5573,8 @@ const parseSchemaMeta$1 = ({ irSchema, schema }) => {
|
|
|
5569
5573
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
5570
5574
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
5571
5575
|
else if (schema.writeOnly) irSchema.accessScope = "write";
|
|
5572
|
-
}
|
|
5573
|
-
|
|
5576
|
+
}
|
|
5577
|
+
function parseArray$1({ context, irSchema = {}, schema, state }) {
|
|
5574
5578
|
if (schema.maxItems && schema.maxItems === schema.minItems) irSchema.type = "tuple";
|
|
5575
5579
|
else irSchema.type = "array";
|
|
5576
5580
|
let schemaItems = [];
|
|
@@ -5596,16 +5600,16 @@ const parseArray$1 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
5596
5600
|
schema: irSchema
|
|
5597
5601
|
});
|
|
5598
5602
|
return irSchema;
|
|
5599
|
-
}
|
|
5600
|
-
|
|
5603
|
+
}
|
|
5604
|
+
function parseBoolean$1({ irSchema = {} }) {
|
|
5601
5605
|
irSchema.type = "boolean";
|
|
5602
5606
|
return irSchema;
|
|
5603
|
-
}
|
|
5604
|
-
|
|
5607
|
+
}
|
|
5608
|
+
function parseNumber$1({ irSchema = {}, schema }) {
|
|
5605
5609
|
irSchema.type = schema.type;
|
|
5606
5610
|
return irSchema;
|
|
5607
|
-
}
|
|
5608
|
-
|
|
5611
|
+
}
|
|
5612
|
+
function parseObject$1({ context, irSchema = {}, schema, state }) {
|
|
5609
5613
|
irSchema.type = "object";
|
|
5610
5614
|
const schemaProperties = {};
|
|
5611
5615
|
for (const name in schema.properties) {
|
|
@@ -5647,15 +5651,15 @@ const parseObject$1 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
5647
5651
|
}
|
|
5648
5652
|
}
|
|
5649
5653
|
return irSchema;
|
|
5650
|
-
}
|
|
5651
|
-
|
|
5654
|
+
}
|
|
5655
|
+
function parseString$1({ irSchema = {} }) {
|
|
5652
5656
|
irSchema.type = "string";
|
|
5653
5657
|
return irSchema;
|
|
5654
|
-
}
|
|
5655
|
-
|
|
5658
|
+
}
|
|
5659
|
+
function parseExtensions$1({ source, target }) {
|
|
5656
5660
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
5657
|
-
}
|
|
5658
|
-
|
|
5661
|
+
}
|
|
5662
|
+
function initIrSchema$1({ schema }) {
|
|
5659
5663
|
const irSchema = {};
|
|
5660
5664
|
parseSchemaJsDoc$1({
|
|
5661
5665
|
irSchema,
|
|
@@ -5666,8 +5670,8 @@ const initIrSchema$1 = ({ schema }) => {
|
|
|
5666
5670
|
target: irSchema
|
|
5667
5671
|
});
|
|
5668
5672
|
return irSchema;
|
|
5669
|
-
}
|
|
5670
|
-
|
|
5673
|
+
}
|
|
5674
|
+
function parseAllOf$1({ context, schema, state }) {
|
|
5671
5675
|
let irSchema = initIrSchema$1({ schema });
|
|
5672
5676
|
const schemaItems = [];
|
|
5673
5677
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5816,8 +5820,8 @@ const parseAllOf$1 = ({ context, schema, state }) => {
|
|
|
5816
5820
|
if (nestedItems[0].description) irSchema.description = nestedItems[0].description;
|
|
5817
5821
|
}
|
|
5818
5822
|
return irSchema;
|
|
5819
|
-
}
|
|
5820
|
-
|
|
5823
|
+
}
|
|
5824
|
+
function parseAnyOf$1({ context, schema, state }) {
|
|
5821
5825
|
let irSchema = initIrSchema$1({ schema });
|
|
5822
5826
|
const schemaItems = [];
|
|
5823
5827
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5869,9 +5873,13 @@ const parseAnyOf$1 = ({ context, schema, state }) => {
|
|
|
5869
5873
|
};
|
|
5870
5874
|
}
|
|
5871
5875
|
return irSchema;
|
|
5872
|
-
}
|
|
5873
|
-
|
|
5876
|
+
}
|
|
5877
|
+
function parseEnum$1({ context, schema, state }) {
|
|
5874
5878
|
let irSchema = initIrSchema$1({ schema });
|
|
5879
|
+
parseSchemaMeta$1({
|
|
5880
|
+
irSchema,
|
|
5881
|
+
schema
|
|
5882
|
+
});
|
|
5875
5883
|
irSchema.type = "enum";
|
|
5876
5884
|
const schemaItems = [];
|
|
5877
5885
|
for (const [index, enumValue] of schema.enum.entries()) {
|
|
@@ -5902,8 +5910,8 @@ const parseEnum$1 = ({ context, schema, state }) => {
|
|
|
5902
5910
|
schema: irSchema
|
|
5903
5911
|
});
|
|
5904
5912
|
return irSchema;
|
|
5905
|
-
}
|
|
5906
|
-
|
|
5913
|
+
}
|
|
5914
|
+
function parseOneOf$1({ context, schema, state }) {
|
|
5907
5915
|
let irSchema = initIrSchema$1({ schema });
|
|
5908
5916
|
let schemaItems = [];
|
|
5909
5917
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5957,8 +5965,8 @@ const parseOneOf$1 = ({ context, schema, state }) => {
|
|
|
5957
5965
|
};
|
|
5958
5966
|
}
|
|
5959
5967
|
return irSchema;
|
|
5960
|
-
}
|
|
5961
|
-
|
|
5968
|
+
}
|
|
5969
|
+
function parseRef$1({ context, schema, state }) {
|
|
5962
5970
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
5963
5971
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
5964
5972
|
const refSchema = context.resolveRef(schema.$ref);
|
|
@@ -5987,8 +5995,8 @@ const parseRef$1 = ({ context, schema, state }) => {
|
|
|
5987
5995
|
state.$ref = originalRef;
|
|
5988
5996
|
}
|
|
5989
5997
|
return irSchema;
|
|
5990
|
-
}
|
|
5991
|
-
|
|
5998
|
+
}
|
|
5999
|
+
function parseNullableType({ context, irSchema, schema, state }) {
|
|
5992
6000
|
if (!irSchema) irSchema = initIrSchema$1({ schema });
|
|
5993
6001
|
const typeIrSchema = {};
|
|
5994
6002
|
parseSchemaMeta$1({
|
|
@@ -6006,8 +6014,8 @@ const parseNullableType = ({ context, irSchema, schema, state }) => {
|
|
|
6006
6014
|
schema: irSchema
|
|
6007
6015
|
});
|
|
6008
6016
|
return irSchema;
|
|
6009
|
-
}
|
|
6010
|
-
|
|
6017
|
+
}
|
|
6018
|
+
function parseType$1({ context, schema, state }) {
|
|
6011
6019
|
const irSchema = initIrSchema$1({ schema });
|
|
6012
6020
|
parseSchemaMeta$1({
|
|
6013
6021
|
irSchema,
|
|
@@ -6033,8 +6041,8 @@ const parseType$1 = ({ context, schema, state }) => {
|
|
|
6033
6041
|
},
|
|
6034
6042
|
state
|
|
6035
6043
|
});
|
|
6036
|
-
}
|
|
6037
|
-
|
|
6044
|
+
}
|
|
6045
|
+
function parseOneType$1({ context, irSchema, schema, state }) {
|
|
6038
6046
|
if (!irSchema) {
|
|
6039
6047
|
irSchema = initIrSchema$1({ schema });
|
|
6040
6048
|
parseSchemaMeta$1({
|
|
@@ -6080,8 +6088,8 @@ const parseOneType$1 = ({ context, irSchema, schema, state }) => {
|
|
|
6080
6088
|
schema
|
|
6081
6089
|
});
|
|
6082
6090
|
}
|
|
6083
|
-
}
|
|
6084
|
-
|
|
6091
|
+
}
|
|
6092
|
+
function parseUnknown$1({ irSchema, schema }) {
|
|
6085
6093
|
if (!irSchema) irSchema = initIrSchema$1({ schema });
|
|
6086
6094
|
irSchema.type = "unknown";
|
|
6087
6095
|
parseSchemaMeta$1({
|
|
@@ -6089,8 +6097,8 @@ const parseUnknown$1 = ({ irSchema, schema }) => {
|
|
|
6089
6097
|
schema
|
|
6090
6098
|
});
|
|
6091
6099
|
return irSchema;
|
|
6092
|
-
}
|
|
6093
|
-
|
|
6100
|
+
}
|
|
6101
|
+
function schemaToIrSchema$1({ context, schema, state }) {
|
|
6094
6102
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
6095
6103
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
6096
6104
|
if ("$ref" in schema) return parseRef$1({
|
|
@@ -6127,8 +6135,8 @@ const schemaToIrSchema$1 = ({ context, schema, state }) => {
|
|
|
6127
6135
|
context,
|
|
6128
6136
|
schema
|
|
6129
6137
|
});
|
|
6130
|
-
}
|
|
6131
|
-
|
|
6138
|
+
}
|
|
6139
|
+
function parseSchema$1({ $ref, context, schema }) {
|
|
6132
6140
|
if (!context.ir.components) context.ir.components = {};
|
|
6133
6141
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
6134
6142
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema$1({
|
|
@@ -6139,7 +6147,7 @@ const parseSchema$1 = ({ $ref, context, schema }) => {
|
|
|
6139
6147
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
6140
6148
|
}
|
|
6141
6149
|
});
|
|
6142
|
-
}
|
|
6150
|
+
}
|
|
6143
6151
|
//#endregion
|
|
6144
6152
|
//#region src/openApi/3.0.x/parser/pagination.ts
|
|
6145
6153
|
const isPaginationType$1 = (schemaType) => schemaType === "boolean" || schemaType === "integer" || schemaType === "number" || schemaType === "string";
|
|
@@ -6824,17 +6832,17 @@ const mediaTypeObjects = ({ content }) => {
|
|
|
6824
6832
|
};
|
|
6825
6833
|
//#endregion
|
|
6826
6834
|
//#region src/openApi/3.1.x/parser/schema.ts
|
|
6827
|
-
|
|
6835
|
+
function getSchemaTypes({ schema }) {
|
|
6828
6836
|
if (typeof schema.type === "string") return [schema.type];
|
|
6829
6837
|
if (schema.type) return schema.type;
|
|
6830
6838
|
if (schema.properties) return ["object"];
|
|
6831
6839
|
return [];
|
|
6832
|
-
}
|
|
6840
|
+
}
|
|
6833
6841
|
/**
|
|
6834
6842
|
* Finds the type of a discriminator property by looking it up in the provided schemas.
|
|
6835
6843
|
* Searches through properties and allOf chains to find the property definition.
|
|
6836
6844
|
*/
|
|
6837
|
-
|
|
6845
|
+
function findDiscriminatorPropertyType({ context, propertyName, schemas }) {
|
|
6838
6846
|
for (const schema of schemas) {
|
|
6839
6847
|
const resolved = schema.$ref ? context.resolveRef(schema.$ref) : schema;
|
|
6840
6848
|
const property = resolved.properties?.[propertyName];
|
|
@@ -6854,13 +6862,13 @@ const findDiscriminatorPropertyType = ({ context, propertyName, schemas }) => {
|
|
|
6854
6862
|
}
|
|
6855
6863
|
}
|
|
6856
6864
|
return "string";
|
|
6857
|
-
}
|
|
6865
|
+
}
|
|
6858
6866
|
/**
|
|
6859
6867
|
* Recursively finds discriminators in a schema, including nested allOf compositions.
|
|
6860
6868
|
* This is needed when a schema extends another schema via allOf, and that parent
|
|
6861
6869
|
* schema is itself an allOf composition with discriminators in inline schemas.
|
|
6862
6870
|
*/
|
|
6863
|
-
|
|
6871
|
+
function findDiscriminatorsInSchema({ context, discriminators = [], schema }) {
|
|
6864
6872
|
if (schema.discriminator) discriminators.push({
|
|
6865
6873
|
discriminator: schema.discriminator,
|
|
6866
6874
|
oneOf: schema.oneOf
|
|
@@ -6876,23 +6884,23 @@ const findDiscriminatorsInSchema = ({ context, discriminators = [], schema }) =>
|
|
|
6876
6884
|
});
|
|
6877
6885
|
}
|
|
6878
6886
|
return discriminators;
|
|
6879
|
-
}
|
|
6887
|
+
}
|
|
6880
6888
|
/**
|
|
6881
6889
|
* Gets the discriminator value for a schema.
|
|
6882
6890
|
* Returns only the schema's own discriminator value, not child values.
|
|
6883
6891
|
*/
|
|
6884
|
-
|
|
6892
|
+
function getAllDiscriminatorValues({ discriminator, schemaRef }) {
|
|
6885
6893
|
const values = [];
|
|
6886
6894
|
for (const [value, mappedSchemaRef] of Object.entries(discriminator.mapping || {})) if (mappedSchemaRef === schemaRef) values.push(value);
|
|
6887
6895
|
return values;
|
|
6888
|
-
}
|
|
6889
|
-
|
|
6896
|
+
}
|
|
6897
|
+
function parseSchemaJsDoc({ irSchema, schema }) {
|
|
6890
6898
|
if (schema.deprecated !== void 0) irSchema.deprecated = schema.deprecated;
|
|
6891
6899
|
if (schema.example) irSchema.example = schema.example;
|
|
6892
6900
|
if (schema.description) irSchema.description = schema.description;
|
|
6893
6901
|
if (schema.title) irSchema.title = schema.title;
|
|
6894
|
-
}
|
|
6895
|
-
|
|
6902
|
+
}
|
|
6903
|
+
function parseSchemaMeta({ irSchema, schema }) {
|
|
6896
6904
|
if (schema.const !== void 0) {
|
|
6897
6905
|
irSchema.const = schema.const;
|
|
6898
6906
|
if (!schema.type) if (schema.const === null) irSchema.type = "null";
|
|
@@ -6923,8 +6931,8 @@ const parseSchemaMeta = ({ irSchema, schema }) => {
|
|
|
6923
6931
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
6924
6932
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
6925
6933
|
else if (schema.writeOnly) irSchema.accessScope = "write";
|
|
6926
|
-
}
|
|
6927
|
-
|
|
6934
|
+
}
|
|
6935
|
+
function parseArray({ context, irSchema = {}, schema, state }) {
|
|
6928
6936
|
if (schema.prefixItems && schema.prefixItems.length || schema.maxItems && schema.maxItems === schema.minItems || schema.const !== void 0) irSchema.type = "tuple";
|
|
6929
6937
|
else irSchema.type = "array";
|
|
6930
6938
|
let schemaItems = [];
|
|
@@ -6957,20 +6965,20 @@ const parseArray = ({ context, irSchema = {}, schema, state }) => {
|
|
|
6957
6965
|
schema: irSchema
|
|
6958
6966
|
});
|
|
6959
6967
|
return irSchema;
|
|
6960
|
-
}
|
|
6961
|
-
|
|
6968
|
+
}
|
|
6969
|
+
function parseBoolean({ irSchema = {} }) {
|
|
6962
6970
|
irSchema.type = "boolean";
|
|
6963
6971
|
return irSchema;
|
|
6964
|
-
}
|
|
6965
|
-
|
|
6972
|
+
}
|
|
6973
|
+
function parseNull({ irSchema = {} }) {
|
|
6966
6974
|
irSchema.type = "null";
|
|
6967
6975
|
return irSchema;
|
|
6968
|
-
}
|
|
6969
|
-
|
|
6976
|
+
}
|
|
6977
|
+
function parseNumber({ irSchema = {}, schema }) {
|
|
6970
6978
|
irSchema.type = schema.type;
|
|
6971
6979
|
return irSchema;
|
|
6972
|
-
}
|
|
6973
|
-
|
|
6980
|
+
}
|
|
6981
|
+
function parseObject({ context, irSchema = {}, schema, state }) {
|
|
6974
6982
|
irSchema.type = "object";
|
|
6975
6983
|
const schemaProperties = {};
|
|
6976
6984
|
for (const name in schema.properties) {
|
|
@@ -7029,15 +7037,15 @@ const parseObject = ({ context, irSchema = {}, schema, state }) => {
|
|
|
7029
7037
|
}
|
|
7030
7038
|
}
|
|
7031
7039
|
return irSchema;
|
|
7032
|
-
}
|
|
7033
|
-
|
|
7040
|
+
}
|
|
7041
|
+
function parseString({ irSchema = {} }) {
|
|
7034
7042
|
irSchema.type = "string";
|
|
7035
7043
|
return irSchema;
|
|
7036
|
-
}
|
|
7037
|
-
|
|
7044
|
+
}
|
|
7045
|
+
function parseExtensions({ source, target }) {
|
|
7038
7046
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
7039
|
-
}
|
|
7040
|
-
|
|
7047
|
+
}
|
|
7048
|
+
function initIrSchema({ schema }) {
|
|
7041
7049
|
const irSchema = {};
|
|
7042
7050
|
parseSchemaJsDoc({
|
|
7043
7051
|
irSchema,
|
|
@@ -7048,8 +7056,8 @@ const initIrSchema = ({ schema }) => {
|
|
|
7048
7056
|
target: irSchema
|
|
7049
7057
|
});
|
|
7050
7058
|
return irSchema;
|
|
7051
|
-
}
|
|
7052
|
-
|
|
7059
|
+
}
|
|
7060
|
+
function parseAllOf({ context, schema, state }) {
|
|
7053
7061
|
let irSchema = initIrSchema({ schema });
|
|
7054
7062
|
parseSchemaMeta({
|
|
7055
7063
|
irSchema,
|
|
@@ -7200,8 +7208,8 @@ const parseAllOf = ({ context, schema, state }) => {
|
|
|
7200
7208
|
};
|
|
7201
7209
|
}
|
|
7202
7210
|
return irSchema;
|
|
7203
|
-
}
|
|
7204
|
-
|
|
7211
|
+
}
|
|
7212
|
+
function parseAnyOf({ context, schema, state }) {
|
|
7205
7213
|
let irSchema = initIrSchema({ schema });
|
|
7206
7214
|
parseSchemaMeta({
|
|
7207
7215
|
irSchema,
|
|
@@ -7257,9 +7265,13 @@ const parseAnyOf = ({ context, schema, state }) => {
|
|
|
7257
7265
|
};
|
|
7258
7266
|
}
|
|
7259
7267
|
return irSchema;
|
|
7260
|
-
}
|
|
7261
|
-
|
|
7268
|
+
}
|
|
7269
|
+
function parseEnum({ context, schema, state }) {
|
|
7262
7270
|
let irSchema = initIrSchema({ schema });
|
|
7271
|
+
parseSchemaMeta({
|
|
7272
|
+
irSchema,
|
|
7273
|
+
schema
|
|
7274
|
+
});
|
|
7263
7275
|
irSchema.type = "enum";
|
|
7264
7276
|
const schemaItems = [];
|
|
7265
7277
|
const schemaTypes = getSchemaTypes({ schema });
|
|
@@ -7289,8 +7301,8 @@ const parseEnum = ({ context, schema, state }) => {
|
|
|
7289
7301
|
schema: irSchema
|
|
7290
7302
|
});
|
|
7291
7303
|
return irSchema;
|
|
7292
|
-
}
|
|
7293
|
-
|
|
7304
|
+
}
|
|
7305
|
+
function parseOneOf({ context, schema, state }) {
|
|
7294
7306
|
let irSchema = initIrSchema({ schema });
|
|
7295
7307
|
parseSchemaMeta({
|
|
7296
7308
|
irSchema,
|
|
@@ -7348,8 +7360,8 @@ const parseOneOf = ({ context, schema, state }) => {
|
|
|
7348
7360
|
};
|
|
7349
7361
|
}
|
|
7350
7362
|
return irSchema;
|
|
7351
|
-
}
|
|
7352
|
-
|
|
7363
|
+
}
|
|
7364
|
+
function parseRef({ context, schema, state }) {
|
|
7353
7365
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
7354
7366
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
7355
7367
|
const refSchema = context.resolveRef(schema.$ref);
|
|
@@ -7393,8 +7405,8 @@ const parseRef = ({ context, schema, state }) => {
|
|
|
7393
7405
|
schema: irSchema
|
|
7394
7406
|
});
|
|
7395
7407
|
return irSchema;
|
|
7396
|
-
}
|
|
7397
|
-
|
|
7408
|
+
}
|
|
7409
|
+
function parseOneType({ context, irSchema, schema, state }) {
|
|
7398
7410
|
if (!irSchema) {
|
|
7399
7411
|
irSchema = initIrSchema({ schema });
|
|
7400
7412
|
parseSchemaMeta({
|
|
@@ -7442,8 +7454,8 @@ const parseOneType = ({ context, irSchema, schema, state }) => {
|
|
|
7442
7454
|
schema
|
|
7443
7455
|
});
|
|
7444
7456
|
}
|
|
7445
|
-
}
|
|
7446
|
-
|
|
7457
|
+
}
|
|
7458
|
+
function parseManyTypes({ context, irSchema, schema, state }) {
|
|
7447
7459
|
if (!irSchema) irSchema = initIrSchema({ schema });
|
|
7448
7460
|
const typeIrSchema = {};
|
|
7449
7461
|
parseSchemaMeta({
|
|
@@ -7470,8 +7482,8 @@ const parseManyTypes = ({ context, irSchema, schema, state }) => {
|
|
|
7470
7482
|
schema: irSchema
|
|
7471
7483
|
});
|
|
7472
7484
|
return irSchema;
|
|
7473
|
-
}
|
|
7474
|
-
|
|
7485
|
+
}
|
|
7486
|
+
function parseType({ context, schema, state }) {
|
|
7475
7487
|
const irSchema = initIrSchema({ schema });
|
|
7476
7488
|
parseSchemaMeta({
|
|
7477
7489
|
irSchema,
|
|
@@ -7496,8 +7508,8 @@ const parseType = ({ context, schema, state }) => {
|
|
|
7496
7508
|
},
|
|
7497
7509
|
state
|
|
7498
7510
|
});
|
|
7499
|
-
}
|
|
7500
|
-
|
|
7511
|
+
}
|
|
7512
|
+
function parseUnknown({ irSchema, schema }) {
|
|
7501
7513
|
if (!irSchema) irSchema = initIrSchema({ schema });
|
|
7502
7514
|
irSchema.type = "unknown";
|
|
7503
7515
|
parseSchemaMeta({
|
|
@@ -7505,8 +7517,8 @@ const parseUnknown = ({ irSchema, schema }) => {
|
|
|
7505
7517
|
schema
|
|
7506
7518
|
});
|
|
7507
7519
|
return irSchema;
|
|
7508
|
-
}
|
|
7509
|
-
|
|
7520
|
+
}
|
|
7521
|
+
function schemaToIrSchema({ context, schema, state }) {
|
|
7510
7522
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
7511
7523
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
7512
7524
|
if (schema.$ref) return parseRef({
|
|
@@ -7551,8 +7563,8 @@ const schemaToIrSchema = ({ context, schema, state }) => {
|
|
|
7551
7563
|
context,
|
|
7552
7564
|
schema
|
|
7553
7565
|
});
|
|
7554
|
-
}
|
|
7555
|
-
|
|
7566
|
+
}
|
|
7567
|
+
function parseSchema({ $ref, context, schema }) {
|
|
7556
7568
|
if (!context.ir.components) context.ir.components = {};
|
|
7557
7569
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
7558
7570
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({
|
|
@@ -7563,7 +7575,7 @@ const parseSchema = ({ $ref, context, schema }) => {
|
|
|
7563
7575
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
7564
7576
|
}
|
|
7565
7577
|
});
|
|
7566
|
-
}
|
|
7578
|
+
}
|
|
7567
7579
|
//#endregion
|
|
7568
7580
|
//#region src/openApi/3.1.x/parser/pagination.ts
|
|
7569
7581
|
const isPaginationType = (schemaTypes) => schemaTypes.includes("boolean") || schemaTypes.includes("integer") || schemaTypes.includes("number") || schemaTypes.includes("string");
|