mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
8d30408c92
needs support
18 lines
319 B
Python
18 lines
319 B
Python
# output-json
|
|
import json
|
|
from pydantic import BaseModel
|
|
from pydantic.json_schema import schema
|
|
|
|
|
|
class Foo(BaseModel):
|
|
a: int
|
|
|
|
|
|
class Model(BaseModel):
|
|
a: Foo
|
|
|
|
|
|
# Default location for OpenAPI
|
|
top_level_schema = schema([Model], ref_prefix='#/components/schemas/')
|
|
print(json.dumps(top_level_schema, indent=2))
|