@swagger-api/apidom-ns-openapi-3-1 0.76.2 → 0.77.0

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 (157) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/cjs/elements/Callback.cjs +1 -2
  3. package/cjs/elements/Components.cjs +1 -2
  4. package/cjs/elements/Contact.cjs +1 -2
  5. package/cjs/elements/Discriminator.cjs +1 -2
  6. package/cjs/elements/Encoding.cjs +1 -2
  7. package/cjs/elements/Example.cjs +1 -2
  8. package/cjs/elements/ExternalDocumentation.cjs +1 -2
  9. package/cjs/elements/Header.cjs +1 -2
  10. package/cjs/elements/Info.cjs +1 -2
  11. package/cjs/elements/JsonSchemaDialect.cjs +1 -2
  12. package/cjs/elements/License.cjs +1 -2
  13. package/cjs/elements/Link.cjs +1 -2
  14. package/cjs/elements/MediaType.cjs +1 -2
  15. package/cjs/elements/OAuthFlow.cjs +1 -2
  16. package/cjs/elements/OAuthFlows.cjs +1 -2
  17. package/cjs/elements/OpenApi3-1.cjs +1 -2
  18. package/cjs/elements/Openapi.cjs +1 -2
  19. package/cjs/elements/Operation.cjs +1 -2
  20. package/cjs/elements/Parameter.cjs +1 -2
  21. package/cjs/elements/PathItem.cjs +1 -2
  22. package/cjs/elements/Paths.cjs +1 -2
  23. package/cjs/elements/Reference.cjs +1 -2
  24. package/cjs/elements/RequestBody.cjs +1 -2
  25. package/cjs/elements/Response.cjs +1 -2
  26. package/cjs/elements/Responses.cjs +1 -2
  27. package/cjs/elements/Schema.cjs +1 -2
  28. package/cjs/elements/SecurityRequirement.cjs +1 -2
  29. package/cjs/elements/SecurityScheme.cjs +1 -2
  30. package/cjs/elements/Server.cjs +1 -2
  31. package/cjs/elements/ServerVariable.cjs +1 -2
  32. package/cjs/elements/Tag.cjs +1 -2
  33. package/cjs/elements/Xml.cjs +1 -2
  34. package/cjs/elements/nces/ComponentsPathItems.cjs +1 -2
  35. package/cjs/elements/nces/Webhooks.cjs +1 -2
  36. package/cjs/media-types.cjs +1 -2
  37. package/cjs/namespace.cjs +1 -2
  38. package/cjs/predicates.cjs +29 -54
  39. package/cjs/refractor/index.cjs +1 -2
  40. package/cjs/refractor/plugins/normalize-header-examples.cjs +5 -6
  41. package/cjs/refractor/plugins/normalize-operation-ids.cjs +2 -4
  42. package/cjs/refractor/plugins/normalize-parameter-examples.cjs +5 -6
  43. package/cjs/refractor/plugins/normalize-parameters.cjs +1 -2
  44. package/cjs/refractor/plugins/normalize-security-requirements.cjs +1 -2
  45. package/cjs/refractor/plugins/normalize-servers.cjs +1 -2
  46. package/cjs/refractor/plugins/replace-empty-element.cjs +7 -9
  47. package/cjs/refractor/specification.cjs +1 -2
  48. package/cjs/refractor/toolbox.cjs +1 -2
  49. package/cjs/refractor/visitors/open-api-3-1/JsonSchemaDialectVisitor.cjs +2 -3
  50. package/cjs/refractor/visitors/open-api-3-1/WebhooksVisitor.cjs +3 -3
  51. package/cjs/refractor/visitors/open-api-3-1/callback/index.cjs +1 -2
  52. package/cjs/refractor/visitors/open-api-3-1/components/PathItemsVisitor.cjs +1 -2
  53. package/cjs/refractor/visitors/open-api-3-1/components/SchemasVisitor.cjs +1 -2
  54. package/cjs/refractor/visitors/open-api-3-1/components/index.cjs +1 -2
  55. package/cjs/refractor/visitors/open-api-3-1/contact/index.cjs +1 -2
  56. package/cjs/refractor/visitors/open-api-3-1/distriminator/index.cjs +1 -2
  57. package/cjs/refractor/visitors/open-api-3-1/encoding/index.cjs +1 -2
  58. package/cjs/refractor/visitors/open-api-3-1/example/index.cjs +1 -2
  59. package/cjs/refractor/visitors/open-api-3-1/external-documentation/index.cjs +1 -2
  60. package/cjs/refractor/visitors/open-api-3-1/header/index.cjs +1 -2
  61. package/cjs/refractor/visitors/open-api-3-1/index.cjs +1 -2
  62. package/cjs/refractor/visitors/open-api-3-1/info/SummaryVisitor.cjs +1 -2
  63. package/cjs/refractor/visitors/open-api-3-1/info/index.cjs +1 -2
  64. package/cjs/refractor/visitors/open-api-3-1/license/IdentifierVisitor.cjs +1 -2
  65. package/cjs/refractor/visitors/open-api-3-1/license/index.cjs +1 -2
  66. package/cjs/refractor/visitors/open-api-3-1/link/index.cjs +1 -2
  67. package/cjs/refractor/visitors/open-api-3-1/media-type/index.cjs +1 -2
  68. package/cjs/refractor/visitors/open-api-3-1/oauth-flow/index.cjs +1 -2
  69. package/cjs/refractor/visitors/open-api-3-1/oauth-flows/index.cjs +1 -2
  70. package/cjs/refractor/visitors/open-api-3-1/operation/index.cjs +1 -2
  71. package/cjs/refractor/visitors/open-api-3-1/parameter/index.cjs +1 -2
  72. package/cjs/refractor/visitors/open-api-3-1/path-item/index.cjs +1 -2
  73. package/cjs/refractor/visitors/open-api-3-1/paths/index.cjs +1 -2
  74. package/cjs/refractor/visitors/open-api-3-1/reference/DescriptionVisitor.cjs +1 -2
  75. package/cjs/refractor/visitors/open-api-3-1/reference/SummaryVisitor.cjs +1 -2
  76. package/cjs/refractor/visitors/open-api-3-1/reference/index.cjs +1 -2
  77. package/cjs/refractor/visitors/open-api-3-1/request-body/index.cjs +1 -2
  78. package/cjs/refractor/visitors/open-api-3-1/response/index.cjs +1 -2
  79. package/cjs/refractor/visitors/open-api-3-1/responses/index.cjs +1 -2
  80. package/cjs/refractor/visitors/open-api-3-1/schema/$anchorVisitor.cjs +1 -2
  81. package/cjs/refractor/visitors/open-api-3-1/schema/$commentVisitor.cjs +1 -2
  82. package/cjs/refractor/visitors/open-api-3-1/schema/$defsVisitor.cjs +1 -2
  83. package/cjs/refractor/visitors/open-api-3-1/schema/$dynamicAnchorVisitor.cjs +1 -2
  84. package/cjs/refractor/visitors/open-api-3-1/schema/$dynamicRefVisitor.cjs +1 -2
  85. package/cjs/refractor/visitors/open-api-3-1/schema/$idVisitor.cjs +1 -2
  86. package/cjs/refractor/visitors/open-api-3-1/schema/$refVisitor.cjs +2 -3
  87. package/cjs/refractor/visitors/open-api-3-1/schema/$schemaVisitor.cjs +1 -2
  88. package/cjs/refractor/visitors/open-api-3-1/schema/$vocabularyVisitor.cjs +2 -3
  89. package/cjs/refractor/visitors/open-api-3-1/schema/AllOfVisitor.cjs +2 -3
  90. package/cjs/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.cjs +2 -3
  91. package/cjs/refractor/visitors/open-api-3-1/schema/ConstVisitor.cjs +1 -2
  92. package/cjs/refractor/visitors/open-api-3-1/schema/ContentEncodingVisitor.cjs +1 -2
  93. package/cjs/refractor/visitors/open-api-3-1/schema/ContentMediaTypeVisitor.cjs +1 -2
  94. package/cjs/refractor/visitors/open-api-3-1/schema/DefaultVisitor.cjs +1 -2
  95. package/cjs/refractor/visitors/open-api-3-1/schema/DependentRequiredVisitor.cjs +2 -3
  96. package/cjs/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.cjs +1 -2
  97. package/cjs/refractor/visitors/open-api-3-1/schema/DeprecatedVisitor.cjs +1 -2
  98. package/cjs/refractor/visitors/open-api-3-1/schema/DescriptionVisitor.cjs +1 -2
  99. package/cjs/refractor/visitors/open-api-3-1/schema/EnumVisitor.cjs +3 -3
  100. package/cjs/refractor/visitors/open-api-3-1/schema/ExampleVisitor.cjs +1 -2
  101. package/cjs/refractor/visitors/open-api-3-1/schema/ExamplesVisitor.cjs +2 -3
  102. package/cjs/refractor/visitors/open-api-3-1/schema/ExclusiveMaximumVisitor.cjs +1 -2
  103. package/cjs/refractor/visitors/open-api-3-1/schema/ExclusiveMinimumVisitor.cjs +1 -2
  104. package/cjs/refractor/visitors/open-api-3-1/schema/FormatVisitor.cjs +1 -2
  105. package/cjs/refractor/visitors/open-api-3-1/schema/MaxContainsVisitor.cjs +1 -2
  106. package/cjs/refractor/visitors/open-api-3-1/schema/MaxItemsVisitor.cjs +1 -2
  107. package/cjs/refractor/visitors/open-api-3-1/schema/MaxLengthVisitor.cjs +1 -2
  108. package/cjs/refractor/visitors/open-api-3-1/schema/MaxPropertiesVisitor.cjs +1 -2
  109. package/cjs/refractor/visitors/open-api-3-1/schema/MaximumVisitor.cjs +1 -2
  110. package/cjs/refractor/visitors/open-api-3-1/schema/MinContainsVisitor.cjs +1 -2
  111. package/cjs/refractor/visitors/open-api-3-1/schema/MinItemsVisitor.cjs +1 -2
  112. package/cjs/refractor/visitors/open-api-3-1/schema/MinLengthVisitor.cjs +1 -2
  113. package/cjs/refractor/visitors/open-api-3-1/schema/MinPropertiesVisitor.cjs +1 -2
  114. package/cjs/refractor/visitors/open-api-3-1/schema/MinimumVisitor.cjs +1 -2
  115. package/cjs/refractor/visitors/open-api-3-1/schema/MultipleOfVisitor.cjs +1 -2
  116. package/cjs/refractor/visitors/open-api-3-1/schema/OneOfVisitor.cjs +2 -3
  117. package/cjs/refractor/visitors/open-api-3-1/schema/ParentSchemaAwareVisitor.cjs +1 -2
  118. package/cjs/refractor/visitors/open-api-3-1/schema/PatternProperties.cjs +1 -2
  119. package/cjs/refractor/visitors/open-api-3-1/schema/PatternVisitor.cjs +1 -2
  120. package/cjs/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.cjs +2 -3
  121. package/cjs/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.cjs +1 -2
  122. package/cjs/refractor/visitors/open-api-3-1/schema/ReadOnlyVisitor.cjs +1 -2
  123. package/cjs/refractor/visitors/open-api-3-1/schema/RequiredVisitor.cjs +2 -3
  124. package/cjs/refractor/visitors/open-api-3-1/schema/TitleVisitor.cjs +1 -2
  125. package/cjs/refractor/visitors/open-api-3-1/schema/TypeVisitor.cjs +3 -4
  126. package/cjs/refractor/visitors/open-api-3-1/schema/UniqueItemsVisitor.cjs +1 -2
  127. package/cjs/refractor/visitors/open-api-3-1/schema/WriteOnlyVisitor.cjs +1 -2
  128. package/cjs/refractor/visitors/open-api-3-1/schema/index.cjs +8 -11
  129. package/cjs/refractor/visitors/open-api-3-1/security-requirement/index.cjs +1 -2
  130. package/cjs/refractor/visitors/open-api-3-1/security-scheme/index.cjs +1 -2
  131. package/cjs/refractor/visitors/open-api-3-1/server/index.cjs +1 -2
  132. package/cjs/refractor/visitors/open-api-3-1/server-variable/index.cjs +1 -2
  133. package/cjs/refractor/visitors/open-api-3-1/tag/index.cjs +1 -2
  134. package/cjs/refractor/visitors/open-api-3-1/xml/index.cjs +1 -2
  135. package/cjs/traversal/visitor.cjs +2 -3
  136. package/dist/apidom-ns-openapi-3-1.browser.js +556 -1774
  137. package/dist/apidom-ns-openapi-3-1.browser.min.js +1 -1
  138. package/es/predicates.mjs +4 -4
  139. package/es/refractor/plugins/normalize-header-examples.mjs +4 -4
  140. package/es/refractor/plugins/normalize-operation-ids.mjs +2 -3
  141. package/es/refractor/plugins/normalize-parameter-examples.mjs +4 -4
  142. package/es/refractor/plugins/replace-empty-element.mjs +7 -8
  143. package/es/refractor/visitors/open-api-3-1/JsonSchemaDialectVisitor.mjs +2 -2
  144. package/es/refractor/visitors/open-api-3-1/WebhooksVisitor.mjs +2 -1
  145. package/es/refractor/visitors/open-api-3-1/schema/$refVisitor.mjs +2 -2
  146. package/es/refractor/visitors/open-api-3-1/schema/$vocabularyVisitor.mjs +2 -2
  147. package/es/refractor/visitors/open-api-3-1/schema/AllOfVisitor.mjs +2 -2
  148. package/es/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.mjs +2 -2
  149. package/es/refractor/visitors/open-api-3-1/schema/DependentRequiredVisitor.mjs +2 -2
  150. package/es/refractor/visitors/open-api-3-1/schema/EnumVisitor.mjs +2 -1
  151. package/es/refractor/visitors/open-api-3-1/schema/ExamplesVisitor.mjs +2 -2
  152. package/es/refractor/visitors/open-api-3-1/schema/OneOfVisitor.mjs +2 -2
  153. package/es/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.mjs +2 -2
  154. package/es/refractor/visitors/open-api-3-1/schema/RequiredVisitor.mjs +2 -2
  155. package/es/refractor/visitors/open-api-3-1/schema/TypeVisitor.mjs +3 -3
  156. package/es/refractor/visitors/open-api-3-1/schema/index.mjs +8 -10
  157. package/package.json +5 -5
package/es/predicates.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createPredicate, isBooleanElement, isStringElement } from '@swagger-api/apidom-core';
1
+ import { createPredicate, isBooleanElement, isStringElement, toValue } from '@swagger-api/apidom-core';
2
2
  import CallbackElement from "./elements/Callback.mjs";
3
3
  import ComponentsElement from "./elements/Components.mjs";
4
4
  import ContactElement from "./elements/Contact.mjs";
@@ -101,7 +101,7 @@ export const isLinkElementExternal = element => {
101
101
  if (!isStringElement(element.operationRef)) {
102
102
  return false;
103
103
  }
104
- const value = element.operationRef.toValue();
104
+ const value = toValue(element.operationRef);
105
105
  return typeof value === 'string' && value.length > 0 && !value.startsWith('#');
106
106
  };
107
107
  export const isOpenapiElement = createPredicate(({
@@ -149,7 +149,7 @@ export const isPathItemElementExternal = element => {
149
149
  if (!isStringElement(element.$ref)) {
150
150
  return false;
151
151
  }
152
- const value = element.$ref.toValue();
152
+ const value = toValue(element.$ref);
153
153
  return typeof value === 'string' && value.length > 0 && !value.startsWith('#');
154
154
  };
155
155
  export const isPathsElement = createPredicate(({
@@ -173,7 +173,7 @@ export const isReferenceElementExternal = element => {
173
173
  if (!isStringElement(element.$ref)) {
174
174
  return false;
175
175
  }
176
- const value = element.$ref.toValue();
176
+ const value = toValue(element.$ref);
177
177
  return typeof value === 'string' && value.length > 0 && !value.startsWith('#');
178
178
  };
179
179
  export const isRequestBodyElement = createPredicate(({
@@ -1,3 +1,4 @@
1
+ import { cloneDeep } from '@swagger-api/apidom-core';
1
2
  /**
2
3
  * Override of Schema.example and Schema.examples field inside the Header Objects.
3
4
  *
@@ -40,8 +41,7 @@ const plugin = () => ({
40
41
  if (typeof headerElement.examples !== 'undefined' && predicates.isObjectElement(headerElement.examples)) {
41
42
  // @ts-ignore
42
43
  const examples = headerElement.examples.map(example => {
43
- var _example$value;
44
- return (_example$value = example.value) === null || _example$value === void 0 ? void 0 : _example$value.clone();
44
+ return cloneDeep.safe(example.value);
45
45
  });
46
46
  if (typeof headerElement.schema.examples !== 'undefined') {
47
47
  headerElement.schema.set('examples', examples);
@@ -57,10 +57,10 @@ const plugin = () => ({
57
57
  */
58
58
  if (typeof headerElement.example !== 'undefined') {
59
59
  if (typeof headerElement.schema.examples !== 'undefined') {
60
- headerElement.schema.set('examples', [headerElement.example.clone()]);
60
+ headerElement.schema.set('examples', [cloneDeep(headerElement.example)]);
61
61
  }
62
62
  if (typeof headerElement.schema.example !== 'undefined') {
63
- headerElement.schema.set('example', headerElement.example.clone());
63
+ headerElement.schema.set('example', cloneDeep(headerElement.example));
64
64
  }
65
65
  }
66
66
  }
@@ -1,5 +1,5 @@
1
1
  import { last, defaultTo, groupBy } from 'ramda';
2
- import { toValue } from '@swagger-api/apidom-core';
2
+ import { toValue, cloneDeep } from '@swagger-api/apidom-core';
3
3
  const removeSpaces = operationId => {
4
4
  return operationId.replace(/\s/g, '');
5
5
  };
@@ -67,7 +67,6 @@ const plugin = ({
67
67
 
68
68
  // rectify possibly broken Link.operationId fields
69
69
  links.forEach(linkElement => {
70
- var _operationElement$ope;
71
70
  if (typeof linkElement.operationId === 'undefined') return;
72
71
  const linkOperationId = String(toValue(linkElement.operationId));
73
72
  const operationElement = normalizedOperations.find(normalizedOperationElement => {
@@ -77,7 +76,7 @@ const plugin = ({
77
76
 
78
77
  // Link Object doesn't need to be rectified
79
78
  if (typeof operationElement === 'undefined') return;
80
- linkElement.operationId = (_operationElement$ope = operationElement.operationId) === null || _operationElement$ope === void 0 ? void 0 : _operationElement$ope.clone();
79
+ linkElement.operationId = cloneDeep.safe(operationElement.operationId);
81
80
  linkElement.meta.set('originalOperationId', linkOperationId);
82
81
  linkElement.set('__originalOperationId', linkOperationId);
83
82
  });
@@ -1,3 +1,4 @@
1
+ import { cloneDeep } from '@swagger-api/apidom-core';
1
2
  /**
2
3
  * Override of Schema.example and Schema.examples field inside the Parameter Objects.
3
4
  *
@@ -40,8 +41,7 @@ const plugin = () => ({
40
41
  if (typeof parameterElement.examples !== 'undefined' && predicates.isObjectElement(parameterElement.examples)) {
41
42
  // @ts-ignore
42
43
  const examples = parameterElement.examples.map(example => {
43
- var _example$value;
44
- return (_example$value = example.value) === null || _example$value === void 0 ? void 0 : _example$value.clone();
44
+ return cloneDeep.safe(example.value);
45
45
  });
46
46
  if (typeof parameterElement.schema.examples !== 'undefined') {
47
47
  parameterElement.schema.set('examples', examples);
@@ -57,10 +57,10 @@ const plugin = () => ({
57
57
  */
58
58
  if (typeof parameterElement.example !== 'undefined') {
59
59
  if (typeof parameterElement.schema.examples !== 'undefined') {
60
- parameterElement.schema.set('examples', [parameterElement.example.clone()]);
60
+ parameterElement.schema.set('examples', [cloneDeep(parameterElement.example)]);
61
61
  }
62
62
  if (typeof parameterElement.schema.example !== 'undefined') {
63
- parameterElement.schema.set('example', parameterElement.example.clone());
63
+ parameterElement.schema.set('example', cloneDeep(parameterElement.example));
64
64
  }
65
65
  }
66
66
  }
@@ -1,4 +1,4 @@
1
- import { MemberElement, ArrayElement, ObjectElement } from '@swagger-api/apidom-core';
1
+ import { MemberElement, ArrayElement, ObjectElement, cloneDeep, toValue } from '@swagger-api/apidom-core';
2
2
  import { ServersElement, SecurityElement, TagsElement, ServerVariablesElement, ComponentsSchemasElement, ComponentsResponsesElement, ComponentsParametersElement, ComponentsExamplesElement, ComponentsRequestBodiesElement, ComponentsHeadersElement, ComponentsSecuritySchemesElement, ComponentsLinksElement, ComponentsCallbacksElement, PathItemServersElement, PathItemParametersElement, OperationParametersElement, ParameterExamplesElement, ParameterContentElement, HeaderExamplesElement, HeaderContentElement, OperationTagsElement, OperationCallbacksElement, OperationSecurityElement, OperationServersElement, RequestBodyContentElement, MediaTypeExamplesElement, MediaTypeEncodingElement, EncodingHeadersElement, ResponseHeadersElement, ResponseContentElement, ResponseLinksElement, DiscriminatorMappingElement, OAuthFlowScopesElement } from '@swagger-api/apidom-ns-openapi-3-0';
3
3
 
4
4
  /**
@@ -618,9 +618,8 @@ const schema = {
618
618
  }
619
619
  };
620
620
  const findElementFactory = (ancestor, keyName) => {
621
- var _ancestor$classes$fir, _ancestor$classes$fir2;
622
621
  const elementType = getNodeType(ancestor); // @ts-ignore
623
- const keyMapping = schema[elementType] || schema[(_ancestor$classes$fir = ancestor.classes.first) === null || _ancestor$classes$fir === void 0 || (_ancestor$classes$fir2 = _ancestor$classes$fir.toValue) === null || _ancestor$classes$fir2 === void 0 ? void 0 : _ancestor$classes$fir2.call(_ancestor$classes$fir)];
622
+ const keyMapping = schema[elementType] || schema[toValue(ancestor.classes.first)];
624
623
  return typeof keyMapping === 'undefined' ? undefined : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
625
624
  };
626
625
  const plugin = () => ({
@@ -633,20 +632,20 @@ const plugin = () => ({
633
632
  // no empty Element, continue with next one
634
633
  if (!isEmptyElement(element.value)) return undefined;
635
634
  const [,,, ancestors] = rest;
636
- const ancestor = ancestors[ancestors.length - 1]; // @ts-ignore
637
- const elementFactory = findElementFactory(ancestor, element.key.toValue());
635
+ const ancestor = ancestors.at(-1);
636
+ const elementFactory = findElementFactory(ancestor, toValue(element.key));
638
637
 
639
638
  // no element factory found
640
639
  if (typeof elementFactory === 'undefined') return undefined;
641
640
  const originalValue = element.value;
642
641
  return new MemberElement(element.key, elementFactory.call({
643
642
  context: ancestor
644
- }, undefined, originalValue.meta.clone(), originalValue.attributes.clone()), element.meta.clone(), element.attributes.clone());
643
+ }, undefined, cloneDeep(originalValue.meta), cloneDeep(originalValue.attributes)), cloneDeep(element.meta), cloneDeep(element.attributes));
645
644
  },
646
645
  StringElement(element, ...rest) {
647
646
  if (!isEmptyElement(element)) return undefined;
648
647
  const [,,, ancestors] = rest;
649
- const ancestor = ancestors[ancestors.length - 1];
648
+ const ancestor = ancestors.at(-1);
650
649
 
651
650
  // we're only interested in empty elements in ArrayElements
652
651
  if (!predicates.isArrayElement(ancestor)) return undefined;
@@ -656,7 +655,7 @@ const plugin = () => ({
656
655
  if (typeof elementFactory === 'undefined') return undefined;
657
656
  return elementFactory.call({
658
657
  context: element
659
- }, undefined, element.meta.clone(), element.attributes.clone());
658
+ }, undefined, cloneDeep(element.meta), cloneDeep(element.attributes));
660
659
  }
661
660
  }
662
661
  };
@@ -1,11 +1,11 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, toValue } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor, SpecificationVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  import JsonSchemaDialectElement from "../../../elements/JsonSchemaDialect.mjs";
5
5
  const JsonSchemaDialectVisitor = stampit(SpecificationVisitor, FallbackVisitor, {
6
6
  methods: {
7
7
  StringElement(stringElement) {
8
- const jsonSchemaDialectElement = new JsonSchemaDialectElement(stringElement.toValue());
8
+ const jsonSchemaDialectElement = new JsonSchemaDialectElement(toValue(stringElement));
9
9
  this.copyMetaAndAttributes(stringElement, jsonSchemaDialectElement);
10
10
  this.element = jsonSchemaDialectElement;
11
11
  return BREAK;
@@ -1,4 +1,5 @@
1
1
  import stampit from 'stampit';
2
+ import { toValue } from '@swagger-api/apidom-core';
2
3
  import { isReferenceLikeElement, MapVisitor, FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
3
4
  import WebhooksElement from "../../../elements/nces/Webhooks.mjs";
4
5
  import { isPathItemElement, isReferenceElement } from "../../../predicates.mjs";
@@ -24,7 +25,7 @@ const WebhooksVisitor = stampit(MapVisitor, FallbackVisitor, {
24
25
 
25
26
  // decorate every PathItemElement with Webhook name metadata
26
27
  this.element.filter(isPathItemElement).forEach((pathItemElement, key) => {
27
- pathItemElement.setMetaProperty('webhook-name', key.toValue());
28
+ pathItemElement.setMetaProperty('webhook-name', toValue(key));
28
29
  });
29
30
  return result;
30
31
  }
@@ -1,10 +1,10 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const $refVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  StringElement(stringElement) {
7
- this.element = stringElement.clone();
7
+ this.element = cloneDeep(stringElement);
8
8
  this.element.classes.push('reference-value');
9
9
  return BREAK;
10
10
  }
@@ -1,10 +1,10 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const $vocabularyVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  ObjectElement(objectElement) {
7
- this.element = objectElement.clone();
7
+ this.element = cloneDeep(objectElement);
8
8
  this.element.classes.push('json-schema-$vocabulary');
9
9
  return BREAK;
10
10
  }
@@ -1,5 +1,5 @@
1
1
  import stampit from 'stampit';
2
- import { ArrayElement, isObjectElement, BREAK } from '@swagger-api/apidom-core';
2
+ import { ArrayElement, isObjectElement, BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor, SpecificationVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  import ParentSchemaAwareVisitor from "./ParentSchemaAwareVisitor.mjs";
5
5
  const AllOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor, {
@@ -14,7 +14,7 @@ const AllOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, Fal
14
14
  const schemaElement = this.toRefractedElement(['document', 'objects', 'Schema'], item);
15
15
  this.element.push(schemaElement);
16
16
  } else {
17
- const element = item.clone();
17
+ const element = cloneDeep(item);
18
18
  this.element.push(element);
19
19
  }
20
20
  });
@@ -1,5 +1,5 @@
1
1
  import stampit from 'stampit';
2
- import { ArrayElement, isObjectElement, BREAK } from '@swagger-api/apidom-core';
2
+ import { ArrayElement, isObjectElement, BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor, SpecificationVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  import ParentSchemaAwareVisitor from "./ParentSchemaAwareVisitor.mjs";
5
5
  const AnyOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor, {
@@ -14,7 +14,7 @@ const AnyOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, Fal
14
14
  const schemaElement = this.toRefractedElement(['document', 'objects', 'Schema'], item);
15
15
  this.element.push(schemaElement);
16
16
  } else {
17
- const element = item.clone();
17
+ const element = cloneDeep(item);
18
18
  this.element.push(element);
19
19
  }
20
20
  });
@@ -1,10 +1,10 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const DependentRequiredVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  ObjectElement(objectElement) {
7
- this.element = objectElement.clone();
7
+ this.element = cloneDeep(objectElement);
8
8
  this.element.classes.push('json-schema-dependentRequired');
9
9
  return BREAK;
10
10
  }
@@ -1,10 +1,11 @@
1
1
  import stampit from 'stampit';
2
2
  import { BREAK } from '@swagger-api/apidom-ast';
3
+ import { cloneDeep } from '@swagger-api/apidom-core';
3
4
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
5
  const EnumVisitor = stampit(FallbackVisitor, {
5
6
  methods: {
6
7
  ArrayElement(arrayElement) {
7
- this.element = arrayElement.clone();
8
+ this.element = cloneDeep(arrayElement);
8
9
  this.element.classes.push('json-schema-enum');
9
10
  return BREAK;
10
11
  }
@@ -1,10 +1,10 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const ExamplesVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  ArrayElement(arrayElement) {
7
- this.element = arrayElement.clone();
7
+ this.element = cloneDeep(arrayElement);
8
8
  this.element.classes.push('json-schema-examples');
9
9
  return BREAK;
10
10
  }
@@ -1,5 +1,5 @@
1
1
  import stampit from 'stampit';
2
- import { ArrayElement, isObjectElement, BREAK } from '@swagger-api/apidom-core';
2
+ import { ArrayElement, isObjectElement, BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor, SpecificationVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  import ParentSchemaAwareVisitor from "./ParentSchemaAwareVisitor.mjs";
5
5
  const OneOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor, {
@@ -14,7 +14,7 @@ const OneOfVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, Fal
14
14
  const schemaElement = this.toRefractedElement(['document', 'objects', 'Schema'], item);
15
15
  this.element.push(schemaElement);
16
16
  } else {
17
- const element = item.clone();
17
+ const element = cloneDeep(item);
18
18
  this.element.push(element);
19
19
  }
20
20
  });
@@ -1,5 +1,5 @@
1
1
  import stampit from 'stampit';
2
- import { ArrayElement, isObjectElement, BREAK } from '@swagger-api/apidom-core';
2
+ import { ArrayElement, isObjectElement, BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor, SpecificationVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  import ParentSchemaAwareVisitor from "./ParentSchemaAwareVisitor.mjs";
5
5
  const PrefixItemsVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor, {
@@ -14,7 +14,7 @@ const PrefixItemsVisitor = stampit(SpecificationVisitor, ParentSchemaAwareVisito
14
14
  const schemaElement = this.toRefractedElement(['document', 'objects', 'Schema'], item);
15
15
  this.element.push(schemaElement);
16
16
  } else {
17
- const element = item.clone();
17
+ const element = cloneDeep(item);
18
18
  this.element.push(element);
19
19
  }
20
20
  });
@@ -1,10 +1,10 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const RequiredVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  ArrayElement(arrayElement) {
7
- this.element = arrayElement.clone();
7
+ this.element = cloneDeep(arrayElement);
8
8
  this.element.classes.push('json-schema-required');
9
9
  return BREAK;
10
10
  }
@@ -1,15 +1,15 @@
1
1
  import stampit from 'stampit';
2
- import { BREAK } from '@swagger-api/apidom-core';
2
+ import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
3
3
  import { FallbackVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
4
4
  const TypeVisitor = stampit(FallbackVisitor, {
5
5
  methods: {
6
6
  StringElement(stringElement) {
7
- this.element = stringElement.clone();
7
+ this.element = cloneDeep(stringElement);
8
8
  this.element.classes.push('json-schema-type');
9
9
  return BREAK;
10
10
  },
11
11
  ArrayElement(arrayElement) {
12
- this.element = arrayElement.clone();
12
+ this.element = cloneDeep(arrayElement);
13
13
  this.element.classes.push('json-schema-type');
14
14
  return BREAK;
15
15
  }
@@ -1,7 +1,7 @@
1
1
  import stampit from 'stampit';
2
2
  import { always, defaultTo } from 'ramda';
3
3
  import { isNonEmptyString, isNull } from 'ramda-adjunct';
4
- import { ArrayElement, isStringElement, BREAK } from '@swagger-api/apidom-core';
4
+ import { ArrayElement, isStringElement, BREAK, cloneDeep, toValue } from '@swagger-api/apidom-core';
5
5
  import { FallbackVisitor, FixedFieldsVisitor } from '@swagger-api/apidom-ns-openapi-3-0';
6
6
  import { isSchemaElement, isJsonSchemaDialectElement } from "../../../../predicates.mjs";
7
7
  import SchemaElement from "../../../../elements/Schema.mjs";
@@ -26,11 +26,11 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall
26
26
  const getJsonSchemaDialect = () => {
27
27
  let jsonSchemaDialect;
28
28
  if (this.openApiSemanticElement !== null && isJsonSchemaDialectElement(this.openApiSemanticElement.jsonSchemaDialect)) {
29
- jsonSchemaDialect = this.openApiSemanticElement.jsonSchemaDialect.toValue();
29
+ jsonSchemaDialect = toValue(this.openApiSemanticElement.jsonSchemaDialect);
30
30
  } else if (this.openApiGenericElement !== null && isStringElement(this.openApiGenericElement.get('jsonSchemaDialect'))) {
31
- jsonSchemaDialect = this.openApiGenericElement.get('jsonSchemaDialect').toValue();
31
+ jsonSchemaDialect = toValue(this.openApiGenericElement.get('jsonSchemaDialect'));
32
32
  } else {
33
- jsonSchemaDialect = JsonSchemaDialect.default.toValue();
33
+ jsonSchemaDialect = toValue(JsonSchemaDialect.default);
34
34
  }
35
35
  return jsonSchemaDialect;
36
36
  };
@@ -40,19 +40,17 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall
40
40
  // no parent available and no $schema is defined, set default jsonSchemaDialect
41
41
  this.element.setMetaProperty('inherited$schema', getJsonSchemaDialect());
42
42
  } else if (isSchemaElement(this.parent) && !isStringElement(objectElement.get('$schema'))) {
43
- var _this$parent$meta$get, _this$parent$$schema;
44
43
  // parent is available and no $schema is defined, set parent $schema
45
- const inherited$schema = defaultTo((_this$parent$meta$get = this.parent.meta.get('inherited$schema')) === null || _this$parent$meta$get === void 0 ? void 0 : _this$parent$meta$get.toValue(), (_this$parent$$schema = this.parent.$schema) === null || _this$parent$$schema === void 0 ? void 0 : _this$parent$$schema.toValue());
44
+ const inherited$schema = defaultTo(toValue(this.parent.meta.get('inherited$schema')), toValue(this.parent.$schema));
46
45
  this.element.setMetaProperty('inherited$schema', inherited$schema);
47
46
  }
48
47
  };
49
48
  const handle$id = objectElement => {
50
- var _objectElement$get;
51
49
  // handle $id keyword in embedded resources
52
50
  // fetch parent's inherited$id
53
- const inherited$id = this.parent !== null ? this.parent.getMetaProperty('inherited$id', []).clone() : new ArrayElement();
51
+ const inherited$id = this.parent !== null ? cloneDeep(this.parent.getMetaProperty('inherited$id', [])) : new ArrayElement();
54
52
  // get current $id keyword
55
- const $id = (_objectElement$get = objectElement.get('$id')) === null || _objectElement$get === void 0 ? void 0 : _objectElement$get.toValue();
53
+ const $id = toValue(objectElement.get('$id'));
56
54
 
57
55
  // remember $id keyword if it's a non empty strings
58
56
  if (isNonEmptyString($id)) {
@@ -85,7 +83,7 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall
85
83
 
86
84
  // eslint-disable-next-line @typescript-eslint/naming-convention
87
85
  this.BooleanElement = function _BooleanElement(booleanElement) {
88
- this.element = booleanElement.clone();
86
+ this.element = cloneDeep(booleanElement);
89
87
  this.element.classes.push('boolean-json-schema');
90
88
  return BREAK;
91
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swagger-api/apidom-ns-openapi-3-1",
3
- "version": "0.76.2",
3
+ "version": "0.77.0",
4
4
  "description": "Parser adapter for parsing JSON documents into AsyncAPI 2.x.y namespace.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -45,9 +45,9 @@
45
45
  "license": "Apache-2.0",
46
46
  "dependencies": {
47
47
  "@babel/runtime-corejs3": "^7.20.7",
48
- "@swagger-api/apidom-ast": "^0.76.2",
49
- "@swagger-api/apidom-core": "^0.76.2",
50
- "@swagger-api/apidom-ns-openapi-3-0": "^0.76.2",
48
+ "@swagger-api/apidom-ast": "^0.77.0",
49
+ "@swagger-api/apidom-core": "^0.77.0",
50
+ "@swagger-api/apidom-ns-openapi-3-0": "^0.77.0",
51
51
  "@types/ramda": "~0.29.3",
52
52
  "ramda": "~0.29.0",
53
53
  "ramda-adjunct": "^4.1.1",
@@ -63,5 +63,5 @@
63
63
  "README.md",
64
64
  "CHANGELOG.md"
65
65
  ],
66
- "gitHead": "8c6c02f813a663cfaf0ac0963f2b4fd25b8dffe8"
66
+ "gitHead": "cd8a9d7d2ea8bb8c335c23cd4632830a79c426c9"
67
67
  }