forked from openapi-generators/openapi-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference.py
More file actions
22 lines (16 loc) · 823 Bytes
/
reference.py
File metadata and controls
22 lines (16 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from pydantic import BaseModel, Field
class Reference(BaseModel):
"""
A simple object to allow referencing other components in the specification, internally and externally.
The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03)
and follows the same structure, behavior and rules.
For this specification, reference resolution is accomplished as defined by the JSON Reference specification
and not by the JSON Schema specification.
"""
ref: str = Field(alias="$ref")
"""**REQUIRED**. The reference string."""
class Config:
allow_population_by_field_name = True
schema_extra = {
"examples": [{"$ref": "#/components/schemas/Pet"}, {"$ref": "Pet.json"}, {"$ref": "definitions.json#/Pet"}]
}