@conduit-client/model 3.12.0 → 3.13.1

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.
Files changed (27) hide show
  1. package/dist/types/v1/api/endpoint.d.ts +1 -1
  2. package/dist/types/v1/api/validation/bindings.d.ts +1 -1
  3. package/dist/types/v1/api/validation/endpoint/index.d.ts +1 -1
  4. package/dist/types/v1/api/validation/index.d.ts +1 -1
  5. package/dist/types/v1/api/validation/operation/BodyDataValidator.d.ts +2 -2
  6. package/dist/types/v1/api/validation/operation/InvalidationValidator.d.ts +6 -4
  7. package/dist/types/v1/api/validation/operation/KeyMatchValidator.d.ts +1 -1
  8. package/dist/types/v1/api/validation/operation/KeySourceValidator.d.ts +3 -3
  9. package/dist/types/v1/api/validation/operation/NoNormalizedTypesValidator.d.ts +1 -1
  10. package/dist/types/v1/api/validation/operation/Response200Validator.d.ts +1 -1
  11. package/dist/types/v1/api/validation/operation/index.d.ts +2 -2
  12. package/dist/types/v1/api/validation/operation/utils.d.ts +3 -2
  13. package/dist/types/v1/parser/amf/endpoints/amf-operation.d.ts +2 -2
  14. package/dist/types/v1/parser/amf/types/AMFDiscriminatedObjectType.d.ts +3 -2
  15. package/dist/types/v1/parser/parser-utils.d.ts +1 -1
  16. package/dist/types/v1/parser/swagger/SwaggerAPI.d.ts +3 -2
  17. package/dist/types/v1/parser/swagger/endpoints/swagger-operation.d.ts +2 -2
  18. package/dist/types/v1/parser/swagger/swagger-utils.d.ts +3 -0
  19. package/dist/types/v1/parser/swagger/version.d.ts +1 -1
  20. package/dist/types/v1/parser/zod-schemas.d.ts +2 -2
  21. package/dist/types/v1/types/types-equal.d.ts +1 -1
  22. package/dist/types/v1/types/utils.d.ts +1 -1
  23. package/dist/types/v1/types/validators/extensions/KeyFieldReferenceValidator.d.ts +1 -1
  24. package/dist/types/v1/types/validators/extensions/KeySourcesValidator.d.ts +2 -2
  25. package/dist/v1/index.js +225 -209
  26. package/dist/v1/index.js.map +1 -1
  27. package/package.json +5 -3
package/dist/v1/index.js CHANGED
@@ -7,7 +7,6 @@ import * as url from "url";
7
7
  import amf from "amf-client-js";
8
8
  import path from "path";
9
9
  import SwaggerParser from "@apidevtools/swagger-parser";
10
- import { MissingPointerError, ResolverError } from "@apidevtools/json-schema-ref-parser";
11
10
  const BindingTypesEnum = ["wire", "imperative", "imperative-legacy", "mutation"];
12
11
  class BaseTypeRegistry extends Map {
13
12
  nameOf(t) {
@@ -140,6 +139,32 @@ function stringIsVersion(s) {
140
139
  const versionParts = s.split(".");
141
140
  return (versionParts.length === 2 || versionParts.length === 3) && versionParts.every((part) => part.match(/^\d+$/));
142
141
  }
142
+ var ValidationType = /* @__PURE__ */ ((ValidationType2) => {
143
+ ValidationType2["Api"] = "api";
144
+ ValidationType2["Type"] = "type";
145
+ ValidationType2["Operation"] = "operation";
146
+ ValidationType2["EndPoint"] = "endpoint";
147
+ return ValidationType2;
148
+ })(ValidationType || {});
149
+ var ValidationSeverity = /* @__PURE__ */ ((ValidationSeverity2) => {
150
+ ValidationSeverity2["Info"] = "info";
151
+ ValidationSeverity2["Warning"] = "warn";
152
+ ValidationSeverity2["Error"] = "error";
153
+ return ValidationSeverity2;
154
+ })(ValidationSeverity || {});
155
+ function combineValidationResults(results) {
156
+ const isValid2 = results.every((r) => r.isOk());
157
+ const messages = results.map((r) => r.isOk() ? r.value : r.error).flat();
158
+ return isValid2 ? ok(messages) : err(messages);
159
+ }
160
+ function compose(validators) {
161
+ return {
162
+ validate(subject) {
163
+ const results = validators.map((v) => v.validate(subject));
164
+ return combineValidationResults(results);
165
+ }
166
+ };
167
+ }
143
168
  function isRefType(type) {
144
169
  return type.type === "ref";
145
170
  }
@@ -248,32 +273,6 @@ class KeyFieldReferenceValidator {
248
273
  return ok([]);
249
274
  }
250
275
  }
251
- var ValidationType = /* @__PURE__ */ ((ValidationType2) => {
252
- ValidationType2["Api"] = "api";
253
- ValidationType2["Type"] = "type";
254
- ValidationType2["Operation"] = "operation";
255
- ValidationType2["EndPoint"] = "endpoint";
256
- return ValidationType2;
257
- })(ValidationType || {});
258
- var ValidationSeverity = /* @__PURE__ */ ((ValidationSeverity2) => {
259
- ValidationSeverity2["Info"] = "info";
260
- ValidationSeverity2["Warning"] = "warn";
261
- ValidationSeverity2["Error"] = "error";
262
- return ValidationSeverity2;
263
- })(ValidationSeverity || {});
264
- function combineValidationResults(results) {
265
- const isValid2 = results.every((r) => r.isOk());
266
- const messages = results.map((r) => r.isOk() ? r.value : r.error).flat();
267
- return isValid2 ? ok(messages) : err(messages);
268
- }
269
- function compose(validators) {
270
- return {
271
- validate(subject) {
272
- const results = validators.map((v) => v.validate(subject));
273
- return combineValidationResults(results);
274
- }
275
- };
276
- }
277
276
  function getFormattedMessage$1(subject, message, severity = ValidationSeverity.Error) {
278
277
  return {
279
278
  validationType: ValidationType.Type,
@@ -5386,161 +5385,6 @@ function formatZodError(err2) {
5386
5385
  });
5387
5386
  return `${formattedIssues.map((iss) => `- ${iss}`).join("\n")}`;
5388
5387
  }
5389
- const STRING_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#string";
5390
- const BOOLEAN_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#boolean";
5391
- const INTEGER_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#integer";
5392
- const LONG_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#long";
5393
- const FLOAT_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#float";
5394
- const DOUBLE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#double";
5395
- const NUMBER_DATA_TYPE = "http://a.ml/vocabularies/shapes#number";
5396
- const DATE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#date";
5397
- const TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#time";
5398
- const PASSWORD_DATA_TYPE = "http://a.ml/vocabularies/shapes#password";
5399
- const BYTE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#byte";
5400
- const BINARY_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#base64Binary";
5401
- const DATETIME_ONLY_TYPE = "http://a.ml/vocabularies/shapes#dateTimeOnly";
5402
- const DATETIME_TYPE = "http://www.w3.org/2001/XMLSchema#dateTime";
5403
- const DATATYPE_TO_SCALAR_TYPE = {
5404
- [BOOLEAN_DATA_TYPE]: "boolean",
5405
- [DOUBLE_DATA_TYPE]: "double",
5406
- [FLOAT_DATA_TYPE]: "number",
5407
- [INTEGER_DATA_TYPE]: "integer",
5408
- [LONG_DATA_TYPE]: "integer",
5409
- [NUMBER_DATA_TYPE]: "number",
5410
- [STRING_DATA_TYPE]: "string",
5411
- [DATE_DATA_TYPE]: "date",
5412
- [TIME_DATA_TYPE]: "time",
5413
- [PASSWORD_DATA_TYPE]: "string",
5414
- [BYTE_DATA_TYPE]: "string",
5415
- [BINARY_DATA_TYPE]: "string",
5416
- [DATETIME_ONLY_TYPE]: "datetime-only",
5417
- [DATETIME_TYPE]: "datetime"
5418
- };
5419
- function isTypeShape(domainElement) {
5420
- return domainElement instanceof amf.AnyShape;
5421
- }
5422
- function isAnyShape(domainElement) {
5423
- return Object.getPrototypeOf(domainElement) === amf.AnyShape.prototype;
5424
- }
5425
- function isNilShape(shape) {
5426
- return shape instanceof amf.NilShape;
5427
- }
5428
- function isNodeShape(node) {
5429
- return node instanceof amf.NodeShape;
5430
- }
5431
- function isArrayShape(node) {
5432
- return node instanceof amf.ArrayShape;
5433
- }
5434
- function isScalarShape(shape) {
5435
- return shape instanceof amf.ScalarShape;
5436
- }
5437
- function isRefShape(shape) {
5438
- return shape.isLink;
5439
- }
5440
- function isAnyOfShape(shape) {
5441
- return (shape.or || []).length > 0;
5442
- }
5443
- function isOneOfShape(shape) {
5444
- const isAmfOneOfShape = shape instanceof amf.UnionShape;
5445
- const hasOneOf = (shape.xone || []).length > 0;
5446
- const isDiscriminatedObject = isNodeShape(shape) && !shape.discriminator.isNullOrEmpty;
5447
- return isAmfOneOfShape || hasOneOf && !isDiscriminatedObject;
5448
- }
5449
- function isAllOfShape(shape) {
5450
- return (shape.and || []).length > 0 || isOneOfShape(shape) && !(shape instanceof amf.UnionShape) || isEnumShape(shape);
5451
- }
5452
- function isNotShape(shape) {
5453
- return !!shape.not;
5454
- }
5455
- function isScalarNode(node) {
5456
- return node instanceof amf.ScalarNode;
5457
- }
5458
- function isEnumShape(shape) {
5459
- return shape.values.length > 0;
5460
- }
5461
- function getEnumValuesFromShape(shape) {
5462
- return shape.values.map((val) => extractScalarEnumValue(val, shape));
5463
- }
5464
- function extractScalarEnumValue(node, parentShape) {
5465
- if (isScalarNode(node)) {
5466
- const scalarType = DATATYPE_TO_SCALAR_TYPE[node.dataType.value()];
5467
- switch (scalarType) {
5468
- case "datetime":
5469
- return String(node.value.value());
5470
- default:
5471
- return coerceValueByType(node.value.value(), {
5472
- type: scalarType
5473
- });
5474
- }
5475
- } else {
5476
- throw new Error(
5477
- `Invalid non-scalar enum value provided for shape ${parentShape.name.value()}`
5478
- );
5479
- }
5480
- }
5481
- function coerceValueByType(value, type) {
5482
- switch (type.type) {
5483
- case "string":
5484
- return String(value);
5485
- case "boolean":
5486
- return value === "true";
5487
- case "number":
5488
- case "double":
5489
- case "integer":
5490
- return Number(value);
5491
- default:
5492
- return value;
5493
- }
5494
- }
5495
- const DATA_SCALAR_PROPERTY_NAME = "http://a.ml/vocabularies/data#Scalar";
5496
- const DATA_OBJECT_PROPERTY_NAME = "http://a.ml/vocabularies/data#Object";
5497
- const DATA_ARRAY_PROPERTY_NAME = "http://a.ml/vocabularies/data#Array";
5498
- const DATA_DATATYPE_PROPERTY_NAME = "http://www.w3.org/ns/shacl#datatype";
5499
- const DATA_VALUE_PROPERTY_NAME = "http://a.ml/vocabularies/data#value";
5500
- const NAME_PROPERTY_VALUE = "http://a.ml/vocabularies/core#name";
5501
- function extractExtensions$1(customDomainProperties) {
5502
- let extensions = {};
5503
- (customDomainProperties || []).forEach((cdp) => {
5504
- const name = cdp.name.value();
5505
- const graph = cdp.extension.graph();
5506
- extensions[name] = extractExtensionsFromGraph(graph);
5507
- });
5508
- return extensions;
5509
- }
5510
- function extractExtensionsFromGraph(graph) {
5511
- if (isObject(graph)) {
5512
- return buildExtensionsObject(graph);
5513
- }
5514
- if (isArray(graph)) {
5515
- return buildExtensionsArray(graph);
5516
- }
5517
- if (isScalar$1(graph)) {
5518
- return buildExtensionScalar(graph);
5519
- }
5520
- throw new Error(`Unsupported AMF graph type: ${graph.types()}`);
5521
- }
5522
- const isScalar$1 = (graph) => graph.types().includes(DATA_SCALAR_PROPERTY_NAME);
5523
- const isObject = (graph) => graph.types().includes(DATA_OBJECT_PROPERTY_NAME);
5524
- const isArray = (graph) => graph.types().includes(DATA_ARRAY_PROPERTY_NAME);
5525
- function buildExtensionsObject(graph) {
5526
- let extensions = {};
5527
- graph.properties().filter((prop) => prop !== NAME_PROPERTY_VALUE).forEach((fullname) => {
5528
- const name = fullname.split("#")[1];
5529
- const propGraph = graph.getObjectByProperty(fullname)[0].graph();
5530
- extensions[name] = extractExtensionsFromGraph(propGraph);
5531
- });
5532
- return extensions;
5533
- }
5534
- function buildExtensionsArray(graph) {
5535
- const propertyUri = "http://www.w3.org/2000/01/rdf-schema#member";
5536
- return graph.getObjectByProperty(propertyUri).map((item) => extractExtensionsFromGraph(item.graph()));
5537
- }
5538
- function buildExtensionScalar(graph) {
5539
- const rawType = graph.scalarByProperty(DATA_DATATYPE_PROPERTY_NAME)[0];
5540
- const rawValue = graph.scalarByProperty(DATA_VALUE_PROPERTY_NAME)[0];
5541
- const value = [DOUBLE_DATA_TYPE, INTEGER_DATA_TYPE, NUMBER_DATA_TYPE].includes(rawType) ? Number(rawValue) : rawType === BOOLEAN_DATA_TYPE ? rawValue === "true" : String(rawValue);
5542
- return value;
5543
- }
5544
5388
  const rootExtensionSchema = z.object({
5545
5389
  onestore: z.object({
5546
5390
  version: z.string().refine(stringIsVersion, () => {
@@ -5943,6 +5787,161 @@ class OperationSchemaBuilder {
5943
5787
  );
5944
5788
  }
5945
5789
  }
5790
+ const STRING_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#string";
5791
+ const BOOLEAN_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#boolean";
5792
+ const INTEGER_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#integer";
5793
+ const LONG_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#long";
5794
+ const FLOAT_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#float";
5795
+ const DOUBLE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#double";
5796
+ const NUMBER_DATA_TYPE = "http://a.ml/vocabularies/shapes#number";
5797
+ const DATE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#date";
5798
+ const TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#time";
5799
+ const PASSWORD_DATA_TYPE = "http://a.ml/vocabularies/shapes#password";
5800
+ const BYTE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#byte";
5801
+ const BINARY_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#base64Binary";
5802
+ const DATETIME_ONLY_TYPE = "http://a.ml/vocabularies/shapes#dateTimeOnly";
5803
+ const DATETIME_TYPE = "http://www.w3.org/2001/XMLSchema#dateTime";
5804
+ const DATATYPE_TO_SCALAR_TYPE = {
5805
+ [BOOLEAN_DATA_TYPE]: "boolean",
5806
+ [DOUBLE_DATA_TYPE]: "double",
5807
+ [FLOAT_DATA_TYPE]: "number",
5808
+ [INTEGER_DATA_TYPE]: "integer",
5809
+ [LONG_DATA_TYPE]: "integer",
5810
+ [NUMBER_DATA_TYPE]: "number",
5811
+ [STRING_DATA_TYPE]: "string",
5812
+ [DATE_DATA_TYPE]: "date",
5813
+ [TIME_DATA_TYPE]: "time",
5814
+ [PASSWORD_DATA_TYPE]: "string",
5815
+ [BYTE_DATA_TYPE]: "string",
5816
+ [BINARY_DATA_TYPE]: "string",
5817
+ [DATETIME_ONLY_TYPE]: "datetime-only",
5818
+ [DATETIME_TYPE]: "datetime"
5819
+ };
5820
+ function isTypeShape(domainElement) {
5821
+ return domainElement instanceof amf.AnyShape;
5822
+ }
5823
+ function isAnyShape(domainElement) {
5824
+ return Object.getPrototypeOf(domainElement) === amf.AnyShape.prototype;
5825
+ }
5826
+ function isNilShape(shape) {
5827
+ return shape instanceof amf.NilShape;
5828
+ }
5829
+ function isNodeShape(node) {
5830
+ return node instanceof amf.NodeShape;
5831
+ }
5832
+ function isArrayShape(node) {
5833
+ return node instanceof amf.ArrayShape;
5834
+ }
5835
+ function isScalarShape(shape) {
5836
+ return shape instanceof amf.ScalarShape;
5837
+ }
5838
+ function isRefShape(shape) {
5839
+ return shape.isLink;
5840
+ }
5841
+ function isAnyOfShape(shape) {
5842
+ return (shape.or || []).length > 0;
5843
+ }
5844
+ function isOneOfShape(shape) {
5845
+ const isAmfOneOfShape = shape instanceof amf.UnionShape;
5846
+ const hasOneOf = (shape.xone || []).length > 0;
5847
+ const isDiscriminatedObject = isNodeShape(shape) && !shape.discriminator.isNullOrEmpty;
5848
+ return isAmfOneOfShape || hasOneOf && !isDiscriminatedObject;
5849
+ }
5850
+ function isAllOfShape(shape) {
5851
+ return (shape.and || []).length > 0 || isOneOfShape(shape) && !(shape instanceof amf.UnionShape) || isEnumShape(shape);
5852
+ }
5853
+ function isNotShape(shape) {
5854
+ return !!shape.not;
5855
+ }
5856
+ function isScalarNode(node) {
5857
+ return node instanceof amf.ScalarNode;
5858
+ }
5859
+ function isEnumShape(shape) {
5860
+ return shape.values.length > 0;
5861
+ }
5862
+ function getEnumValuesFromShape(shape) {
5863
+ return shape.values.map((val) => extractScalarEnumValue(val, shape));
5864
+ }
5865
+ function extractScalarEnumValue(node, parentShape) {
5866
+ if (isScalarNode(node)) {
5867
+ const scalarType = DATATYPE_TO_SCALAR_TYPE[node.dataType.value()];
5868
+ switch (scalarType) {
5869
+ case "datetime":
5870
+ return String(node.value.value());
5871
+ default:
5872
+ return coerceValueByType(node.value.value(), {
5873
+ type: scalarType
5874
+ });
5875
+ }
5876
+ } else {
5877
+ throw new Error(
5878
+ `Invalid non-scalar enum value provided for shape ${parentShape.name.value()}`
5879
+ );
5880
+ }
5881
+ }
5882
+ function coerceValueByType(value, type) {
5883
+ switch (type.type) {
5884
+ case "string":
5885
+ return String(value);
5886
+ case "boolean":
5887
+ return value === "true";
5888
+ case "number":
5889
+ case "double":
5890
+ case "integer":
5891
+ return Number(value);
5892
+ default:
5893
+ return value;
5894
+ }
5895
+ }
5896
+ const DATA_SCALAR_PROPERTY_NAME = "http://a.ml/vocabularies/data#Scalar";
5897
+ const DATA_OBJECT_PROPERTY_NAME = "http://a.ml/vocabularies/data#Object";
5898
+ const DATA_ARRAY_PROPERTY_NAME = "http://a.ml/vocabularies/data#Array";
5899
+ const DATA_DATATYPE_PROPERTY_NAME = "http://www.w3.org/ns/shacl#datatype";
5900
+ const DATA_VALUE_PROPERTY_NAME = "http://a.ml/vocabularies/data#value";
5901
+ const NAME_PROPERTY_VALUE = "http://a.ml/vocabularies/core#name";
5902
+ function extractExtensions$1(customDomainProperties) {
5903
+ let extensions = {};
5904
+ (customDomainProperties || []).forEach((cdp) => {
5905
+ const name = cdp.name.value();
5906
+ const graph = cdp.extension.graph();
5907
+ extensions[name] = extractExtensionsFromGraph(graph);
5908
+ });
5909
+ return extensions;
5910
+ }
5911
+ function extractExtensionsFromGraph(graph) {
5912
+ if (isObject(graph)) {
5913
+ return buildExtensionsObject(graph);
5914
+ }
5915
+ if (isArray(graph)) {
5916
+ return buildExtensionsArray(graph);
5917
+ }
5918
+ if (isScalar$1(graph)) {
5919
+ return buildExtensionScalar(graph);
5920
+ }
5921
+ throw new Error(`Unsupported AMF graph type: ${graph.types()}`);
5922
+ }
5923
+ const isScalar$1 = (graph) => graph.types().includes(DATA_SCALAR_PROPERTY_NAME);
5924
+ const isObject = (graph) => graph.types().includes(DATA_OBJECT_PROPERTY_NAME);
5925
+ const isArray = (graph) => graph.types().includes(DATA_ARRAY_PROPERTY_NAME);
5926
+ function buildExtensionsObject(graph) {
5927
+ let extensions = {};
5928
+ graph.properties().filter((prop) => prop !== NAME_PROPERTY_VALUE).forEach((fullname) => {
5929
+ const name = fullname.split("#")[1];
5930
+ const propGraph = graph.getObjectByProperty(fullname)[0].graph();
5931
+ extensions[name] = extractExtensionsFromGraph(propGraph);
5932
+ });
5933
+ return extensions;
5934
+ }
5935
+ function buildExtensionsArray(graph) {
5936
+ const propertyUri = "http://www.w3.org/2000/01/rdf-schema#member";
5937
+ return graph.getObjectByProperty(propertyUri).map((item) => extractExtensionsFromGraph(item.graph()));
5938
+ }
5939
+ function buildExtensionScalar(graph) {
5940
+ const rawType = graph.scalarByProperty(DATA_DATATYPE_PROPERTY_NAME)[0];
5941
+ const rawValue = graph.scalarByProperty(DATA_VALUE_PROPERTY_NAME)[0];
5942
+ const value = [DOUBLE_DATA_TYPE, INTEGER_DATA_TYPE, NUMBER_DATA_TYPE].includes(rawType) ? Number(rawValue) : rawType === BOOLEAN_DATA_TYPE ? rawValue === "true" : String(rawValue);
5943
+ return value;
5944
+ }
5946
5945
  class AmfBaseOperation {
5947
5946
  constructor(amfOperation, amfTypeFactory2, typeRegistry, logger, fileParserLogger, endpoint, server) {
5948
5947
  this.amfOperation = amfOperation;
@@ -6668,7 +6667,7 @@ class AMFAllOfTypeImpl extends AMFBaseType {
6668
6667
  ).values()
6669
6668
  ];
6670
6669
  if (discriminatedParents.length === 0) {
6671
- return;
6670
+ return void 0;
6672
6671
  }
6673
6672
  if (discriminatedParents.length > 1) {
6674
6673
  const { line = 0, column = 0 } = ((_a = this.shape.position) == null ? void 0 : _a.start) || {};
@@ -13650,6 +13649,12 @@ function extractRootLevelSchemas(file) {
13650
13649
  }
13651
13650
  return schemas2;
13652
13651
  }
13652
+ function isResolverError(error) {
13653
+ return error instanceof Error && "code" in error && error.code === "ERESOLVER";
13654
+ }
13655
+ function isMissingPointerError(error) {
13656
+ return error instanceof Error && "code" in error && error.code === "EMISSINGPOINTER";
13657
+ }
13653
13658
  class SwaggerEnumerableScalarType extends SwaggerBaseType {
13654
13659
  typeResolve() {
13655
13660
  if (this.schema.enum && this.schema.enum.length > 0) {
@@ -13890,7 +13895,7 @@ class SwaggerAllOfTypeImpl extends SwaggerBaseType {
13890
13895
  ).values()
13891
13896
  ];
13892
13897
  if (discriminatedParents.length === 0) {
13893
- return;
13898
+ return void 0;
13894
13899
  }
13895
13900
  if (discriminatedParents.length > 1) {
13896
13901
  this.fileParserLogger.error(
@@ -14928,7 +14933,7 @@ servers:
14928
14933
  this._servers = servers.map((server) => {
14929
14934
  const uriParameters = {};
14930
14935
  if (server.variables) {
14931
- for (const [name, variable] of Object.entries(server.variables)) {
14936
+ for (const name of Object.keys(server.variables)) {
14932
14937
  uriParameters[name] = {
14933
14938
  required: true,
14934
14939
  type: { type: "string" },
@@ -15242,41 +15247,52 @@ async function parseSwaggerDocument(source, logger) {
15242
15247
  $refs
15243
15248
  };
15244
15249
  } catch (error) {
15245
- if (error instanceof MissingPointerError) {
15246
- const missingFile = error.source;
15250
+ if (isMissingPointerError(error)) {
15247
15251
  const tokenMatch = error.message.match(/Token "([^"]+)"/);
15248
15252
  const token = (tokenMatch == null ? void 0 : tokenMatch[1]) ?? "unknown";
15249
- const refInfo = findRefPositionInCache(missingFile, token);
15250
- const filename = missingFile.split("/").pop() ?? missingFile;
15251
- if (refInfo) {
15252
- const { position, refValue } = refInfo;
15253
- logger.error(
15254
- position,
15255
- `Cannot resolve reference '${refValue}': token '${token}' does not exist in '${filename}'`
15256
- );
15257
- } else {
15253
+ const missingFile = error.source;
15254
+ if (!missingFile) {
15258
15255
  logger.error(
15259
15256
  { line: 0, column: 0 },
15260
- `Cannot resolve reference: token '${token}' does not exist in '${filename}'`
15257
+ `Cannot resolve reference: token '${token}' does not exist`
15261
15258
  );
15259
+ } else {
15260
+ const refInfo = findRefPositionInCache(missingFile, token);
15261
+ const filename = missingFile.split("/").pop() ?? missingFile;
15262
+ if (refInfo) {
15263
+ const { position, refValue } = refInfo;
15264
+ logger.error(
15265
+ position,
15266
+ `Cannot resolve reference '${refValue}': token '${token}' does not exist in '${filename}'`
15267
+ );
15268
+ } else {
15269
+ logger.error(
15270
+ { line: 0, column: 0 },
15271
+ `Cannot resolve reference: token '${token}' does not exist in '${filename}'`
15272
+ );
15273
+ }
15262
15274
  }
15263
15275
  positionMapCache.clear();
15264
15276
  throw error;
15265
15277
  }
15266
- if (error instanceof ResolverError) {
15278
+ if (isResolverError(error)) {
15267
15279
  const missingFile = error.source;
15268
- const refInfo = findRefPositionInCache(missingFile);
15269
- if (refInfo) {
15270
- const { position, refValue } = refInfo;
15271
- logger.error(
15272
- position,
15273
- `Cannot resolve external reference '${refValue}': file not found '${missingFile}'`
15274
- );
15280
+ if (!missingFile) {
15281
+ logger.error({ line: 0, column: 0 }, `Cannot resolve reference: file not found`);
15275
15282
  } else {
15276
- logger.error(
15277
- { line: 0, column: 0 },
15278
- `Cannot resolve reference '${missingFile}': file not found`
15279
- );
15283
+ const refInfo = findRefPositionInCache(missingFile);
15284
+ if (refInfo) {
15285
+ const { position, refValue } = refInfo;
15286
+ logger.error(
15287
+ position,
15288
+ `Cannot resolve external reference '${refValue}': file not found '${missingFile}'`
15289
+ );
15290
+ } else {
15291
+ logger.error(
15292
+ { line: 0, column: 0 },
15293
+ `Cannot resolve reference '${missingFile}': file not found`
15294
+ );
15295
+ }
15280
15296
  }
15281
15297
  positionMapCache.clear();
15282
15298
  throw error;