fix: address review issues in static schema generation (#2805)
* fix: address review issues in static schema generation
Add cycle detection for recursive BaseModel types to prevent stack
overflow, use ordered maps for deterministic JSON property output,
fix forward reference handling in model field type annotations, and
close test coverage gaps for nested BaseModels, list/Iterator of
BaseModel, and property ordering.
* fix: guard against slice panic on single-char quoted strings in parseTypeFromString
Fuzz testing found that a bare quote character (e.g. `"`) matched the
forward reference check but caused s[1:0] slice panic. Add len >= 2
guard before slicing.
* fix: bound fuzz tree size to prevent CI timeout in FuzzJSONSchema
The fuzz decoder could build exponentially large SchemaType trees
(up to 4^8 = 65,536 nodes), causing JSONSchema() serialization to
hang on slow CI runners and trigger context deadline exceeded.
Reduce maxFuzzDepth 8→5 and max fields per object 4→2, bounding
worst-case to 2^5 = 32 nodes.
* fix: address review issues in static schema generation
Add cycle detection for recursive BaseModel types to prevent stack
overflow, use ordered maps for deterministic JSON property output,
fix forward reference handling in model field type annotations, and
close test coverage gaps for nested BaseModels, list/Iterator of
BaseModel, and property ordering.
* fix: guard against slice panic on single-char quoted strings in parseTypeFromString
Fuzz testing found that a bare quote character (e.g. `"`) matched the
forward reference check but caused s[1:0] slice panic. Add len >= 2
guard before slicing.
* fix: bound fuzz tree size to prevent CI timeout in FuzzJSONSchema
The fuzz decoder could build exponentially large SchemaType trees
(up to 4^8 = 65,536 nodes), causing JSONSchema() serialization to
hang on slow CI runners and trigger context deadline exceeded.
Reduce maxFuzzDepth 8→5 and max fields per object 4→2, bounding
worst-case to 2^5 = 32 nodes.
* fix: address review comments on static schema generation
- Move forward-ref quote stripping before union/generic parsing so
quoted unions like "str | None" are correctly unquoted first
- Add explicit index >= 0 assertions in property order test to avoid
confusing -1 comparisons when a key is missing
- Add TestForwardReferenceQuotedUnion test for the quoted union fix
- Add String() method on SchemaTypeKind for better panic diagnostics