File: allof_with_required_inherited_comprehensive.py

package info (click to toggle)
python-datamodel-code-generator 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,052 kB
  • sloc: python: 29,621; makefile: 15
file content (92 lines) | stat: -rw-r--r-- 2,553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# generated by datamodel-codegen:
#   filename:  allof_with_required_inherited_comprehensive.yaml
#   timestamp: 2019-07-26T00:00:00+00:00

from __future__ import annotations

from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, constr


class Status(Enum):
    active = 'active'
    inactive = 'inactive'


class BaseType(BaseModel):
    id: Optional[int] = None


class ObjectWithProps(BaseModel):
    nested: Optional[str] = None


class AllofPrimitivesWithConstraints(BaseModel):
    pass


class AllofWithPattern(BaseModel):
    pass


class AllofWithUnique(BaseModel):
    pass


class Level2(BaseModel):
    level3: Optional[str] = None


class Level1(BaseModel):
    level2: Optional[Level2] = None


class DeepNested(BaseModel):
    level1: Optional[Level1] = None


class ProjectedEntity(BaseModel):
    primitive_string: Optional[str] = None
    primitive_int: Optional[int] = None
    primitive_number: Optional[float] = None
    primitive_bool: Optional[bool] = None
    ref_field: Optional[BaseType] = None
    enum_field: Optional[Status] = None
    array_with_ref: Optional[List[BaseType]] = None
    array_with_primitive: Optional[List[str]] = None
    object_with_props: Optional[ObjectWithProps] = None
    object_with_additional: Optional[Dict[str, int]] = None
    anyof_field: Optional[Union[str, int]] = None
    oneof_field: Optional[Union[bool, float]] = None
    allof_single_ref: Optional[BaseType] = None
    allof_multiple_refs: Optional[BaseType] = None
    allof_primitives_with_constraints: Optional[AllofPrimitivesWithConstraints] = None
    allof_with_pattern: Optional[AllofWithPattern] = None
    allof_with_unique: Optional[AllofWithUnique] = None
    type_list: Optional[str] = None
    deep_nested: Optional[DeepNested] = None


class Entity(ProjectedEntity):
    extra: Optional[str] = None
    primitive_string: str
    primitive_int: int
    primitive_number: float
    primitive_bool: bool
    ref_field: BaseType
    enum_field: Status
    array_with_ref: List[BaseType]
    array_with_primitive: List[str]
    object_with_props: Dict[str, Any]
    object_with_additional: Dict[str, int]
    anyof_field: Union[str, int]
    oneof_field: Union[bool, float]
    allof_single_ref: BaseType
    allof_multiple_refs: BaseType
    allof_primitives_with_constraints: constr(min_length=5, max_length=100)
    allof_with_pattern: constr(regex=r'(?=^[a-z]+)(?=[0-9]$)')
    allof_with_unique: List[str]
    type_list: Optional[str]
    deep_nested: Dict[str, Any]