@arcteninc/core 0.0.44 → 0.0.45
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/package.json
CHANGED
|
@@ -698,9 +698,10 @@ function isFallbackAnySchema(
|
|
|
698
698
|
type: ts.Type,
|
|
699
699
|
checker: ts.TypeChecker
|
|
700
700
|
): boolean {
|
|
701
|
-
//
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
// Empty schema {} means "any value" in JSON Schema draft 2020-12
|
|
702
|
+
// If schema is empty (no keys), it's a fallback "any" schema
|
|
703
|
+
if (Object.keys(schema).length === 0) {
|
|
704
|
+
return true;
|
|
704
705
|
}
|
|
705
706
|
|
|
706
707
|
// If it has properties, anyOf, or items, it's a real schema
|
|
@@ -708,6 +709,11 @@ function isFallbackAnySchema(
|
|
|
708
709
|
return false;
|
|
709
710
|
}
|
|
710
711
|
|
|
712
|
+
// If it has a type property (and it's not 'any'), it's a real schema
|
|
713
|
+
if (schema.type && schema.type !== 'any') {
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
|
|
711
717
|
// Check if it's actually a type reference we couldn't resolve
|
|
712
718
|
// (not a primitive, not an object we processed, etc.)
|
|
713
719
|
return isTypeReference(type, checker);
|
|
@@ -754,12 +760,12 @@ function serializeType(
|
|
|
754
760
|
const typeString = checker.typeToString(type);
|
|
755
761
|
|
|
756
762
|
if (depth > MAX_SERIALIZATION_DEPTH) {
|
|
757
|
-
return { isOptional: false, schema: {
|
|
763
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
758
764
|
}
|
|
759
765
|
|
|
760
766
|
const typeId = getTypeId(type);
|
|
761
767
|
if (typeId !== undefined && visited.has(typeId)) {
|
|
762
|
-
return { isOptional: false, schema: {
|
|
768
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
763
769
|
}
|
|
764
770
|
|
|
765
771
|
// Handle primitives
|
|
@@ -877,21 +883,21 @@ function serializeType(
|
|
|
877
883
|
if (!isFallbackAnySchema(resolvedResult.schema, resolvedType, checker)) {
|
|
878
884
|
anyOf.push(resolvedResult.schema);
|
|
879
885
|
} else {
|
|
880
|
-
anyOf.push({
|
|
886
|
+
anyOf.push({}); // Empty schema = any value (JSON Schema draft 2020-12)
|
|
881
887
|
}
|
|
882
888
|
} catch (error) {
|
|
883
|
-
anyOf.push({
|
|
889
|
+
anyOf.push({}); // Empty schema = any value (JSON Schema draft 2020-12)
|
|
884
890
|
}
|
|
885
891
|
} else {
|
|
886
|
-
// It's a type reference we couldn't fully resolve - use
|
|
887
|
-
anyOf.push({
|
|
892
|
+
// It's a type reference we couldn't fully resolve - use empty schema (any value)
|
|
893
|
+
anyOf.push({}); // Empty schema = any value (JSON Schema draft 2020-12)
|
|
888
894
|
}
|
|
889
895
|
}
|
|
890
896
|
} catch (error) {
|
|
891
897
|
// Fallback for unresolvable types
|
|
892
898
|
const unionTypeString = checker.typeToString(unionType);
|
|
893
899
|
console.warn(`Warning: Could not serialize union type: ${unionTypeString}`, error);
|
|
894
|
-
anyOf.push({
|
|
900
|
+
anyOf.push({}); // Empty schema = any value (JSON Schema draft 2020-12)
|
|
895
901
|
}
|
|
896
902
|
}
|
|
897
903
|
}
|
|
@@ -921,7 +927,7 @@ function serializeType(
|
|
|
921
927
|
// Fallback
|
|
922
928
|
return {
|
|
923
929
|
isOptional: false,
|
|
924
|
-
schema: {
|
|
930
|
+
schema: {} // Empty schema = any value (JSON Schema draft 2020-12)
|
|
925
931
|
};
|
|
926
932
|
}
|
|
927
933
|
|
|
@@ -1080,8 +1086,8 @@ function serializeType(
|
|
|
1080
1086
|
} catch (error) {
|
|
1081
1087
|
console.warn(`Warning: Could not extract enum values for type: ${typeString}`, error);
|
|
1082
1088
|
}
|
|
1083
|
-
// If we can't extract enum values, use
|
|
1084
|
-
return { isOptional: false, schema: {
|
|
1089
|
+
// If we can't extract enum values, use empty schema (any value)
|
|
1090
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1085
1091
|
}
|
|
1086
1092
|
|
|
1087
1093
|
// Check if it's a type reference (like InternalFilterType.StringFilter)
|
|
@@ -1093,7 +1099,7 @@ function serializeType(
|
|
|
1093
1099
|
// Empty object or type reference we can't resolve
|
|
1094
1100
|
// Check if typeString suggests it's a named type reference
|
|
1095
1101
|
if (typeString && typeString.includes('.')) {
|
|
1096
|
-
return { isOptional: false, schema: {
|
|
1102
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1097
1103
|
}
|
|
1098
1104
|
}
|
|
1099
1105
|
}
|
|
@@ -1129,17 +1135,18 @@ function serializeType(
|
|
|
1129
1135
|
return { isOptional: false, schema: { type: 'null' } };
|
|
1130
1136
|
}
|
|
1131
1137
|
if (type.flags & ts.TypeFlags.Unknown) {
|
|
1132
|
-
return { isOptional: false, schema: {
|
|
1138
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1133
1139
|
}
|
|
1134
1140
|
if (type.flags & ts.TypeFlags.Any) {
|
|
1135
|
-
return { isOptional: false, schema: {
|
|
1141
|
+
return { isOptional: false, schema: {} }; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1136
1142
|
}
|
|
1137
1143
|
|
|
1138
|
-
// For any other unrecognized type, use
|
|
1144
|
+
// For any other unrecognized type, use empty schema instead of invalid type strings
|
|
1139
1145
|
// This prevents errors like "type": "InternalFilterType.StringFilter"
|
|
1146
|
+
// Empty schema {} means "allow any value" in JSON Schema draft 2020-12
|
|
1140
1147
|
return {
|
|
1141
1148
|
isOptional: false,
|
|
1142
|
-
schema: {
|
|
1149
|
+
schema: {} // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1143
1150
|
};
|
|
1144
1151
|
}
|
|
1145
1152
|
|
|
@@ -1337,7 +1344,7 @@ function extractFunctionMetadata(
|
|
|
1337
1344
|
propSchema = result.schema;
|
|
1338
1345
|
isOptional = result.isOptional;
|
|
1339
1346
|
} else {
|
|
1340
|
-
propSchema = {
|
|
1347
|
+
propSchema = {}; // Empty schema = any value (JSON Schema draft 2020-12)
|
|
1341
1348
|
}
|
|
1342
1349
|
|
|
1343
1350
|
// Check if parameter has default value or question mark
|