@backstage/plugin-catalog-backend-module-openapi 0.2.6 → 0.2.7-next.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.
- package/CHANGELOG.md +13 -0
- package/dist/lib/bundle.cjs.js +1 -1
- package/dist/lib/bundle.cjs.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-openapi
|
|
2
2
|
|
|
3
|
+
## 0.2.7-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7fc6f7c: Fix `resolveUrl` for split openapi definition relative path
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-node@1.15.2-next.0
|
|
10
|
+
- @backstage/backend-plugin-api@1.2.0-next.0
|
|
11
|
+
- @backstage/catalog-model@1.7.3
|
|
12
|
+
- @backstage/integration@1.16.1
|
|
13
|
+
- @backstage/types@1.2.1
|
|
14
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
15
|
+
|
|
3
16
|
## 0.2.6
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/lib/bundle.cjs.js
CHANGED
|
@@ -61,7 +61,7 @@ async function bundleFileWithRefs(fileWithRefs, baseUrl, read, resolveUrl) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
const fileObject = yaml.parse(fileWithRefs);
|
|
64
|
-
const bundledObject = await jsonSchemaRefParser.$RefParser.bundle(
|
|
64
|
+
const bundledObject = await jsonSchemaRefParser.$RefParser.bundle(fileObject, options);
|
|
65
65
|
return yaml.stringify(bundledObject);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.cjs.js","sources":["../../src/lib/bundle.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n $RefParser,\n ParserOptions,\n ResolverOptions,\n} from '@apidevtools/json-schema-ref-parser';\nimport { parse, stringify } from 'yaml';\nimport * as path from 'path';\n\nconst protocolPattern = /^(\\w{2,}):\\/\\//i;\nconst getProtocol = (refPath: string) => {\n const match = protocolPattern.exec(refPath);\n if (match) {\n return match[1].toLowerCase();\n }\n return undefined;\n};\n\nexport type BundlerRead = (url: string) => Promise<Buffer>;\n\nexport type BundlerResolveUrl = (url: string, base: string) => string;\n\nexport async function bundleFileWithRefs(\n fileWithRefs: string,\n baseUrl: string,\n read: BundlerRead,\n resolveUrl: BundlerResolveUrl,\n): Promise<string> {\n const fileUrlReaderResolver: ResolverOptions = {\n canRead: file => {\n const protocol = getProtocol(file.url);\n return protocol === undefined || protocol === 'file';\n },\n read: async file => {\n const relativePath = path.relative('.', file.url);\n const url = resolveUrl(relativePath, baseUrl);\n return await read(url);\n },\n };\n const httpUrlReaderResolver: ResolverOptions = {\n canRead: ref => {\n const protocol = getProtocol(ref.url);\n return protocol === 'http' || protocol === 'https';\n },\n read: async ref => {\n const url = resolveUrl(ref.url, baseUrl);\n return await read(url);\n },\n };\n\n const options: ParserOptions = {\n resolve: {\n file: fileUrlReaderResolver,\n http: httpUrlReaderResolver,\n },\n };\n const fileObject = parse(fileWithRefs);\n const bundledObject = await $RefParser.bundle(
|
|
1
|
+
{"version":3,"file":"bundle.cjs.js","sources":["../../src/lib/bundle.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n $RefParser,\n ParserOptions,\n ResolverOptions,\n} from '@apidevtools/json-schema-ref-parser';\nimport { parse, stringify } from 'yaml';\nimport * as path from 'path';\n\nconst protocolPattern = /^(\\w{2,}):\\/\\//i;\nconst getProtocol = (refPath: string) => {\n const match = protocolPattern.exec(refPath);\n if (match) {\n return match[1].toLowerCase();\n }\n return undefined;\n};\n\nexport type BundlerRead = (url: string) => Promise<Buffer>;\n\nexport type BundlerResolveUrl = (url: string, base: string) => string;\n\nexport async function bundleFileWithRefs(\n fileWithRefs: string,\n baseUrl: string,\n read: BundlerRead,\n resolveUrl: BundlerResolveUrl,\n): Promise<string> {\n const fileUrlReaderResolver: ResolverOptions = {\n canRead: file => {\n const protocol = getProtocol(file.url);\n return protocol === undefined || protocol === 'file';\n },\n read: async file => {\n const relativePath = path.relative('.', file.url);\n const url = resolveUrl(relativePath, baseUrl);\n return await read(url);\n },\n };\n const httpUrlReaderResolver: ResolverOptions = {\n canRead: ref => {\n const protocol = getProtocol(ref.url);\n return protocol === 'http' || protocol === 'https';\n },\n read: async ref => {\n const url = resolveUrl(ref.url, baseUrl);\n return await read(url);\n },\n };\n\n const options: ParserOptions = {\n resolve: {\n file: fileUrlReaderResolver,\n http: httpUrlReaderResolver,\n },\n };\n const fileObject = parse(fileWithRefs);\n const bundledObject = await $RefParser.bundle(fileObject, options);\n return stringify(bundledObject);\n}\n"],"names":["path","parse","$RefParser","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,eAAkB,GAAA,iBAAA;AACxB,MAAM,WAAA,GAAc,CAAC,OAAoB,KAAA;AACvC,EAAM,MAAA,KAAA,GAAQ,eAAgB,CAAA,IAAA,C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A;AACrC,EAAA,MAAM,aAAgB,GAAA,MAAMC,8BAAW,CAAA,MAAA,CAAO,YAAY,OAAO,CAAA;AACjE,EAAA,OAAOC,eAAU,aAAa,CAAA;AAChC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend-module-openapi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7-next.0",
|
|
4
4
|
"description": "A Backstage catalog backend module that helps with OpenAPI specifications",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@apidevtools/json-schema-ref-parser": "^11.0.0",
|
|
41
|
-
"@backstage/backend-plugin-api": "
|
|
42
|
-
"@backstage/catalog-model": "
|
|
43
|
-
"@backstage/integration": "
|
|
44
|
-
"@backstage/plugin-catalog-common": "
|
|
45
|
-
"@backstage/plugin-catalog-node": "
|
|
46
|
-
"@backstage/types": "
|
|
41
|
+
"@backstage/backend-plugin-api": "1.2.0-next.0",
|
|
42
|
+
"@backstage/catalog-model": "1.7.3",
|
|
43
|
+
"@backstage/integration": "1.16.1",
|
|
44
|
+
"@backstage/plugin-catalog-common": "1.1.3",
|
|
45
|
+
"@backstage/plugin-catalog-node": "1.15.2-next.0",
|
|
46
|
+
"@backstage/types": "1.2.1",
|
|
47
47
|
"yaml": "^2.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@backstage/backend-test-utils": "
|
|
51
|
-
"@backstage/cli": "
|
|
50
|
+
"@backstage/backend-test-utils": "1.3.0-next.0",
|
|
51
|
+
"@backstage/cli": "0.30.0-next.0",
|
|
52
52
|
"openapi-types": "^12.0.0"
|
|
53
53
|
},
|
|
54
54
|
"typesVersions": {
|