-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Please consider the following code:
@dataclass
class B:
id: str
@dataclass
class A:
x: list[Annotated[B,'desc']]
schema = dataglasses.to_json_schema(A)
pprint.pprint(schema)
The produced output is
{'$defs': {'A': {'properties': {'x': {'items': {'$ref': '#/$defs/B',
'description': 'desc'},
'type': 'array'}},
'required': ['x'],
'type': 'object'},
'B': {'properties': {'id': {'type': 'string'}},
'required': ['id'],
'type': 'object'}},
'$ref': '#/$defs/A',
'$schema': 'https://json-schema.org/draft/2020-12/schema'}
AFAIK, though, siblings of $ref are ignored.
Metadata
Metadata
Assignees
Labels
No labels