@stackwright-pro/openapi 0.3.0-alpha.11 → 0.3.0-alpha.12
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/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2866,6 +2866,14 @@ var OpenAPIPlugin = class {
|
|
|
2866
2866
|
async processIntegration(config, projectRoot) {
|
|
2867
2867
|
const { name, spec, auth, mockUrl, collections, endpoints, actions } = config;
|
|
2868
2868
|
console.log(` - Processing integration: ${name}`);
|
|
2869
|
+
const specPath = spec.startsWith("http") ? spec : path2.resolve(projectRoot, spec);
|
|
2870
|
+
const parser = new OpenAPIParser();
|
|
2871
|
+
const { document } = await parser.parse(specPath);
|
|
2872
|
+
if (mockUrl) {
|
|
2873
|
+
const originalServer = document.servers?.[0]?.url || "unknown";
|
|
2874
|
+
document.servers = [{ url: mockUrl }];
|
|
2875
|
+
console.log(` > Using mock URL: ${mockUrl} (was: ${originalServer})`);
|
|
2876
|
+
}
|
|
2869
2877
|
const httpCollections = (collections || []).filter((c) => {
|
|
2870
2878
|
if (c.transport === "websocket") {
|
|
2871
2879
|
console.warn(
|
|
@@ -2875,22 +2883,18 @@ var OpenAPIPlugin = class {
|
|
|
2875
2883
|
}
|
|
2876
2884
|
return true;
|
|
2877
2885
|
});
|
|
2886
|
+
const HTTP_METHODS = ["get", "post", "put", "patch", "delete", "head", "options"];
|
|
2887
|
+
const specHasHttpPaths = Object.values(document.paths || {}).some(
|
|
2888
|
+
(pathItem) => HTTP_METHODS.some((m) => pathItem?.[m])
|
|
2889
|
+
);
|
|
2878
2890
|
const hasEndpoints = endpoints && (endpoints.include?.length || endpoints.exclude?.length);
|
|
2879
2891
|
const hasActions = actions && actions.length > 0;
|
|
2880
|
-
if (httpCollections.length === 0 && !hasEndpoints && !hasActions) {
|
|
2892
|
+
if (!specHasHttpPaths && httpCollections.length === 0 && !hasEndpoints && !hasActions) {
|
|
2881
2893
|
console.log(
|
|
2882
|
-
" >
|
|
2894
|
+
" > Spec has no HTTP paths \u2014 skipping (WebSocket-only spec not yet supported)"
|
|
2883
2895
|
);
|
|
2884
2896
|
return;
|
|
2885
2897
|
}
|
|
2886
|
-
const specPath = spec.startsWith("http") ? spec : path2.resolve(projectRoot, spec);
|
|
2887
|
-
const parser = new OpenAPIParser();
|
|
2888
|
-
const { document } = await parser.parse(specPath);
|
|
2889
|
-
if (mockUrl) {
|
|
2890
|
-
const originalServer = document.servers?.[0]?.url || "unknown";
|
|
2891
|
-
document.servers = [{ url: mockUrl }];
|
|
2892
|
-
console.log(` > Using mock URL: ${mockUrl} (was: ${originalServer})`);
|
|
2893
|
-
}
|
|
2894
2898
|
const endpointFilter = new EndpointFilter(endpoints);
|
|
2895
2899
|
if (endpoints && (endpoints.include?.length || endpoints.exclude?.length)) {
|
|
2896
2900
|
const includeStr = endpoints.include?.join(", ") || "/**";
|