|
| 1 | +# generated by datamodel-codegen: |
| 2 | +# filename: extras_in_oneof.json |
| 3 | +# timestamp: 2019-07-26T00:00:00+00:00 |
| 4 | + |
| 5 | +from __future__ import annotations |
| 6 | + |
| 7 | +from typing import Optional, Union |
| 8 | + |
| 9 | +from pydantic import BaseModel, Field |
| 10 | + |
| 11 | + |
| 12 | +class OneofProp(BaseModel): |
| 13 | + shared_prop: Optional[str] = Field( |
| 14 | + None, json_schema_extra={'x-shared': 'shared_value'} |
| 15 | + ) |
| 16 | + variant_a_prop: Optional[str] = Field( |
| 17 | + None, json_schema_extra={'x-variant': 'variant_a_value'} |
| 18 | + ) |
| 19 | + |
| 20 | + |
| 21 | +class OneofProp1(BaseModel): |
| 22 | + shared_prop: Optional[str] = Field( |
| 23 | + None, json_schema_extra={'x-shared': 'shared_value'} |
| 24 | + ) |
| 25 | + variant_b_prop: Optional[int] = Field( |
| 26 | + None, json_schema_extra={'x-variant': 'variant_b_value'} |
| 27 | + ) |
| 28 | + |
| 29 | + |
| 30 | +class AnyofProp(BaseModel): |
| 31 | + any_a_prop: Optional[str] = Field(None, json_schema_extra={'x-any': 'any_a_value'}) |
| 32 | + |
| 33 | + |
| 34 | +class AnyofProp1(BaseModel): |
| 35 | + any_b_prop: Optional[bool] = Field(None, json_schema_extra={'x-any': 'any_b_value'}) |
| 36 | + |
| 37 | + |
| 38 | +class ExtrasInOneOf(BaseModel): |
| 39 | + simple_prop: Optional[str] = Field( |
| 40 | + None, json_schema_extra={'x-custom': 'simple_value'} |
| 41 | + ) |
| 42 | + oneof_prop: Optional[Union[OneofProp, OneofProp1]] = Field( |
| 43 | + None, json_schema_extra={'x-parent-custom': 'parent_value'} |
| 44 | + ) |
| 45 | + anyof_prop: Optional[Union[AnyofProp, AnyofProp1]] = None |
0 commit comments