refactor: enforce mandatory brackets for composite values
Implements Phase 1 and 2 of the syntax rework plan: - Brackets `[]` are now mandatory for all tuple and array values. - Removed the `[Type][]` array syntax; arrays now only use `Type[]`. - `[single]` is now strictly a 1-tuple rather than an array. - Updated documentation and test fixtures to reflect these breaking changes.
This commit is contained in:
@@ -39,13 +39,6 @@ export function schemaToTypeString(
|
||||
return schema.isOptional ? `${baseType} | null` : baseType;
|
||||
}
|
||||
case "array":
|
||||
if (schema.element.type === "tuple") {
|
||||
const tupleElements = schema.element.elements.map((el) => {
|
||||
const typeStr = schemaToTypeString(el.schema, resourceNames);
|
||||
return el.name ? `${el.name}: ${typeStr}` : typeStr;
|
||||
});
|
||||
return `[${tupleElements.join(", ")}][]`;
|
||||
}
|
||||
const elementType = schemaToTypeString(schema.element, resourceNames);
|
||||
if (schema.element.type === "union") {
|
||||
return `(${elementType})[]`;
|
||||
|
||||
Reference in New Issue
Block a user