fern-api 0.21.0 → 0.22.0-rc1
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/bundle.cjs +378 -123
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -827393,7 +827393,7 @@ var AccessTokenPosthogManager = class {
|
|
|
827393
827393
|
properties: {
|
|
827394
827394
|
...event,
|
|
827395
827395
|
...event.properties,
|
|
827396
|
-
version: "0.
|
|
827396
|
+
version: "0.22.0-rc1",
|
|
827397
827397
|
usingAccessToken: true
|
|
827398
827398
|
}
|
|
827399
827399
|
});
|
|
@@ -827455,7 +827455,7 @@ var UserPosthogManager = class {
|
|
|
827455
827455
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
827456
827456
|
event: "CLI",
|
|
827457
827457
|
properties: {
|
|
827458
|
-
version: "0.
|
|
827458
|
+
version: "0.22.0-rc1",
|
|
827459
827459
|
...event,
|
|
827460
827460
|
...event.properties
|
|
827461
827461
|
}
|
|
@@ -842382,17 +842382,18 @@ var ExampleTypeFactory = class {
|
|
|
842382
842382
|
constructor(schemas) {
|
|
842383
842383
|
this.schemas = schemas;
|
|
842384
842384
|
}
|
|
842385
|
-
buildExample({ schema: schema2, example, options: options2 }) {
|
|
842385
|
+
buildExample({ schema: schema2, exampleId, example, options: options2 }) {
|
|
842386
842386
|
return this.buildExampleHelper({
|
|
842387
842387
|
schema: schema2,
|
|
842388
842388
|
visitedSchemaIds: /* @__PURE__ */ new Set(),
|
|
842389
|
+
exampleId,
|
|
842389
842390
|
example,
|
|
842390
842391
|
options: { ...options2, maxCheckerDepth: options2.maxCheckerDepth ?? 5 },
|
|
842391
842392
|
depth: 0
|
|
842392
842393
|
});
|
|
842393
842394
|
}
|
|
842394
|
-
buildExampleHelper({ example, schema: schema2, depth, visitedSchemaIds, options: options2 }) {
|
|
842395
|
-
var _a4, _b3;
|
|
842395
|
+
buildExampleHelper({ exampleId, example, schema: schema2, depth, visitedSchemaIds, options: options2 }) {
|
|
842396
|
+
var _a4, _b3, _c3, _d;
|
|
842396
842397
|
switch (schema2.type) {
|
|
842397
842398
|
case "enum":
|
|
842398
842399
|
if (typeof example === "string" && enumContainsValue({ schema: schema2, value: example })) {
|
|
@@ -842408,6 +842409,7 @@ var ExampleTypeFactory = class {
|
|
|
842408
842409
|
const result2 = this.buildExampleHelper({
|
|
842409
842410
|
schema: schema2.value,
|
|
842410
842411
|
visitedSchemaIds,
|
|
842412
|
+
exampleId,
|
|
842411
842413
|
example,
|
|
842412
842414
|
depth,
|
|
842413
842415
|
options: options2
|
|
@@ -842430,6 +842432,7 @@ var ExampleTypeFactory = class {
|
|
|
842430
842432
|
const result2 = this.buildExampleHelper({
|
|
842431
842433
|
schema: schema2.value,
|
|
842432
842434
|
visitedSchemaIds,
|
|
842435
|
+
exampleId,
|
|
842433
842436
|
example,
|
|
842434
842437
|
depth,
|
|
842435
842438
|
options: options2
|
|
@@ -842456,6 +842459,7 @@ var ExampleTypeFactory = class {
|
|
|
842456
842459
|
const referencedExample = this.buildExampleHelper({
|
|
842457
842460
|
example,
|
|
842458
842461
|
schema: referencedSchemaWithExample,
|
|
842462
|
+
exampleId,
|
|
842459
842463
|
visitedSchemaIds,
|
|
842460
842464
|
depth,
|
|
842461
842465
|
options: options2
|
|
@@ -842474,15 +842478,15 @@ var ExampleTypeFactory = class {
|
|
|
842474
842478
|
const fullExample = getFullExampleAsObject(example);
|
|
842475
842479
|
const exampleDiscriminant = fullExample == null ? void 0 : fullExample[schema2.value.discriminantProperty];
|
|
842476
842480
|
const exampleUnionVariantSchema = schema2.value.schemas[exampleDiscriminant];
|
|
842477
|
-
const
|
|
842481
|
+
const unionVariant = this.getDiscriminatedUnionVariantSchema(schema2.value, fullExample);
|
|
842478
842482
|
if (exampleDiscriminant != null && exampleUnionVariantSchema != null && exampleUnionVariantSchema.type === "object") {
|
|
842479
842483
|
allProperties = this.getAllProperties(exampleUnionVariantSchema);
|
|
842480
842484
|
requiredProperties = this.getAllRequiredProperties(exampleUnionVariantSchema);
|
|
842481
842485
|
result2[schema2.value.discriminantProperty] = FullExample.primitive(PrimitiveExample.string(exampleDiscriminant));
|
|
842482
|
-
} else if (
|
|
842483
|
-
allProperties = this.getAllProperties(
|
|
842484
|
-
requiredProperties = this.getAllRequiredProperties(
|
|
842485
|
-
result2[schema2.value.discriminantProperty] = FullExample.primitive(PrimitiveExample.string(
|
|
842486
|
+
} else if (unionVariant != null && unionVariant[1].type === "object") {
|
|
842487
|
+
allProperties = this.getAllProperties(unionVariant[1]);
|
|
842488
|
+
requiredProperties = this.getAllRequiredProperties(unionVariant[1]);
|
|
842489
|
+
result2[schema2.value.discriminantProperty] = FullExample.primitive(PrimitiveExample.string(unionVariant[0]));
|
|
842486
842490
|
} else {
|
|
842487
842491
|
return void 0;
|
|
842488
842492
|
}
|
|
@@ -842498,6 +842502,7 @@ var ExampleTypeFactory = class {
|
|
|
842498
842502
|
if (required && (fullExample == null ? void 0 : fullExample[property5]) != null) {
|
|
842499
842503
|
const propertyExample = this.buildExampleHelper({
|
|
842500
842504
|
schema: schema3,
|
|
842505
|
+
exampleId,
|
|
842501
842506
|
example: fullExample[property5],
|
|
842502
842507
|
visitedSchemaIds,
|
|
842503
842508
|
depth: depth + 1,
|
|
@@ -842510,6 +842515,7 @@ var ExampleTypeFactory = class {
|
|
|
842510
842515
|
}
|
|
842511
842516
|
} else {
|
|
842512
842517
|
const propertyExample = this.buildExampleHelper({
|
|
842518
|
+
exampleId,
|
|
842513
842519
|
schema: schema3,
|
|
842514
842520
|
example: fullExample == null ? void 0 : fullExample[property5],
|
|
842515
842521
|
visitedSchemaIds,
|
|
@@ -842526,10 +842532,12 @@ var ExampleTypeFactory = class {
|
|
|
842526
842532
|
return FullExample.oneOf(FullOneOfExample.discriminated(result2));
|
|
842527
842533
|
}
|
|
842528
842534
|
case "undisciminated": {
|
|
842529
|
-
|
|
842535
|
+
const unionVariantSchema = this.getUnDiscriminatedUnionVariantSchema(schema2.value, example);
|
|
842536
|
+
if (unionVariantSchema != null) {
|
|
842530
842537
|
return this.buildExampleHelper({
|
|
842538
|
+
exampleId,
|
|
842531
842539
|
example,
|
|
842532
|
-
schema:
|
|
842540
|
+
schema: unionVariantSchema,
|
|
842533
842541
|
visitedSchemaIds,
|
|
842534
842542
|
depth,
|
|
842535
842543
|
options: options2
|
|
@@ -842564,6 +842572,7 @@ var ExampleTypeFactory = class {
|
|
|
842564
842572
|
if (fullExample != null && fullExample.length > 0) {
|
|
842565
842573
|
for (const item of fullExample) {
|
|
842566
842574
|
const itemExample = this.buildExampleHelper({
|
|
842575
|
+
exampleId,
|
|
842567
842576
|
example: item,
|
|
842568
842577
|
schema: schema2.value,
|
|
842569
842578
|
depth: depth + 1,
|
|
@@ -842576,6 +842585,7 @@ var ExampleTypeFactory = class {
|
|
|
842576
842585
|
}
|
|
842577
842586
|
} else {
|
|
842578
842587
|
const itemExample = this.buildExampleHelper({
|
|
842588
|
+
exampleId,
|
|
842579
842589
|
example: void 0,
|
|
842580
842590
|
schema: schema2.value,
|
|
842581
842591
|
depth: depth + 1,
|
|
@@ -842599,6 +842609,7 @@ var ExampleTypeFactory = class {
|
|
|
842599
842609
|
options: options2
|
|
842600
842610
|
});
|
|
842601
842611
|
const valueExample2 = this.buildExampleHelper({
|
|
842612
|
+
exampleId,
|
|
842602
842613
|
example: value,
|
|
842603
842614
|
schema: schema2.value,
|
|
842604
842615
|
visitedSchemaIds,
|
|
@@ -842620,6 +842631,7 @@ var ExampleTypeFactory = class {
|
|
|
842620
842631
|
options: options2
|
|
842621
842632
|
});
|
|
842622
842633
|
const valueExample = this.buildExampleHelper({
|
|
842634
|
+
exampleId,
|
|
842623
842635
|
example: void 0,
|
|
842624
842636
|
schema: schema2.value,
|
|
842625
842637
|
visitedSchemaIds,
|
|
@@ -842638,13 +842650,16 @@ var ExampleTypeFactory = class {
|
|
|
842638
842650
|
}
|
|
842639
842651
|
case "object": {
|
|
842640
842652
|
const result2 = {};
|
|
842641
|
-
const
|
|
842653
|
+
const foundObjectExample = ((_b3 = schema2.fullExamples) == null ? void 0 : _b3.find((example2) => example2.name === exampleId)) ?? ((_c3 = schema2.fullExamples) == null ? void 0 : _c3.find((example2) => example2.name == null)) ?? ((_d = schema2.fullExamples) == null ? void 0 : _d[0]);
|
|
842654
|
+
const fullExample = getFullExampleAsObject(example) ?? (foundObjectExample != null ? getFullExampleAsObject(foundObjectExample.value) : {}) ?? {};
|
|
842642
842655
|
const allProperties = this.getAllProperties(schema2);
|
|
842643
842656
|
const requiredProperties = this.getAllRequiredProperties(schema2);
|
|
842644
842657
|
for (const [property5, schema3] of Object.entries(allProperties)) {
|
|
842645
842658
|
const required = property5 in requiredProperties;
|
|
842659
|
+
const inExample = Object.keys(fullExample).includes(property5);
|
|
842646
842660
|
const propertyExample = this.buildExampleHelper({
|
|
842647
842661
|
schema: schema3,
|
|
842662
|
+
exampleId,
|
|
842648
842663
|
example: fullExample[property5],
|
|
842649
842664
|
visitedSchemaIds,
|
|
842650
842665
|
depth: depth + 1,
|
|
@@ -842653,23 +842668,14 @@ var ExampleTypeFactory = class {
|
|
|
842653
842668
|
name: property5
|
|
842654
842669
|
}
|
|
842655
842670
|
});
|
|
842656
|
-
if (propertyExample != null) {
|
|
842671
|
+
if (required && propertyExample != null) {
|
|
842657
842672
|
result2[property5] = propertyExample;
|
|
842658
842673
|
} else if (required) {
|
|
842659
|
-
|
|
842660
|
-
|
|
842661
|
-
|
|
842662
|
-
|
|
842663
|
-
|
|
842664
|
-
options: {
|
|
842665
|
-
...options2,
|
|
842666
|
-
name: property5
|
|
842667
|
-
}
|
|
842668
|
-
});
|
|
842669
|
-
if (generatedExample == null) {
|
|
842670
|
-
return void 0;
|
|
842671
|
-
}
|
|
842672
|
-
result2[property5] = generatedExample;
|
|
842674
|
+
return void 0;
|
|
842675
|
+
} else if (inExample && propertyExample != null) {
|
|
842676
|
+
result2[property5] = propertyExample;
|
|
842677
|
+
} else if (!options2.ignoreOptionals && propertyExample != null) {
|
|
842678
|
+
result2[property5] = propertyExample;
|
|
842673
842679
|
}
|
|
842674
842680
|
}
|
|
842675
842681
|
return FullExample.object({
|
|
@@ -842680,6 +842686,110 @@ var ExampleTypeFactory = class {
|
|
|
842680
842686
|
assertNever(schema2);
|
|
842681
842687
|
}
|
|
842682
842688
|
}
|
|
842689
|
+
getDiscriminatedUnionVariantSchema(schema2, fullExample) {
|
|
842690
|
+
const discriminantValue = fullExample == null ? void 0 : fullExample[schema2.discriminantProperty];
|
|
842691
|
+
if (discriminantValue == null || typeof discriminantValue !== "string") {
|
|
842692
|
+
return Object.entries(schema2.schemas)[0];
|
|
842693
|
+
}
|
|
842694
|
+
const unionVariantSchema = schema2.schemas[discriminantValue];
|
|
842695
|
+
if (unionVariantSchema == null) {
|
|
842696
|
+
return Object.entries(schema2.schemas)[0];
|
|
842697
|
+
}
|
|
842698
|
+
return [discriminantValue, unionVariantSchema];
|
|
842699
|
+
}
|
|
842700
|
+
getUnDiscriminatedUnionVariantSchema(schema2, fullExample) {
|
|
842701
|
+
var _a4;
|
|
842702
|
+
if (fullExample == null) {
|
|
842703
|
+
return schema2.schemas[0];
|
|
842704
|
+
}
|
|
842705
|
+
const matches2 = schema2.schemas.map((schema3) => ({
|
|
842706
|
+
schema: schema3,
|
|
842707
|
+
heuristic: this.calcExampleHeuristic(schema3, fullExample)
|
|
842708
|
+
}));
|
|
842709
|
+
const sortedMatches = matches2.sort((a2, b2) => b2.heuristic - a2.heuristic);
|
|
842710
|
+
return (_a4 = sortedMatches[0]) == null ? void 0 : _a4.schema;
|
|
842711
|
+
}
|
|
842712
|
+
calcExampleHeuristic(schema2, fullExample) {
|
|
842713
|
+
switch (schema2.type) {
|
|
842714
|
+
case "literal": {
|
|
842715
|
+
return schema2.value.value === fullExample ? 5 : 0;
|
|
842716
|
+
}
|
|
842717
|
+
case "enum": {
|
|
842718
|
+
return enumContainsValue({ schema: schema2, value: fullExample }) ? 5 : 0;
|
|
842719
|
+
}
|
|
842720
|
+
case "object": {
|
|
842721
|
+
if (!isPlainObject(fullExample)) {
|
|
842722
|
+
return 0;
|
|
842723
|
+
}
|
|
842724
|
+
const allProperties = this.getAllProperties(schema2);
|
|
842725
|
+
let heuristic = 0;
|
|
842726
|
+
for (const [property5, schema3] of Object.entries(allProperties)) {
|
|
842727
|
+
if (fullExample[property5] != null) {
|
|
842728
|
+
heuristic++;
|
|
842729
|
+
heuristic += this.calcExampleHeuristic(schema3, fullExample[property5]);
|
|
842730
|
+
} else {
|
|
842731
|
+
heuristic--;
|
|
842732
|
+
}
|
|
842733
|
+
}
|
|
842734
|
+
return heuristic;
|
|
842735
|
+
}
|
|
842736
|
+
case "array": {
|
|
842737
|
+
if (!Array.isArray(fullExample)) {
|
|
842738
|
+
return 0;
|
|
842739
|
+
}
|
|
842740
|
+
let heuristic = 0;
|
|
842741
|
+
for (const item of fullExample) {
|
|
842742
|
+
heuristic += this.calcExampleHeuristic(schema2.value, item);
|
|
842743
|
+
}
|
|
842744
|
+
return heuristic;
|
|
842745
|
+
}
|
|
842746
|
+
case "map": {
|
|
842747
|
+
if (!isPlainObject(fullExample)) {
|
|
842748
|
+
return 0;
|
|
842749
|
+
}
|
|
842750
|
+
let heuristic = 0;
|
|
842751
|
+
for (const [, value] of Object.entries(fullExample)) {
|
|
842752
|
+
heuristic += this.calcExampleHeuristic(schema2.value, value);
|
|
842753
|
+
}
|
|
842754
|
+
return heuristic;
|
|
842755
|
+
}
|
|
842756
|
+
case "nullable":
|
|
842757
|
+
case "optional": {
|
|
842758
|
+
return this.calcExampleHeuristic(schema2.value, fullExample);
|
|
842759
|
+
}
|
|
842760
|
+
case "reference": {
|
|
842761
|
+
const resolvedSchema = this.getResolvedSchema(schema2);
|
|
842762
|
+
if (resolvedSchema == null) {
|
|
842763
|
+
return 0;
|
|
842764
|
+
}
|
|
842765
|
+
return this.calcExampleHeuristic(resolvedSchema, fullExample);
|
|
842766
|
+
}
|
|
842767
|
+
case "oneOf": {
|
|
842768
|
+
const matches2 = Object.values(schema2.value.schemas).map((schema3) => this.calcExampleHeuristic(schema3, fullExample));
|
|
842769
|
+
return matches2.sort((a2, b2) => b2 - a2)[0] ?? 0;
|
|
842770
|
+
}
|
|
842771
|
+
case "primitive": {
|
|
842772
|
+
if (fullExample == null) {
|
|
842773
|
+
return 0;
|
|
842774
|
+
}
|
|
842775
|
+
const matches2 = schema2.schema._visit({
|
|
842776
|
+
int: () => typeof fullExample === "number",
|
|
842777
|
+
int64: () => typeof fullExample === "number",
|
|
842778
|
+
float: () => typeof fullExample === "number",
|
|
842779
|
+
double: () => typeof fullExample === "number",
|
|
842780
|
+
string: () => typeof fullExample === "string",
|
|
842781
|
+
datetime: () => typeof fullExample === "string",
|
|
842782
|
+
date: () => typeof fullExample === "string",
|
|
842783
|
+
base64: () => typeof fullExample === "string",
|
|
842784
|
+
boolean: () => typeof fullExample === "boolean",
|
|
842785
|
+
_other: () => true
|
|
842786
|
+
});
|
|
842787
|
+
return matches2 ? 1 : -1;
|
|
842788
|
+
}
|
|
842789
|
+
default:
|
|
842790
|
+
return 0;
|
|
842791
|
+
}
|
|
842792
|
+
}
|
|
842683
842793
|
hasExample(schema2, depth, visitedSchemaIds = /* @__PURE__ */ new Set(), options2) {
|
|
842684
842794
|
if (this.exceedsMaxCheckerDepth(depth, options2)) {
|
|
842685
842795
|
return false;
|
|
@@ -843082,39 +843192,86 @@ var ExampleEndpointFactory = class {
|
|
|
843082
843192
|
this.logger = logger;
|
|
843083
843193
|
}
|
|
843084
843194
|
buildEndpointExample(endpoint) {
|
|
843085
|
-
var _a4, _b3, _c3;
|
|
843086
843195
|
this.logger.debug(`Building endpoint example for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843087
843196
|
const requestSchemaIdResponse = getRequestSchema(endpoint.request);
|
|
843088
843197
|
const responseSchemaIdResponse = getResponseSchema(endpoint.response);
|
|
843089
|
-
|
|
843198
|
+
if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "unsupported" || (responseSchemaIdResponse == null ? void 0 : responseSchemaIdResponse.type) === "unsupported") {
|
|
843199
|
+
return [];
|
|
843200
|
+
}
|
|
843201
|
+
const requestExamples = [];
|
|
843090
843202
|
if (requestSchemaIdResponse != null && requestSchemaIdResponse.type === "present") {
|
|
843091
843203
|
const required = this.isSchemaRequired(requestSchemaIdResponse.schema);
|
|
843092
|
-
|
|
843093
|
-
|
|
843094
|
-
|
|
843095
|
-
|
|
843096
|
-
|
|
843097
|
-
|
|
843204
|
+
if (requestSchemaIdResponse.examples.length === 0) {
|
|
843205
|
+
const example = this.exampleTypeFactory.buildExample({
|
|
843206
|
+
schema: requestSchemaIdResponse.schema,
|
|
843207
|
+
exampleId: void 0,
|
|
843208
|
+
example: void 0,
|
|
843209
|
+
options: {
|
|
843210
|
+
isParameter: false,
|
|
843211
|
+
ignoreOptionals: true
|
|
843212
|
+
}
|
|
843213
|
+
});
|
|
843214
|
+
if (example != null) {
|
|
843215
|
+
requestExamples.push([void 0, example]);
|
|
843216
|
+
}
|
|
843217
|
+
} else {
|
|
843218
|
+
for (const { name: exampleId, value: rawExample } of requestSchemaIdResponse.examples) {
|
|
843219
|
+
const example = this.exampleTypeFactory.buildExample({
|
|
843220
|
+
schema: requestSchemaIdResponse.schema,
|
|
843221
|
+
exampleId,
|
|
843222
|
+
example: rawExample,
|
|
843223
|
+
options: {
|
|
843224
|
+
isParameter: false,
|
|
843225
|
+
ignoreOptionals: true
|
|
843226
|
+
}
|
|
843227
|
+
});
|
|
843228
|
+
if (example != null) {
|
|
843229
|
+
requestExamples.push([exampleId, example]);
|
|
843230
|
+
}
|
|
843098
843231
|
}
|
|
843099
|
-
}
|
|
843100
|
-
if (required &&
|
|
843101
|
-
|
|
843232
|
+
}
|
|
843233
|
+
if (required && requestExamples.length === 0) {
|
|
843234
|
+
this.logger.warn(`Failed to generate required request example for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843235
|
+
return [];
|
|
843102
843236
|
}
|
|
843103
843237
|
}
|
|
843104
|
-
|
|
843238
|
+
const responseExamples = [];
|
|
843105
843239
|
if (responseSchemaIdResponse != null && responseSchemaIdResponse.type === "present") {
|
|
843106
843240
|
const required = this.isSchemaRequired(responseSchemaIdResponse.schema);
|
|
843107
|
-
|
|
843108
|
-
|
|
843109
|
-
|
|
843110
|
-
|
|
843111
|
-
|
|
843112
|
-
|
|
843113
|
-
|
|
843241
|
+
if (responseSchemaIdResponse.examples.length === 0) {
|
|
843242
|
+
const example = this.exampleTypeFactory.buildExample({
|
|
843243
|
+
schema: responseSchemaIdResponse.schema,
|
|
843244
|
+
exampleId: void 0,
|
|
843245
|
+
example: void 0,
|
|
843246
|
+
options: {
|
|
843247
|
+
maxDepth: 3,
|
|
843248
|
+
isParameter: false,
|
|
843249
|
+
ignoreOptionals: false
|
|
843250
|
+
}
|
|
843251
|
+
});
|
|
843252
|
+
if (example != null) {
|
|
843253
|
+
responseExamples.push([void 0, example]);
|
|
843254
|
+
}
|
|
843255
|
+
} else {
|
|
843256
|
+
for (const { name: exampleId, value: rawExample } of responseSchemaIdResponse.examples) {
|
|
843257
|
+
const example = this.exampleTypeFactory.buildExample({
|
|
843258
|
+
schema: responseSchemaIdResponse.schema,
|
|
843259
|
+
exampleId,
|
|
843260
|
+
example: rawExample,
|
|
843261
|
+
options: {
|
|
843262
|
+
maxDepth: 3,
|
|
843263
|
+
isParameter: false,
|
|
843264
|
+
ignoreOptionals: false
|
|
843265
|
+
}
|
|
843266
|
+
});
|
|
843267
|
+
if (example != null) {
|
|
843268
|
+
responseExamples.push([exampleId, example]);
|
|
843269
|
+
}
|
|
843114
843270
|
}
|
|
843115
|
-
}
|
|
843116
|
-
if (required &&
|
|
843117
|
-
|
|
843271
|
+
}
|
|
843272
|
+
if (required && responseExamples.length === 0) {
|
|
843273
|
+
this.logger.warn(`Failed to generate required response example for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843274
|
+
return [];
|
|
843118
843275
|
}
|
|
843119
843276
|
}
|
|
843120
843277
|
const pathParameters = [];
|
|
@@ -843122,6 +843279,7 @@ var ExampleEndpointFactory = class {
|
|
|
843122
843279
|
const required = this.isSchemaRequired(pathParameter.schema);
|
|
843123
843280
|
let example = this.exampleTypeFactory.buildExample({
|
|
843124
843281
|
schema: pathParameter.schema,
|
|
843282
|
+
exampleId: void 0,
|
|
843125
843283
|
example: void 0,
|
|
843126
843284
|
options: {
|
|
843127
843285
|
name: pathParameter.name,
|
|
@@ -843130,10 +843288,11 @@ var ExampleEndpointFactory = class {
|
|
|
843130
843288
|
}
|
|
843131
843289
|
});
|
|
843132
843290
|
if (example != null && !isExamplePrimitive(example)) {
|
|
843291
|
+
this.logger.warn(`Expected a primitive example but got ${example.type} for path parameter ${pathParameter.name} for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843133
843292
|
example = void 0;
|
|
843134
843293
|
}
|
|
843135
843294
|
if (required && example == null) {
|
|
843136
|
-
return
|
|
843295
|
+
return [];
|
|
843137
843296
|
} else if (example != null) {
|
|
843138
843297
|
pathParameters.push({
|
|
843139
843298
|
name: pathParameter.name,
|
|
@@ -843146,6 +843305,7 @@ var ExampleEndpointFactory = class {
|
|
|
843146
843305
|
const required = this.isSchemaRequired(queryParameter.schema);
|
|
843147
843306
|
let example = this.exampleTypeFactory.buildExample({
|
|
843148
843307
|
schema: queryParameter.schema,
|
|
843308
|
+
exampleId: void 0,
|
|
843149
843309
|
example: void 0,
|
|
843150
843310
|
options: {
|
|
843151
843311
|
name: queryParameter.name,
|
|
@@ -843154,10 +843314,11 @@ var ExampleEndpointFactory = class {
|
|
|
843154
843314
|
}
|
|
843155
843315
|
});
|
|
843156
843316
|
if (example != null && !isExamplePrimitive(example)) {
|
|
843317
|
+
this.logger.warn(`Expected a primitive example but got ${example.type} for query parameter ${queryParameter.name} for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843157
843318
|
example = void 0;
|
|
843158
843319
|
}
|
|
843159
843320
|
if (required && example == null) {
|
|
843160
|
-
return
|
|
843321
|
+
return [];
|
|
843161
843322
|
} else if (example != null) {
|
|
843162
843323
|
queryParameters.push({
|
|
843163
843324
|
name: queryParameter.name,
|
|
@@ -843170,6 +843331,7 @@ var ExampleEndpointFactory = class {
|
|
|
843170
843331
|
const required = this.isSchemaRequired(header.schema);
|
|
843171
843332
|
let example = this.exampleTypeFactory.buildExample({
|
|
843172
843333
|
schema: header.schema,
|
|
843334
|
+
exampleId: void 0,
|
|
843173
843335
|
example: void 0,
|
|
843174
843336
|
options: {
|
|
843175
843337
|
name: header.name,
|
|
@@ -843178,10 +843340,11 @@ var ExampleEndpointFactory = class {
|
|
|
843178
843340
|
}
|
|
843179
843341
|
});
|
|
843180
843342
|
if (example != null && !isExamplePrimitive(example)) {
|
|
843343
|
+
this.logger.warn(`Expected a primitive example but got ${example.type} for header ${header.name} for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
|
|
843181
843344
|
example = void 0;
|
|
843182
843345
|
}
|
|
843183
843346
|
if (required && example == null) {
|
|
843184
|
-
return
|
|
843347
|
+
return [];
|
|
843185
843348
|
} else if (example != null) {
|
|
843186
843349
|
headers.push({
|
|
843187
843350
|
name: header.name,
|
|
@@ -843189,13 +843352,7 @@ var ExampleEndpointFactory = class {
|
|
|
843189
843352
|
});
|
|
843190
843353
|
}
|
|
843191
843354
|
}
|
|
843192
|
-
|
|
843193
|
-
if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "present") {
|
|
843194
|
-
exampleName = (_c3 = requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.example) == null ? void 0 : _c3.name;
|
|
843195
|
-
if (exampleName == null && (requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.schema) != null) {
|
|
843196
|
-
exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
|
|
843197
|
-
}
|
|
843198
|
-
}
|
|
843355
|
+
const requestResponsePairs = consolidateRequestResponseExamples(requestExamples, responseExamples);
|
|
843199
843356
|
const codeSamples = endpoint.examples.filter((ex) => hasIncompleteExample(ex)).flatMap((ex) => {
|
|
843200
843357
|
if (ex.type === "unknown") {
|
|
843201
843358
|
if (ex.value != null) {
|
|
@@ -843209,15 +843366,31 @@ var ExampleEndpointFactory = class {
|
|
|
843209
843366
|
return ex.codeSamples;
|
|
843210
843367
|
}
|
|
843211
843368
|
}).filter((ex) => isNonNullish(ex));
|
|
843212
|
-
|
|
843213
|
-
|
|
843214
|
-
|
|
843215
|
-
|
|
843216
|
-
|
|
843217
|
-
|
|
843218
|
-
|
|
843219
|
-
|
|
843220
|
-
|
|
843369
|
+
if (requestResponsePairs.length === 0) {
|
|
843370
|
+
return [
|
|
843371
|
+
EndpointExample.full({
|
|
843372
|
+
name: void 0,
|
|
843373
|
+
description: void 0,
|
|
843374
|
+
pathParameters,
|
|
843375
|
+
queryParameters,
|
|
843376
|
+
headers,
|
|
843377
|
+
request: void 0,
|
|
843378
|
+
response: void 0,
|
|
843379
|
+
codeSamples
|
|
843380
|
+
})
|
|
843381
|
+
];
|
|
843382
|
+
}
|
|
843383
|
+
return requestResponsePairs.map(({ id: exampleName, request: requestExample, response: responseExample }) => {
|
|
843384
|
+
return EndpointExample.full({
|
|
843385
|
+
name: exampleName,
|
|
843386
|
+
description: void 0,
|
|
843387
|
+
pathParameters,
|
|
843388
|
+
queryParameters,
|
|
843389
|
+
headers,
|
|
843390
|
+
request: requestExample,
|
|
843391
|
+
response: responseExample,
|
|
843392
|
+
codeSamples
|
|
843393
|
+
});
|
|
843221
843394
|
});
|
|
843222
843395
|
}
|
|
843223
843396
|
convertCodeSamples(codeSamples) {
|
|
@@ -843244,18 +843417,109 @@ var ExampleEndpointFactory = class {
|
|
|
843244
843417
|
return isSchemaRequired4(this.getResolvedSchema(schema2));
|
|
843245
843418
|
}
|
|
843246
843419
|
getResolvedSchema(schema2) {
|
|
843247
|
-
while (schema2.type === "reference") {
|
|
843248
|
-
const resolvedSchema = this.schemas[schema2.schema];
|
|
843249
|
-
if (resolvedSchema == null) {
|
|
843250
|
-
throw new Error(`Unexpected error: Failed to resolve schema reference: ${schema2.schema}`);
|
|
843251
|
-
}
|
|
843252
|
-
schema2 = resolvedSchema;
|
|
843253
|
-
}
|
|
843254
843420
|
return schema2;
|
|
843255
843421
|
}
|
|
843256
843422
|
};
|
|
843423
|
+
function consolidateRequestResponseExamples(requestExamples, responseExamples) {
|
|
843424
|
+
var _a4, _b3, _c3, _d;
|
|
843425
|
+
const pairs2 = [];
|
|
843426
|
+
if (requestExamples.length <= 1) {
|
|
843427
|
+
const [requestId, requestExample] = requestExamples[0] ?? [];
|
|
843428
|
+
if (responseExamples.length === 0) {
|
|
843429
|
+
pairs2.push({
|
|
843430
|
+
id: requestId,
|
|
843431
|
+
request: requestExample,
|
|
843432
|
+
response: void 0
|
|
843433
|
+
});
|
|
843434
|
+
return pairs2;
|
|
843435
|
+
} else {
|
|
843436
|
+
for (const [responseId, responseExample] of responseExamples) {
|
|
843437
|
+
pairs2.push({
|
|
843438
|
+
id: responseId ?? requestId,
|
|
843439
|
+
request: requestExample,
|
|
843440
|
+
response: responseExample
|
|
843441
|
+
});
|
|
843442
|
+
}
|
|
843443
|
+
}
|
|
843444
|
+
return pairs2;
|
|
843445
|
+
}
|
|
843446
|
+
if (responseExamples.length <= 1) {
|
|
843447
|
+
const [responseId, responseExample] = responseExamples[0] ?? [];
|
|
843448
|
+
if (responseExamples.length === 0) {
|
|
843449
|
+
pairs2.push({
|
|
843450
|
+
id: responseId,
|
|
843451
|
+
request: void 0,
|
|
843452
|
+
response: responseExample
|
|
843453
|
+
});
|
|
843454
|
+
return pairs2;
|
|
843455
|
+
} else {
|
|
843456
|
+
for (const [requestId, requestExample] of requestExamples) {
|
|
843457
|
+
pairs2.push({
|
|
843458
|
+
id: requestId ?? responseId,
|
|
843459
|
+
request: requestExample,
|
|
843460
|
+
response: responseExample
|
|
843461
|
+
});
|
|
843462
|
+
}
|
|
843463
|
+
}
|
|
843464
|
+
return pairs2;
|
|
843465
|
+
}
|
|
843466
|
+
const visitedResponseIdx = /* @__PURE__ */ new Set();
|
|
843467
|
+
for (const [requestId, requestExample] of requestExamples) {
|
|
843468
|
+
const fallbackResponseExample = ((_a4 = responseExamples.find(([responseId]) => responseId == null)) == null ? void 0 : _a4[1]) ?? ((_b3 = responseExamples[0]) == null ? void 0 : _b3[1]);
|
|
843469
|
+
if (requestId == null) {
|
|
843470
|
+
if (fallbackResponseExample == null) {
|
|
843471
|
+
continue;
|
|
843472
|
+
}
|
|
843473
|
+
pairs2.push({
|
|
843474
|
+
id: void 0,
|
|
843475
|
+
request: requestExample,
|
|
843476
|
+
response: fallbackResponseExample
|
|
843477
|
+
});
|
|
843478
|
+
continue;
|
|
843479
|
+
}
|
|
843480
|
+
let paired = false;
|
|
843481
|
+
for (let idx = 0; idx < responseExamples.length; idx++) {
|
|
843482
|
+
const [responseId, responseExample] = responseExamples[idx];
|
|
843483
|
+
if (responseId != null || visitedResponseIdx.has(idx)) {
|
|
843484
|
+
continue;
|
|
843485
|
+
}
|
|
843486
|
+
if (requestId === responseId) {
|
|
843487
|
+
pairs2.push({
|
|
843488
|
+
id: requestId,
|
|
843489
|
+
request: requestExample,
|
|
843490
|
+
response: responseExample
|
|
843491
|
+
});
|
|
843492
|
+
if (responseId != null) {
|
|
843493
|
+
visitedResponseIdx.add(idx);
|
|
843494
|
+
}
|
|
843495
|
+
paired = true;
|
|
843496
|
+
}
|
|
843497
|
+
}
|
|
843498
|
+
if (!paired && fallbackResponseExample != null) {
|
|
843499
|
+
pairs2.push({
|
|
843500
|
+
id: requestId,
|
|
843501
|
+
request: requestExample,
|
|
843502
|
+
response: fallbackResponseExample
|
|
843503
|
+
});
|
|
843504
|
+
}
|
|
843505
|
+
}
|
|
843506
|
+
for (let idx = 0; idx < responseExamples.length; idx++) {
|
|
843507
|
+
if (visitedResponseIdx.has(idx)) {
|
|
843508
|
+
continue;
|
|
843509
|
+
}
|
|
843510
|
+
const [responseId, responseExample] = responseExamples[idx];
|
|
843511
|
+
const requestExample = ((_c3 = requestExamples.find(([requestId]) => requestId == null)) == null ? void 0 : _c3[1]) ?? ((_d = requestExamples[0]) == null ? void 0 : _d[1]);
|
|
843512
|
+
if (requestExample != null) {
|
|
843513
|
+
pairs2.push({
|
|
843514
|
+
id: responseId,
|
|
843515
|
+
request: requestExample,
|
|
843516
|
+
response: responseExample
|
|
843517
|
+
});
|
|
843518
|
+
}
|
|
843519
|
+
}
|
|
843520
|
+
return pairs2;
|
|
843521
|
+
}
|
|
843257
843522
|
function getRequestSchema(request) {
|
|
843258
|
-
var _a4;
|
|
843259
843523
|
if (request == null) {
|
|
843260
843524
|
return void 0;
|
|
843261
843525
|
}
|
|
@@ -843263,23 +843527,22 @@ function getRequestSchema(request) {
|
|
|
843263
843527
|
return {
|
|
843264
843528
|
type: "present",
|
|
843265
843529
|
schema: convertMultipartRequestToSchema(request),
|
|
843266
|
-
|
|
843530
|
+
examples: []
|
|
843267
843531
|
};
|
|
843268
843532
|
}
|
|
843269
843533
|
if (request.type === "json") {
|
|
843270
|
-
return { type: "present", schema: request.schema,
|
|
843534
|
+
return { type: "present", schema: request.schema, examples: request.fullExamples ?? [] };
|
|
843271
843535
|
}
|
|
843272
843536
|
return { type: "unsupported" };
|
|
843273
843537
|
}
|
|
843274
843538
|
function getResponseSchema(response) {
|
|
843275
|
-
var _a4;
|
|
843276
843539
|
if (response == null) {
|
|
843277
843540
|
return void 0;
|
|
843278
843541
|
}
|
|
843279
843542
|
if (response.type !== "json") {
|
|
843280
843543
|
return { type: "unsupported" };
|
|
843281
843544
|
}
|
|
843282
|
-
return { type: "present", schema: response.schema,
|
|
843545
|
+
return { type: "present", schema: response.schema, examples: response.fullExamples ?? [] };
|
|
843283
843546
|
}
|
|
843284
843547
|
function isExamplePrimitive(example) {
|
|
843285
843548
|
switch (example.type) {
|
|
@@ -843306,34 +843569,6 @@ function isExamplePrimitive(example) {
|
|
|
843306
843569
|
assertNever(example);
|
|
843307
843570
|
}
|
|
843308
843571
|
}
|
|
843309
|
-
function getNameFromSchemaWithExample(schema2) {
|
|
843310
|
-
var _a4, _b3;
|
|
843311
|
-
switch (schema2.type) {
|
|
843312
|
-
case "primitive":
|
|
843313
|
-
case "enum":
|
|
843314
|
-
case "literal":
|
|
843315
|
-
case "unknown":
|
|
843316
|
-
case "array":
|
|
843317
|
-
case "map":
|
|
843318
|
-
case "optional":
|
|
843319
|
-
case "nullable":
|
|
843320
|
-
case "reference":
|
|
843321
|
-
return void 0;
|
|
843322
|
-
case "object":
|
|
843323
|
-
return ((_b3 = (_a4 = schema2.fullExamples) == null ? void 0 : _a4[0]) == null ? void 0 : _b3.name) ?? void 0;
|
|
843324
|
-
case "oneOf":
|
|
843325
|
-
switch (schema2.value.type) {
|
|
843326
|
-
case "discriminated":
|
|
843327
|
-
return void 0;
|
|
843328
|
-
case "undisciminated":
|
|
843329
|
-
return void 0;
|
|
843330
|
-
default:
|
|
843331
|
-
return void 0;
|
|
843332
|
-
}
|
|
843333
|
-
default:
|
|
843334
|
-
assertNever(schema2);
|
|
843335
|
-
}
|
|
843336
|
-
}
|
|
843337
843572
|
function convertMultipartRequestToSchema(request) {
|
|
843338
843573
|
return SchemaWithExample.object({
|
|
843339
843574
|
properties: request.properties.map((property5) => {
|
|
@@ -843375,6 +843610,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843375
843610
|
const required = this.isSchemaRequired(queryParameter.schema);
|
|
843376
843611
|
let example = this.exampleTypeFactory.buildExample({
|
|
843377
843612
|
schema: queryParameter.schema,
|
|
843613
|
+
exampleId: void 0,
|
|
843378
843614
|
example: (_a4 = extensionExample.queryParameters) == null ? void 0 : _a4[queryParameter.name],
|
|
843379
843615
|
options: {
|
|
843380
843616
|
name: queryParameter.name,
|
|
@@ -843399,6 +843635,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843399
843635
|
const required = this.isSchemaRequired(header.schema);
|
|
843400
843636
|
let example = this.exampleTypeFactory.buildExample({
|
|
843401
843637
|
schema: header.schema,
|
|
843638
|
+
exampleId: void 0,
|
|
843402
843639
|
example: (_b3 = extensionExample.headers) == null ? void 0 : _b3[header.name],
|
|
843403
843640
|
options: {
|
|
843404
843641
|
name: header.name,
|
|
@@ -843426,6 +843663,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843426
843663
|
const resolvedSchema = isReferenceObject(messageSchema.payload) ? context.resolveSchemaReference(messageSchema.payload) : messageSchema.payload;
|
|
843427
843664
|
const example = this.exampleTypeFactory.buildExample({
|
|
843428
843665
|
schema: convertSchema(resolvedSchema, false, context, [messageExample.messageId]),
|
|
843666
|
+
exampleId: void 0,
|
|
843429
843667
|
example: messageExample.value,
|
|
843430
843668
|
options: {
|
|
843431
843669
|
isParameter: false,
|
|
@@ -843463,6 +843701,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843463
843701
|
const required = this.isSchemaRequired(queryParameter.schema);
|
|
843464
843702
|
let example2 = this.exampleTypeFactory.buildExample({
|
|
843465
843703
|
schema: queryParameter.schema,
|
|
843704
|
+
exampleId: void 0,
|
|
843466
843705
|
example: void 0,
|
|
843467
843706
|
options: {
|
|
843468
843707
|
name: queryParameter.name,
|
|
@@ -843487,6 +843726,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843487
843726
|
const required = this.isSchemaRequired(header.schema);
|
|
843488
843727
|
let example2 = this.exampleTypeFactory.buildExample({
|
|
843489
843728
|
schema: header.schema,
|
|
843729
|
+
exampleId: void 0,
|
|
843490
843730
|
example: void 0,
|
|
843491
843731
|
options: {
|
|
843492
843732
|
name: header.name,
|
|
@@ -843509,6 +843749,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843509
843749
|
if (publish2 != null) {
|
|
843510
843750
|
const publishMessageExample = this.exampleTypeFactory.buildExample({
|
|
843511
843751
|
schema: publish2,
|
|
843752
|
+
exampleId: void 0,
|
|
843512
843753
|
example: void 0,
|
|
843513
843754
|
options: {
|
|
843514
843755
|
isParameter: false,
|
|
@@ -843526,6 +843767,7 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
843526
843767
|
if (subscribe != null) {
|
|
843527
843768
|
const publishMessageExample = this.exampleTypeFactory.buildExample({
|
|
843528
843769
|
schema: subscribe,
|
|
843770
|
+
exampleId: void 0,
|
|
843529
843771
|
example: void 0,
|
|
843530
843772
|
options: {
|
|
843531
843773
|
isParameter: false,
|
|
@@ -843843,7 +844085,7 @@ function maybeTrimRequestPrefix(streamCondition) {
|
|
|
843843
844085
|
}
|
|
843844
844086
|
|
|
843845
844087
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/endpoint/getApplicationJsonSchema.js
|
|
843846
|
-
function getApplicationJsonSchemaMediaObject(media) {
|
|
844088
|
+
function getApplicationJsonSchemaMediaObject(media, context) {
|
|
843847
844089
|
for (const contentType of Object.keys(media)) {
|
|
843848
844090
|
if (contentType.includes("json")) {
|
|
843849
844091
|
const mediaObject = media[contentType];
|
|
@@ -843862,11 +844104,9 @@ function getApplicationJsonSchemaMediaObject(media) {
|
|
|
843862
844104
|
}));
|
|
843863
844105
|
}
|
|
843864
844106
|
if (mediaObject.examples != null && Object.keys(mediaObject.examples).length > 0) {
|
|
843865
|
-
fullExamples.push(...Object.entries(mediaObject.examples).map(([name2,
|
|
843866
|
-
|
|
843867
|
-
|
|
843868
|
-
}
|
|
843869
|
-
return { name: value.summary ?? name2, value: value.value };
|
|
844107
|
+
fullExamples.push(...Object.entries(mediaObject.examples).map(([name2, example]) => {
|
|
844108
|
+
const resolvedExample = isReferenceObject(example) ? context.resolveExampleReference(example) : example;
|
|
844109
|
+
return { name: resolvedExample.summary ?? name2, value: resolvedExample.value };
|
|
843870
844110
|
}));
|
|
843871
844111
|
}
|
|
843872
844112
|
if (schema2 != null) {
|
|
@@ -843903,7 +844143,7 @@ function multipartRequestHasFile(multipartSchema, document4) {
|
|
|
843903
844143
|
function convertRequest({ requestBody, document: document4, context, requestBreadcrumbs }) {
|
|
843904
844144
|
const resolvedRequestBody = isReferenceObject(requestBody) ? context.resolveRequestBodyReference(requestBody) : requestBody;
|
|
843905
844145
|
const multipartSchema = getMultipartFormDataRequest(resolvedRequestBody);
|
|
843906
|
-
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedRequestBody.content);
|
|
844146
|
+
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedRequestBody.content, context);
|
|
843907
844147
|
if (isOctetStreamRequest(resolvedRequestBody)) {
|
|
843908
844148
|
return RequestWithExample.octetStream({
|
|
843909
844149
|
description: void 0
|
|
@@ -844054,6 +844294,7 @@ function removeApplicationJsonAndMultipartConflictsFromRequestBody(requestBody)
|
|
|
844054
844294
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/AbstractOpenAPIV3ParserContext.js
|
|
844055
844295
|
var PARAMETER_REFERENCE_PREFIX = "#/components/parameters/";
|
|
844056
844296
|
var RESPONSE_REFERENCE_PREFIX = "#/components/responses/";
|
|
844297
|
+
var EXAMPLES_REFERENCE_PREFIX = "#/components/examples/";
|
|
844057
844298
|
var REQUEST_BODY_REFERENCE_PREFIX = "#/components/requestBodies/";
|
|
844058
844299
|
var AbstractOpenAPIV3ParserContext = class {
|
|
844059
844300
|
logger;
|
|
@@ -844132,6 +844373,20 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
844132
844373
|
}
|
|
844133
844374
|
return resolvedResponse;
|
|
844134
844375
|
}
|
|
844376
|
+
resolveExampleReference(example) {
|
|
844377
|
+
if (this.document.components == null || this.document.components.examples == null || !example.$ref.startsWith(EXAMPLES_REFERENCE_PREFIX)) {
|
|
844378
|
+
throw new Error(`Failed to resolve ${example.$ref}`);
|
|
844379
|
+
}
|
|
844380
|
+
const parameterKey = example.$ref.substring(EXAMPLES_REFERENCE_PREFIX.length);
|
|
844381
|
+
const resolvedExample = this.document.components.examples[parameterKey];
|
|
844382
|
+
if (resolvedExample == null) {
|
|
844383
|
+
throw new Error(`${example.$ref} is undefined`);
|
|
844384
|
+
}
|
|
844385
|
+
if (isReferenceObject(resolvedExample)) {
|
|
844386
|
+
return this.resolveExampleReference(resolvedExample);
|
|
844387
|
+
}
|
|
844388
|
+
return resolvedExample;
|
|
844389
|
+
}
|
|
844135
844390
|
};
|
|
844136
844391
|
|
|
844137
844392
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/DummyOpenAPIV3ParserContext.js
|
|
@@ -844416,7 +844671,7 @@ function convertResolvedResponse({ operationContext, isStreaming, response, cont
|
|
|
844416
844671
|
return ResponseWithExample.file({ description: resolvedResponse.description });
|
|
844417
844672
|
}
|
|
844418
844673
|
}
|
|
844419
|
-
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedResponse.content ?? {});
|
|
844674
|
+
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedResponse.content ?? {}, context);
|
|
844420
844675
|
if (jsonMediaObject != null) {
|
|
844421
844676
|
if (isStreaming) {
|
|
844422
844677
|
return ResponseWithExample.streamingJson({
|
|
@@ -844466,7 +844721,7 @@ function markErrorSchemas({ responses, context }) {
|
|
|
844466
844721
|
}
|
|
844467
844722
|
errorStatusCodes.push(parsedStatusCode);
|
|
844468
844723
|
const resolvedResponse = isReferenceObject(response) ? context.resolveResponseReference(response) : response;
|
|
844469
|
-
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedResponse.content ?? {});
|
|
844724
|
+
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedResponse.content ?? {}, context);
|
|
844470
844725
|
context.markSchemaForStatusCode(parsedStatusCode, (jsonMediaObject == null ? void 0 : jsonMediaObject.schema) ?? {});
|
|
844471
844726
|
}
|
|
844472
844727
|
return errorStatusCodes;
|
|
@@ -844703,7 +844958,7 @@ function getRequestBody2({ context, operation, streamingExtension, isStreaming }
|
|
|
844703
844958
|
return void 0;
|
|
844704
844959
|
}
|
|
844705
844960
|
const resolvedRequestBody = isReferenceObject(operation.requestBody) ? context.resolveRequestBodyReference(operation.requestBody) : operation.requestBody;
|
|
844706
|
-
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedRequestBody.content);
|
|
844961
|
+
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedRequestBody.content, context);
|
|
844707
844962
|
if (jsonMediaObject == null) {
|
|
844708
844963
|
return void 0;
|
|
844709
844964
|
}
|
|
@@ -845408,9 +845663,9 @@ function generateIr({ openApi, taskContext, disableExamples }) {
|
|
|
845408
845663
|
let examples = extensionExamples;
|
|
845409
845664
|
if (!disableExamples && (extensionExamples.length === 0 || extensionExamples.every(hasIncompleteExample))) {
|
|
845410
845665
|
const endpointExample = exampleEndpointFactory.buildEndpointExample(endpointWithExample);
|
|
845411
|
-
if (endpointExample
|
|
845666
|
+
if (endpointExample.length > 0) {
|
|
845412
845667
|
examples = [
|
|
845413
|
-
endpointExample,
|
|
845668
|
+
...endpointExample,
|
|
845414
845669
|
...extensionExamples.filter((example) => !hasIncompleteExample(example))
|
|
845415
845670
|
];
|
|
845416
845671
|
}
|
|
@@ -851457,10 +851712,10 @@ var CliContext = class {
|
|
|
851457
851712
|
return "fern-api";
|
|
851458
851713
|
}
|
|
851459
851714
|
getPackageVersion() {
|
|
851460
|
-
if ("0.
|
|
851715
|
+
if ("0.22.0-rc1" == null) {
|
|
851461
851716
|
this.logger.error("CLI_VERSION is not defined");
|
|
851462
851717
|
}
|
|
851463
|
-
return "0.
|
|
851718
|
+
return "0.22.0-rc1";
|
|
851464
851719
|
}
|
|
851465
851720
|
getCliName() {
|
|
851466
851721
|
if ("fern" == null) {
|