@redocly/openapi-core 1.0.0-beta.126 → 1.0.0-beta.128

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 (289) hide show
  1. package/lib/bundle.js +21 -4
  2. package/lib/config/all.js +1 -0
  3. package/lib/config/config-resolvers.js +8 -2
  4. package/lib/config/minimal.js +1 -0
  5. package/lib/config/recommended.js +1 -0
  6. package/lib/config/types.d.ts +1 -1
  7. package/lib/config/utils.js +15 -1
  8. package/lib/lint.js +17 -2
  9. package/lib/rules/common/spec-strict-refs.d.ts +2 -0
  10. package/lib/rules/common/spec-strict-refs.js +30 -0
  11. package/lib/rules/common/spec.js +1 -0
  12. package/lib/rules/oas2/index.d.ts +1 -0
  13. package/lib/rules/oas2/index.js +2 -0
  14. package/lib/rules/oas2/request-mime-type.d.ts +1 -1
  15. package/lib/rules/oas2/response-mime-type.d.ts +1 -1
  16. package/lib/rules/oas3/index.js +2 -0
  17. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +2 -2
  18. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
  19. package/lib/rules/oas3/request-mime-type.d.ts +1 -1
  20. package/lib/rules/oas3/response-mime-type.d.ts +1 -1
  21. package/lib/rules/oas3/spec-components-invalid-map-name.js +0 -5
  22. package/lib/types/redocly-yaml.js +6 -1
  23. package/lib/walk.d.ts +6 -5
  24. package/lib/walk.js +26 -31
  25. package/package.json +1 -1
  26. package/__tests__/utils.ts +0 -88
  27. package/src/__tests__/__snapshots__/bundle.test.ts.snap +0 -437
  28. package/src/__tests__/bundle.test.ts +0 -236
  29. package/src/__tests__/codeframes.test.ts +0 -530
  30. package/src/__tests__/fixtures/.redocly.lint-ignore.yaml +0 -5
  31. package/src/__tests__/fixtures/extension.js +0 -24
  32. package/src/__tests__/fixtures/refs/definitions.yaml +0 -3
  33. package/src/__tests__/fixtures/refs/examples.yaml +0 -8
  34. package/src/__tests__/fixtures/refs/external-request-body.yaml +0 -13
  35. package/src/__tests__/fixtures/refs/externalref.yaml +0 -35
  36. package/src/__tests__/fixtures/refs/hosted.yaml +0 -35
  37. package/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml +0 -21
  38. package/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml +0 -33
  39. package/src/__tests__/fixtures/refs/openapi-with-url-refs.yaml +0 -18
  40. package/src/__tests__/fixtures/refs/param-b.yaml +0 -1
  41. package/src/__tests__/fixtures/refs/param-c.yaml +0 -1
  42. package/src/__tests__/fixtures/refs/rename.yaml +0 -1
  43. package/src/__tests__/fixtures/refs/requestBody.yaml +0 -9
  44. package/src/__tests__/fixtures/refs/schema-a.yaml +0 -1
  45. package/src/__tests__/fixtures/refs/simple.yaml +0 -1
  46. package/src/__tests__/fixtures/refs/vendor.schema.yaml +0 -20
  47. package/src/__tests__/fixtures/resolve/External.yaml +0 -10
  48. package/src/__tests__/fixtures/resolve/External2.yaml +0 -4
  49. package/src/__tests__/fixtures/resolve/description.md +0 -3
  50. package/src/__tests__/fixtures/resolve/externalInfo.yaml +0 -4
  51. package/src/__tests__/fixtures/resolve/externalLicense.yaml +0 -1
  52. package/src/__tests__/fixtures/resolve/openapi-with-back.yaml +0 -13
  53. package/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml +0 -5
  54. package/src/__tests__/fixtures/resolve/openapi.yaml +0 -28
  55. package/src/__tests__/fixtures/resolve/schemas/type-a.yaml +0 -10
  56. package/src/__tests__/fixtures/resolve/schemas/type-b.yaml +0 -6
  57. package/src/__tests__/fixtures/resolve/transitive/a.yaml +0 -1
  58. package/src/__tests__/fixtures/resolve/transitive/components.yaml +0 -5
  59. package/src/__tests__/fixtures/resolve/transitive/schemas.yaml +0 -3
  60. package/src/__tests__/format.test.ts +0 -76
  61. package/src/__tests__/js-yaml.test.ts +0 -73
  62. package/src/__tests__/lint.test.ts +0 -388
  63. package/src/__tests__/logger-browser.test.ts +0 -53
  64. package/src/__tests__/logger.test.ts +0 -47
  65. package/src/__tests__/login.test.ts +0 -17
  66. package/src/__tests__/normalizeVisitors.test.ts +0 -151
  67. package/src/__tests__/output-browser.test.ts +0 -18
  68. package/src/__tests__/output.test.ts +0 -15
  69. package/src/__tests__/ref-utils.test.ts +0 -120
  70. package/src/__tests__/resolve-http.test.ts +0 -77
  71. package/src/__tests__/resolve.test.ts +0 -430
  72. package/src/__tests__/utils-browser.test.ts +0 -11
  73. package/src/__tests__/utils.test.ts +0 -144
  74. package/src/__tests__/walk.test.ts +0 -1545
  75. package/src/benchmark/benches/lint-with-many-rules.bench.ts +0 -35
  76. package/src/benchmark/benches/lint-with-nested-rule.bench.ts +0 -39
  77. package/src/benchmark/benches/lint-with-no-rules.bench.ts +0 -20
  78. package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +0 -35
  79. package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +0 -32
  80. package/src/benchmark/benches/rebilly.yaml +0 -32275
  81. package/src/benchmark/benches/recommended-oas3.bench.ts +0 -22
  82. package/src/benchmark/benches/resolve-with-no-external.bench.ts +0 -23
  83. package/src/benchmark/benchmark.js +0 -311
  84. package/src/benchmark/colors.js +0 -29
  85. package/src/benchmark/fork.js +0 -83
  86. package/src/benchmark/utils.ts +0 -36
  87. package/src/bundle.ts +0 -399
  88. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +0 -161
  89. package/src/config/__tests__/__snapshots__/config.test.ts.snap +0 -144
  90. package/src/config/__tests__/config-resolvers.test.ts +0 -491
  91. package/src/config/__tests__/config.test.ts +0 -307
  92. package/src/config/__tests__/fixtures/ingore-file.ts +0 -8
  93. package/src/config/__tests__/fixtures/load-redocly.yaml +0 -2
  94. package/src/config/__tests__/fixtures/plugin-config.yaml +0 -2
  95. package/src/config/__tests__/fixtures/plugin.js +0 -56
  96. package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +0 -11
  97. package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +0 -69
  98. package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +0 -7
  99. package/src/config/__tests__/fixtures/resolve-config/local-config-with-custom-function.yaml +0 -17
  100. package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +0 -18
  101. package/src/config/__tests__/fixtures/resolve-config/local-config-with-wrong-custom-function.yaml +0 -15
  102. package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +0 -9
  103. package/src/config/__tests__/fixtures/resolve-config/plugin.js +0 -80
  104. package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +0 -3
  105. package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +0 -4
  106. package/src/config/__tests__/load.test.ts +0 -167
  107. package/src/config/__tests__/resolve-plugins.test.ts +0 -27
  108. package/src/config/__tests__/utils.test.ts +0 -204
  109. package/src/config/all.ts +0 -73
  110. package/src/config/builtIn.ts +0 -37
  111. package/src/config/config-resolvers.ts +0 -465
  112. package/src/config/config.ts +0 -330
  113. package/src/config/index.ts +0 -7
  114. package/src/config/load.ts +0 -144
  115. package/src/config/minimal.ts +0 -60
  116. package/src/config/recommended.ts +0 -60
  117. package/src/config/rules.ts +0 -54
  118. package/src/config/types.ts +0 -216
  119. package/src/config/utils.ts +0 -333
  120. package/src/decorators/__tests__/filter-in.test.ts +0 -310
  121. package/src/decorators/__tests__/filter-out.test.ts +0 -335
  122. package/src/decorators/__tests__/media-type-examples-override.test.ts +0 -665
  123. package/src/decorators/__tests__/remove-x-internal.test.ts +0 -316
  124. package/src/decorators/__tests__/resources/request.yaml +0 -3
  125. package/src/decorators/__tests__/resources/response.yaml +0 -3
  126. package/src/decorators/common/filters/filter-helper.ts +0 -72
  127. package/src/decorators/common/filters/filter-in.ts +0 -18
  128. package/src/decorators/common/filters/filter-out.ts +0 -18
  129. package/src/decorators/common/info-description-override.ts +0 -24
  130. package/src/decorators/common/info-override.ts +0 -15
  131. package/src/decorators/common/media-type-examples-override.ts +0 -79
  132. package/src/decorators/common/operation-description-override.ts +0 -30
  133. package/src/decorators/common/registry-dependencies.ts +0 -25
  134. package/src/decorators/common/remove-x-internal.ts +0 -59
  135. package/src/decorators/common/tag-description-override.ts +0 -25
  136. package/src/decorators/oas2/index.ts +0 -20
  137. package/src/decorators/oas3/index.ts +0 -22
  138. package/src/env.ts +0 -5
  139. package/src/format/codeframes.ts +0 -216
  140. package/src/format/format.ts +0 -375
  141. package/src/index.ts +0 -71
  142. package/src/js-yaml/index.ts +0 -14
  143. package/src/lint.ts +0 -130
  144. package/src/logger.ts +0 -34
  145. package/src/oas-types.ts +0 -57
  146. package/src/output.ts +0 -7
  147. package/src/redocly/__tests__/redocly-client.test.ts +0 -146
  148. package/src/redocly/index.ts +0 -187
  149. package/src/redocly/redocly-client-types.ts +0 -10
  150. package/src/redocly/registry-api-types.ts +0 -32
  151. package/src/redocly/registry-api.ts +0 -149
  152. package/src/ref-utils.ts +0 -85
  153. package/src/resolve.ts +0 -417
  154. package/src/rules/__tests__/fixtures/code-sample.php +0 -9
  155. package/src/rules/__tests__/fixtures/invalid-yaml.yaml +0 -1
  156. package/src/rules/__tests__/fixtures/ref.yaml +0 -1
  157. package/src/rules/__tests__/no-unresolved-refs.test.ts +0 -257
  158. package/src/rules/__tests__/utils.test.ts +0 -160
  159. package/src/rules/ajv.ts +0 -102
  160. package/src/rules/common/__tests__/info-license.test.ts +0 -62
  161. package/src/rules/common/__tests__/license-url.test.ts +0 -63
  162. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +0 -96
  163. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +0 -210
  164. package/src/rules/common/__tests__/no-identical-paths.test.ts +0 -58
  165. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +0 -85
  166. package/src/rules/common/__tests__/operation-2xx-response.test.ts +0 -192
  167. package/src/rules/common/__tests__/operation-4xx-response.test.ts +0 -231
  168. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +0 -76
  169. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +0 -45
  170. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +0 -167
  171. package/src/rules/common/__tests__/operation-singular-tag.test.ts +0 -72
  172. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +0 -95
  173. package/src/rules/common/__tests__/path-not-include-query.test.ts +0 -64
  174. package/src/rules/common/__tests__/path-params-defined.test.ts +0 -202
  175. package/src/rules/common/__tests__/paths-kebab-case.test.ts +0 -108
  176. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +0 -264
  177. package/src/rules/common/__tests__/security-defined.test.ts +0 -175
  178. package/src/rules/common/__tests__/spec.test.ts +0 -555
  179. package/src/rules/common/__tests__/tag-description.test.ts +0 -65
  180. package/src/rules/common/__tests__/tags-alphabetical.test.ts +0 -64
  181. package/src/rules/common/assertions/__tests__/asserts.test.ts +0 -869
  182. package/src/rules/common/assertions/__tests__/index.test.ts +0 -100
  183. package/src/rules/common/assertions/__tests__/utils.test.ts +0 -236
  184. package/src/rules/common/assertions/asserts.ts +0 -357
  185. package/src/rules/common/assertions/index.ts +0 -56
  186. package/src/rules/common/assertions/utils.ts +0 -331
  187. package/src/rules/common/info-contact.ts +0 -15
  188. package/src/rules/common/info-license-url.ts +0 -10
  189. package/src/rules/common/info-license.ts +0 -15
  190. package/src/rules/common/no-ambiguous-paths.ts +0 -50
  191. package/src/rules/common/no-enum-type-mismatch.ts +0 -52
  192. package/src/rules/common/no-http-verbs-in-paths.ts +0 -36
  193. package/src/rules/common/no-identical-paths.ts +0 -24
  194. package/src/rules/common/no-invalid-parameter-examples.ts +0 -36
  195. package/src/rules/common/no-invalid-schema-examples.ts +0 -27
  196. package/src/rules/common/no-path-trailing-slash.ts +0 -15
  197. package/src/rules/common/operation-2xx-response.ts +0 -24
  198. package/src/rules/common/operation-4xx-response.ts +0 -24
  199. package/src/rules/common/operation-description.ts +0 -13
  200. package/src/rules/common/operation-operationId-unique.ts +0 -21
  201. package/src/rules/common/operation-operationId-url-safe.ts +0 -19
  202. package/src/rules/common/operation-operationId.ts +0 -17
  203. package/src/rules/common/operation-parameters-unique.ts +0 -48
  204. package/src/rules/common/operation-singular-tag.ts +0 -17
  205. package/src/rules/common/operation-summary.ts +0 -13
  206. package/src/rules/common/operation-tag-defined.ts +0 -26
  207. package/src/rules/common/parameter-description.ts +0 -22
  208. package/src/rules/common/path-declaration-must-exist.ts +0 -15
  209. package/src/rules/common/path-excludes-patterns.ts +0 -23
  210. package/src/rules/common/path-http-verbs-order.ts +0 -30
  211. package/src/rules/common/path-not-include-query.ts +0 -17
  212. package/src/rules/common/path-params-defined.ts +0 -65
  213. package/src/rules/common/path-segment-plural.ts +0 -31
  214. package/src/rules/common/paths-kebab-case.ts +0 -19
  215. package/src/rules/common/required-string-property-missing-min-length.ts +0 -44
  216. package/src/rules/common/response-contains-header.ts +0 -35
  217. package/src/rules/common/scalar-property-missing-example.ts +0 -58
  218. package/src/rules/common/security-defined.ts +0 -65
  219. package/src/rules/common/spec.ts +0 -174
  220. package/src/rules/common/tag-description.ts +0 -10
  221. package/src/rules/common/tags-alphabetical.ts +0 -20
  222. package/src/rules/no-unresolved-refs.ts +0 -51
  223. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +0 -110
  224. package/src/rules/oas2/__tests__/response-contains-header.test.ts +0 -174
  225. package/src/rules/oas2/__tests__/response-contains-property.test.ts +0 -155
  226. package/src/rules/oas2/__tests__/spec/fixtures/description.md +0 -1
  227. package/src/rules/oas2/__tests__/spec/info.test.ts +0 -355
  228. package/src/rules/oas2/__tests__/spec/operation.test.ts +0 -123
  229. package/src/rules/oas2/__tests__/spec/paths.test.ts +0 -245
  230. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +0 -35
  231. package/src/rules/oas2/__tests__/spec/utils.ts +0 -32
  232. package/src/rules/oas2/boolean-parameter-prefixes.ts +0 -26
  233. package/src/rules/oas2/index.ts +0 -89
  234. package/src/rules/oas2/remove-unused-components.ts +0 -81
  235. package/src/rules/oas2/request-mime-type.ts +0 -17
  236. package/src/rules/oas2/response-contains-property.ts +0 -36
  237. package/src/rules/oas2/response-mime-type.ts +0 -17
  238. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +0 -111
  239. package/src/rules/oas3/__tests__/fixtures/common.yaml +0 -11
  240. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +0 -205
  241. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +0 -65
  242. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +0 -473
  243. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +0 -60
  244. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +0 -79
  245. package/src/rules/oas3/__tests__/no-unused-components.test.ts +0 -131
  246. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +0 -145
  247. package/src/rules/oas3/__tests__/response-contains-header.test.ts +0 -389
  248. package/src/rules/oas3/__tests__/response-contains-property.test.ts +0 -403
  249. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +0 -41
  250. package/src/rules/oas3/__tests__/spec/fixtures/description.md +0 -1
  251. package/src/rules/oas3/__tests__/spec/info.test.ts +0 -391
  252. package/src/rules/oas3/__tests__/spec/operation.test.ts +0 -253
  253. package/src/rules/oas3/__tests__/spec/paths.test.ts +0 -284
  254. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +0 -77
  255. package/src/rules/oas3/__tests__/spec/servers.test.ts +0 -505
  256. package/src/rules/oas3/__tests__/spec/spec.test.ts +0 -298
  257. package/src/rules/oas3/__tests__/spec/utils.ts +0 -32
  258. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +0 -305
  259. package/src/rules/oas3/boolean-parameter-prefixes.ts +0 -28
  260. package/src/rules/oas3/index.ts +0 -109
  261. package/src/rules/oas3/no-empty-servers.ts +0 -22
  262. package/src/rules/oas3/no-example-value-and-externalValue.ts +0 -14
  263. package/src/rules/oas3/no-invalid-media-type-examples.ts +0 -49
  264. package/src/rules/oas3/no-server-example.com.ts +0 -14
  265. package/src/rules/oas3/no-server-trailing-slash.ts +0 -15
  266. package/src/rules/oas3/no-server-variables-empty-enum.ts +0 -66
  267. package/src/rules/oas3/no-undefined-server-variable.ts +0 -30
  268. package/src/rules/oas3/no-unused-components.ts +0 -75
  269. package/src/rules/oas3/operation-4xx-problem-details-rfc7807.ts +0 -36
  270. package/src/rules/oas3/remove-unused-components.ts +0 -95
  271. package/src/rules/oas3/request-mime-type.ts +0 -31
  272. package/src/rules/oas3/response-contains-property.ts +0 -38
  273. package/src/rules/oas3/response-mime-type.ts +0 -31
  274. package/src/rules/oas3/spec-components-invalid-map-name.ts +0 -74
  275. package/src/rules/other/stats.ts +0 -73
  276. package/src/rules/utils.ts +0 -191
  277. package/src/types/index.ts +0 -149
  278. package/src/types/oas2.ts +0 -478
  279. package/src/types/oas3.ts +0 -597
  280. package/src/types/oas3_1.ts +0 -258
  281. package/src/types/redocly-yaml.ts +0 -1010
  282. package/src/typings/common.ts +0 -17
  283. package/src/typings/openapi.ts +0 -298
  284. package/src/typings/swagger.ts +0 -236
  285. package/src/utils.ts +0 -276
  286. package/src/visitors.ts +0 -491
  287. package/src/walk.ts +0 -453
  288. package/tsconfig.json +0 -8
  289. package/tsconfig.tsbuildinfo +0 -1
@@ -1,437 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`bundle should add to meta ref from redocly registry 1`] = `
4
- fileDependencies: {}
5
- rootType:
6
- properties:
7
- openapi: null
8
- info:
9
- properties:
10
- title:
11
- type: string
12
- version:
13
- type: string
14
- description:
15
- type: string
16
- termsOfService:
17
- type: string
18
- contact:
19
- properties:
20
- name:
21
- type: string
22
- url:
23
- type: string
24
- email:
25
- type: string
26
- extensionsPrefix: x-
27
- name: Contact
28
- license:
29
- properties:
30
- name:
31
- type: string
32
- url:
33
- type: string
34
- required:
35
- - name
36
- extensionsPrefix: x-
37
- name: License
38
- x-logo:
39
- properties:
40
- url:
41
- type: string
42
- altText:
43
- type: string
44
- backgroundColor:
45
- type: string
46
- href:
47
- type: string
48
- name: Logo
49
- required:
50
- - title
51
- - version
52
- extensionsPrefix: x-
53
- name: Info
54
- servers:
55
- name: ServerList
56
- properties: {}
57
- items:
58
- properties:
59
- url:
60
- type: string
61
- description:
62
- type: string
63
- variables:
64
- name: ServerVariablesMap
65
- properties: {}
66
- required:
67
- - url
68
- extensionsPrefix: x-
69
- name: Server
70
- security:
71
- name: SecurityRequirementList
72
- properties: {}
73
- items:
74
- properties: {}
75
- additionalProperties:
76
- type: array
77
- items:
78
- type: string
79
- name: SecurityRequirement
80
- tags:
81
- name: TagList
82
- properties: {}
83
- items:
84
- properties:
85
- name:
86
- type: string
87
- description:
88
- type: string
89
- externalDocs:
90
- properties:
91
- description:
92
- type: string
93
- url:
94
- type: string
95
- required:
96
- - url
97
- extensionsPrefix: x-
98
- name: ExternalDocs
99
- x-traitTag:
100
- type: boolean
101
- x-displayName:
102
- type: string
103
- required:
104
- - name
105
- extensionsPrefix: x-
106
- name: Tag
107
- externalDocs:
108
- properties:
109
- description:
110
- type: string
111
- url:
112
- type: string
113
- required:
114
- - url
115
- extensionsPrefix: x-
116
- name: ExternalDocs
117
- paths:
118
- properties: {}
119
- name: Paths
120
- components:
121
- properties:
122
- parameters:
123
- name: NamedParameters
124
- properties: {}
125
- schemas:
126
- name: NamedSchemas
127
- properties: {}
128
- responses:
129
- name: NamedResponses
130
- properties: {}
131
- examples:
132
- name: NamedExamples
133
- properties: {}
134
- requestBodies:
135
- name: NamedRequestBodies
136
- properties: {}
137
- headers:
138
- name: NamedHeaders
139
- properties: {}
140
- securitySchemes:
141
- name: NamedSecuritySchemes
142
- properties: {}
143
- links:
144
- name: NamedLinks
145
- properties: {}
146
- callbacks:
147
- name: NamedCallbacks
148
- properties: {}
149
- extensionsPrefix: x-
150
- name: Components
151
- x-webhooks:
152
- properties: {}
153
- name: WebhooksMap
154
- x-tagGroups:
155
- name: TagGroups
156
- properties: {}
157
- items:
158
- properties:
159
- name:
160
- type: string
161
- tags:
162
- type: array
163
- items:
164
- type: string
165
- extensionsPrefix: x-
166
- name: TagGroup
167
- x-ignoredHeaderParameters:
168
- type: array
169
- items:
170
- type: string
171
- required:
172
- - openapi
173
- - paths
174
- - info
175
- extensionsPrefix: x-
176
- name: Root
177
- refTypes: {}
178
- visitorsData:
179
- registry-dependencies:
180
- links:
181
- - https://api.redocly.com/registry/params
182
-
183
- `;
184
-
185
- exports[`bundle should bundle external refs 1`] = `
186
- openapi: 3.0.0
187
- paths:
188
- /pet:
189
- parameters:
190
- - $ref: '#/components/parameters/path-param'
191
- put:
192
- parameters:
193
- - $ref: '#/components/parameters/param-a'
194
- - $ref: '#/components/parameters/param-b'
195
- - name: test
196
- get:
197
- parameters:
198
- - $ref: '#/components/parameters/param-a'
199
- - $ref: '#/components/parameters/param-c'
200
- post:
201
- parameters:
202
- - $ref: '#/paths/~1pet/put/parameters/2'
203
- components:
204
- parameters:
205
- param-a:
206
- name: param_a
207
- schema:
208
- $ref: '#/components/schemas/schema-a'
209
- examples:
210
- first:
211
- $ref: '#/components/examples/param-a-first'
212
- second:
213
- $ref: '#/components/examples/second'
214
- path-param:
215
- name: path_param
216
- examples:
217
- first:
218
- $ref: '#/components/examples/first'
219
- param-c:
220
- name: param_c
221
- param-b:
222
- name: param_b
223
- examples:
224
- first:
225
- value: b1
226
- param-a-first:
227
- value: a1
228
- second:
229
- value: a2
230
- schemas:
231
- schema-a:
232
- type: string
233
-
234
- `;
235
-
236
- exports[`bundle should bundle external refs and warn for conflicting names 1`] = `
237
- openapi: 3.0.0
238
- paths:
239
- /pet:
240
- parameters:
241
- - $ref: '#/components/parameters/path-param'
242
- put:
243
- parameters:
244
- - $ref: '#/components/parameters/param-b'
245
- - $ref: '#/components/parameters/param-b-2'
246
- get:
247
- parameters:
248
- - $ref: '#/components/parameters/param-a'
249
- - $ref: '#/components/parameters/param-c'
250
- components:
251
- parameters:
252
- param-a:
253
- name: test
254
- param-b:
255
- name: param_b_alt
256
- path-param:
257
- name: path_param
258
- param-c:
259
- name: param_c
260
- param-b-2:
261
- name: param_b
262
-
263
- `;
264
-
265
- exports[`bundle should dereferenced correctly when used with dereference 1`] = `
266
- openapi: 3.0.0
267
- paths:
268
- /pet:
269
- get:
270
- operationId: get
271
- parameters:
272
- - name: shared-a
273
- - name: get_b
274
- post:
275
- operationId: post
276
- parameters:
277
- - name: shared-a
278
- components:
279
- parameters:
280
- shared_a:
281
- name: shared-a
282
-
283
- `;
284
-
285
- exports[`bundle should not bundle url refs if used with keepUrlRefs 1`] = `
286
- openapi: 3.0.0
287
- paths:
288
- /pet:
289
- parameters:
290
- - $ref: '#/components/parameters/path-param'
291
- put:
292
- parameters:
293
- - $ref: https://someexternal.schema
294
- - $ref: '#/components/parameters/param-b'
295
- - name: test
296
- get:
297
- parameters:
298
- - $ref: http://someexternal.schema
299
- - $ref: '#/components/parameters/param-c'
300
- components:
301
- parameters:
302
- path-param:
303
- name: path_param
304
- param-c:
305
- name: param_c
306
- param-b:
307
- name: param_b
308
-
309
- `;
310
-
311
- exports[`bundle should not place referened schema inline when component in question is not of type "schemas" 1`] = `
312
- openapi: 3.0.0
313
- paths:
314
- /pet:
315
- post:
316
- requestBody:
317
- content:
318
- application/json:
319
- schema:
320
- $ref: '#/components/schemas/requestBody'
321
- components:
322
- schemas:
323
- requestBody:
324
- content:
325
- application/json:
326
- schema:
327
- type: object
328
- properties:
329
- a:
330
- type: string
331
- b:
332
- type: number
333
-
334
- `;
335
-
336
- exports[`bundle should place referenced schema inline when referenced schema name resolves to original schema name 1`] = `
337
- openapi: 3.1.0
338
- info:
339
- title: My API
340
- description: It ain't so wonderful, but at least it's mine.
341
- version: '1.0'
342
- contact:
343
- email: me@theintenet.com
344
- name: me
345
- paths:
346
- /test:
347
- get:
348
- summary: test
349
- responses:
350
- '200':
351
- description: test
352
- content:
353
- application/json:
354
- schema:
355
- $ref: '#/components/schemas/vendor.schema'
356
- components:
357
- schemas:
358
- vendor:
359
- $ref: '#/components/schemas/vendor.schema'
360
- myvendor:
361
- $ref: '#/components/schemas/vendor.schema'
362
- simple:
363
- type: string
364
- A:
365
- type: string
366
- test:
367
- $ref: '#/components/schemas/rename-2'
368
- rename:
369
- type: string
370
- rename-2:
371
- type: number
372
- vendor.schema:
373
- title: vendor
374
- type: object
375
- description: Vendors
376
- properties:
377
- key:
378
- type: string
379
- description: System-assigned key for the vendor.
380
- readOnly: true
381
- id:
382
- type: string
383
- description: >
384
- Unique identifier of the vendor.
385
-
386
- You must specify a unique vendor ID when creating a vendor unless
387
- document sequencing is configured, in which case the ID is
388
- auto-generated.
389
- name:
390
- type: string
391
- description: Name of the vendor.
392
- isOneTimeUse:
393
- type: boolean
394
- description: One-time use
395
- default: false
396
-
397
- `;
398
-
399
- exports[`bundle should pull hosted schema 1`] = `
400
- openapi: 3.0.3
401
- info:
402
- title: bugtest
403
- version: '1.0'
404
- description: Demo
405
- license:
406
- name: DEMO
407
- url: https://demo.com
408
- servers:
409
- - url: http://demo.com/api
410
- paths:
411
- /customer:
412
- summary: Customer scope
413
- get:
414
- summary: Get demo no refs
415
- operationId: GetCustomer
416
- description: Returns Demo No Refs
417
- responses:
418
- '200':
419
- description: Demo No Refs
420
- content:
421
- application/json:
422
- schema:
423
- $ref: '#/components/schemas/Customer'
424
- components:
425
- schemas:
426
- Customer:
427
- type: object
428
- properties:
429
- customerName:
430
- type: string
431
- accounts:
432
- type: array
433
- items:
434
- $ref: '#/components/schemas/someexternal'
435
- someexternal: External schema content
436
-
437
- `;
@@ -1,236 +0,0 @@
1
- import outdent from 'outdent';
2
- import * as path from 'path';
3
-
4
- import { bundleDocument, bundle } from '../bundle';
5
- import { parseYamlToDocument, yamlSerializer, makeConfig } from '../../__tests__/utils';
6
- import { StyleguideConfig, Config, ResolvedConfig } from '../config';
7
- import { BaseResolver } from '../resolve';
8
-
9
- describe('bundle', () => {
10
- const fetchMock = jest.fn(() =>
11
- Promise.resolve({
12
- ok: true,
13
- text: () => 'External schema content',
14
- headers: {
15
- get: () => '',
16
- },
17
- })
18
- );
19
-
20
- expect.addSnapshotSerializer(yamlSerializer);
21
-
22
- const testDocument = parseYamlToDocument(
23
- outdent`
24
- openapi: 3.0.0
25
- paths:
26
- /pet:
27
- get:
28
- operationId: get
29
- parameters:
30
- - $ref: '#/components/parameters/shared_a'
31
- - name: get_b
32
- post:
33
- operationId: post
34
- parameters:
35
- - $ref: '#/components/parameters/shared_a'
36
- components:
37
- parameters:
38
- shared_a:
39
- name: shared-a
40
- `,
41
- ''
42
- );
43
-
44
- it('change nothing with only internal refs', async () => {
45
- const { bundle, problems } = await bundleDocument({
46
- document: testDocument,
47
- externalRefResolver: new BaseResolver(),
48
- config: new StyleguideConfig({}),
49
- });
50
-
51
- const origCopy = JSON.parse(JSON.stringify(testDocument.parsed));
52
-
53
- expect(problems).toHaveLength(0);
54
- expect(bundle.parsed).toEqual(origCopy);
55
- });
56
-
57
- it('should bundle external refs', async () => {
58
- const { bundle: res, problems } = await bundle({
59
- config: new Config({} as ResolvedConfig),
60
- ref: path.join(__dirname, 'fixtures/refs/openapi-with-external-refs.yaml'),
61
- });
62
- expect(problems).toHaveLength(0);
63
- expect(res.parsed).toMatchSnapshot();
64
- });
65
-
66
- it('should bundle external refs and warn for conflicting names', async () => {
67
- const { bundle: res, problems } = await bundle({
68
- config: new Config({} as ResolvedConfig),
69
- ref: path.join(__dirname, 'fixtures/refs/openapi-with-external-refs-conflicting-names.yaml'),
70
- });
71
- expect(problems).toHaveLength(1);
72
- expect(problems[0].message).toEqual(
73
- `Two schemas are referenced with the same name but different content. Renamed param-b to param-b-2.`
74
- );
75
- expect(res.parsed).toMatchSnapshot();
76
- });
77
-
78
- it('should dereferenced correctly when used with dereference', async () => {
79
- const { bundle: res, problems } = await bundleDocument({
80
- externalRefResolver: new BaseResolver(),
81
- config: new StyleguideConfig({}),
82
- document: testDocument,
83
- dereference: true,
84
- });
85
-
86
- expect(problems).toHaveLength(0);
87
- expect(res.parsed).toMatchSnapshot();
88
- });
89
-
90
- it('should place referenced schema inline when referenced schema name resolves to original schema name', async () => {
91
- const { bundle: res, problems } = await bundle({
92
- config: new Config({} as ResolvedConfig),
93
- ref: path.join(__dirname, 'fixtures/refs/externalref.yaml'),
94
- });
95
-
96
- expect(problems).toHaveLength(0);
97
- expect(res.parsed).toMatchSnapshot();
98
- });
99
-
100
- it('should not place referened schema inline when component in question is not of type "schemas"', async () => {
101
- const { bundle: res, problems } = await bundle({
102
- config: new Config({} as ResolvedConfig),
103
- ref: path.join(__dirname, 'fixtures/refs/external-request-body.yaml'),
104
- });
105
-
106
- expect(problems).toHaveLength(0);
107
- expect(res.parsed).toMatchSnapshot();
108
- });
109
-
110
- it('should pull hosted schema', async () => {
111
- const { bundle: res, problems } = await bundle({
112
- config: new Config({} as ResolvedConfig),
113
- externalRefResolver: new BaseResolver({
114
- http: {
115
- customFetch: fetchMock,
116
- headers: [],
117
- },
118
- }),
119
- ref: path.join(__dirname, 'fixtures/refs/hosted.yaml'),
120
- });
121
-
122
- expect(problems).toHaveLength(0);
123
- expect(fetchMock).toHaveBeenCalledWith('https://someexternal.schema', {
124
- headers: {},
125
- });
126
- expect(res.parsed).toMatchSnapshot();
127
- });
128
-
129
- it('should not bundle url refs if used with keepUrlRefs', async () => {
130
- const { bundle: res, problems } = await bundle({
131
- config: new Config({} as ResolvedConfig),
132
- externalRefResolver: new BaseResolver({
133
- http: {
134
- customFetch: fetchMock,
135
- headers: [],
136
- },
137
- }),
138
- ref: path.join(__dirname, 'fixtures/refs/openapi-with-url-refs.yaml'),
139
- keepUrlRefs: true,
140
- });
141
- expect(problems).toHaveLength(0);
142
- expect(res.parsed).toMatchSnapshot();
143
- });
144
-
145
- it('should add to meta ref from redocly registry', async () => {
146
- const testDocument = parseYamlToDocument(
147
- outdent`
148
- openapi: 3.0.0
149
- paths:
150
- /pet:
151
- get:
152
- operationId: get
153
- parameters:
154
- - $ref: '#/components/parameters/shared_a'
155
- - name: get_b
156
- post:
157
- operationId: post
158
- parameters:
159
- - $ref: 'https://api.redocly.com/registry/params'
160
- components:
161
- parameters:
162
- shared_a:
163
- name: shared-a
164
- `,
165
- ''
166
- );
167
-
168
- const config = await makeConfig({}, { 'registry-dependencies': 'on' });
169
-
170
- const {
171
- bundle: result,
172
- problems,
173
- ...meta
174
- } = await bundleDocument({
175
- document: testDocument,
176
- config: config,
177
- externalRefResolver: new BaseResolver({
178
- http: {
179
- customFetch: fetchMock,
180
- headers: [],
181
- },
182
- }),
183
- });
184
-
185
- const parsedMeta = JSON.parse(JSON.stringify(meta));
186
-
187
- expect(problems).toHaveLength(0);
188
- expect(parsedMeta).toMatchSnapshot();
189
- });
190
-
191
- it('should bundle refs using $anchors', async () => {
192
- const testDocument = parseYamlToDocument(
193
- outdent`
194
- openapi: 3.1.0
195
- components:
196
- schemas:
197
- User:
198
- type: object
199
- properties:
200
- profile:
201
- $ref: '#user-profile'
202
- UserProfile:
203
- $anchor: user-profile
204
- type: string
205
- `,
206
- ''
207
- );
208
-
209
- const config = await makeConfig({});
210
-
211
- const {
212
- bundle: { parsed },
213
- problems,
214
- } = await bundleDocument({
215
- document: testDocument,
216
- config: config,
217
- externalRefResolver: new BaseResolver(),
218
- });
219
-
220
- expect(problems).toHaveLength(0);
221
- expect(parsed).toMatchInlineSnapshot(`
222
- openapi: 3.1.0
223
- components:
224
- schemas:
225
- User:
226
- type: object
227
- properties:
228
- profile:
229
- $ref: '#user-profile'
230
- UserProfile:
231
- $anchor: user-profile
232
- type: string
233
-
234
- `);
235
- });
236
- });