Repository navigation
Infer array 'items' and recognise annotation-only list params (#19) - #26
Merged
Merged
Conversation
…ature schemas (#19) is_type now matches an annotation (bare, subscripted or Optional) against a type or its subclasses; get_properties adds 'items' from the annotation's argument, else from a homogeneous default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d matching args (#19 review) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19.
is_typenow matches an annotation (bare, subscripted, Optional/|union) against a type or its subclasses, sox: list[int],x: list,x: dict[str, int]no longer fall back to 'string'. A subscripted mapping entry (Sequence[str]) needs identical args, so bytes-like andstrannotations stay 'string'.get_propertiesaddsitemsto array params: from the annotation's single argument (list[int],tuple[int, ...], nestedlist[list[str]]), else from the default's elements when they all share one JSON type. Heterogeneous/empty defaults andtuple[int, str]get noitems.Known limits (unchanged): string annotations (
from __future__ import annotations),Annotated,NewTypestill give 'string'. Custom type mappings listing a parent before its child now also apply that order to annotations. A customparam_to_prop_typesees items as a parameter named_.Adversarial review (fresh Opus): fix-then-merge. Confirmed bytes/bytearray/memoryview/UserString annotations flipping to 'array': fixed + test. Protocol-with-data-members
issubclassTypeError: guarded. Gate (priv test-dependents ju --transitive): 11 pass, 1 fail (smart-cv, pre-existing collection error).🤖 Generated with Claude Code