@aloma.io/integration-sdk 3.8.53 → 3.8.54
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.
@@ -45,11 +45,21 @@ export class OpenAPIToConnector {
|
|
45
45
|
throw new Error(`Failed to parse OpenAPI spec: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
46
46
|
}
|
47
47
|
}
|
48
|
-
// Validate against OpenAPI 3.x schema
|
48
|
+
// Validate against OpenAPI 3.x schema with lenient validation
|
49
49
|
const validationResult = OpenAPISchema.safeParse(parsed);
|
50
50
|
if (!validationResult.success) {
|
51
|
-
|
52
|
-
|
51
|
+
// Check if the errors are just about missing 'type' fields in schemas
|
52
|
+
const criticalErrors = validationResult.error.errors.filter((err) => {
|
53
|
+
const path = err.path.join('.');
|
54
|
+
// Allow missing 'type' in schema definitions as many OpenAPI specs don't include it
|
55
|
+
return !path.includes('components.schemas') || !err.message.includes('Required');
|
56
|
+
});
|
57
|
+
if (criticalErrors.length > 0) {
|
58
|
+
const errors = criticalErrors.map((err) => `${err.path.join('.')}: ${err.message}`).join(', ');
|
59
|
+
throw new Error(`Invalid OpenAPI 3.x specification: ${errors}`);
|
60
|
+
}
|
61
|
+
// Log a warning about lenient validation
|
62
|
+
console.warn('⚠️ OpenAPI spec has some validation warnings but proceeding with lenient validation...');
|
53
63
|
}
|
54
64
|
return parsed;
|
55
65
|
}
|
package/package.json
CHANGED
@@ -65,11 +65,23 @@ export class OpenAPIToConnector {
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
|
68
|
-
// Validate against OpenAPI 3.x schema
|
68
|
+
// Validate against OpenAPI 3.x schema with lenient validation
|
69
69
|
const validationResult = OpenAPISchema.safeParse(parsed);
|
70
70
|
if (!validationResult.success) {
|
71
|
-
|
72
|
-
|
71
|
+
// Check if the errors are just about missing 'type' fields in schemas
|
72
|
+
const criticalErrors = validationResult.error.errors.filter((err) => {
|
73
|
+
const path = err.path.join('.');
|
74
|
+
// Allow missing 'type' in schema definitions as many OpenAPI specs don't include it
|
75
|
+
return !path.includes('components.schemas') || !err.message.includes('Required');
|
76
|
+
});
|
77
|
+
|
78
|
+
if (criticalErrors.length > 0) {
|
79
|
+
const errors = criticalErrors.map((err) => `${err.path.join('.')}: ${err.message}`).join(', ');
|
80
|
+
throw new Error(`Invalid OpenAPI 3.x specification: ${errors}`);
|
81
|
+
}
|
82
|
+
|
83
|
+
// Log a warning about lenient validation
|
84
|
+
console.warn('⚠️ OpenAPI spec has some validation warnings but proceeding with lenient validation...');
|
73
85
|
}
|
74
86
|
|
75
87
|
return parsed as OpenAPIV3.Document;
|