fix: extension-fields parse error from compose spec #48
This commit is contained in:
parent
9cb6baaa03
commit
e902237356
1 changed files with 93 additions and 70 deletions
|
@ -1,6 +1,6 @@
|
|||
# generated by datamodel-codegen:
|
||||
# filename: compose-spec.json
|
||||
# timestamp: 2023-01-10T13:17:45+00:00
|
||||
# timestamp: 2023-05-03T07:42:00+00:00
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
@ -17,7 +17,7 @@ class Cgroup(YamlStrEnum):
|
|||
|
||||
class CredentialSpec(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
config: Optional[str] = None
|
||||
file: Optional[str] = None
|
||||
|
@ -32,14 +32,15 @@ class Condition(YamlStrEnum):
|
|||
|
||||
class DependsOn(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
restart: Optional[bool] = None
|
||||
condition: Condition
|
||||
|
||||
|
||||
class Extend(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
service: str
|
||||
file: Optional[str] = None
|
||||
|
@ -47,15 +48,15 @@ class Extend(YamlModel):
|
|||
|
||||
class Logging(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
driver: Optional[str] = None
|
||||
options: Optional[Dict[constr(regex=r"^.+$"), Optional[Union[str, float]]]] = None # type: ignore # noqa: F722
|
||||
options: Optional[Dict[constr(regex=r"^.+$"), Optional[Union[str, float]]]] = None
|
||||
|
||||
|
||||
class Port(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
mode: Optional[str] = None
|
||||
host_ip: Optional[str] = None
|
||||
|
@ -74,7 +75,7 @@ class PullPolicy(YamlStrEnum):
|
|||
|
||||
class Ulimit(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
hard: int
|
||||
soft: int
|
||||
|
@ -87,7 +88,7 @@ class Selinux(YamlStrEnum):
|
|||
|
||||
class Bind(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
propagation: Optional[str] = None
|
||||
create_host_path: Optional[bool] = None
|
||||
|
@ -96,22 +97,22 @@ class Bind(YamlModel):
|
|||
|
||||
class AdditionalVolumeOption(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
nocopy: Optional[bool] = None
|
||||
|
||||
|
||||
class Tmpfs(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
size: Optional[Union[conint(ge=0), str]] = None # type: ignore
|
||||
size: Optional[Union[conint(ge=0), str]] = None
|
||||
mode: Optional[float] = None
|
||||
|
||||
|
||||
class ServiceVolume(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
type: str
|
||||
source: Optional[str] = None
|
||||
|
@ -125,7 +126,7 @@ class ServiceVolume(YamlModel):
|
|||
|
||||
class Healthcheck(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
disable: Optional[bool] = None
|
||||
interval: Optional[str] = None
|
||||
|
@ -142,7 +143,7 @@ class Order(YamlStrEnum):
|
|||
|
||||
class RollbackConfig(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
parallelism: Optional[int] = None
|
||||
delay: Optional[str] = None
|
||||
|
@ -151,15 +152,13 @@ class RollbackConfig(YamlModel):
|
|||
max_failure_ratio: Optional[float] = None
|
||||
order: Optional[Order] = None
|
||||
|
||||
|
||||
class ConfigOrder(YamlStrEnum):
|
||||
start_first = "start-first"
|
||||
stop_first = "stop-first"
|
||||
|
||||
|
||||
class UpdateConfig(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
parallelism: Optional[int] = None
|
||||
delay: Optional[str] = None
|
||||
|
@ -171,7 +170,7 @@ class UpdateConfig(YamlModel):
|
|||
|
||||
class Limits(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
cpus: Optional[Union[float, str]] = None
|
||||
memory: Optional[str] = None
|
||||
|
@ -180,7 +179,7 @@ class Limits(YamlModel):
|
|||
|
||||
class RestartPolicy(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
condition: Optional[str] = None
|
||||
delay: Optional[str] = None
|
||||
|
@ -190,14 +189,14 @@ class RestartPolicy(YamlModel):
|
|||
|
||||
class Preference(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
spread: Optional[str] = None
|
||||
|
||||
|
||||
class Placement(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
constraints: Optional[List[str]] = None
|
||||
preferences: Optional[List[Preference]] = None
|
||||
|
@ -206,7 +205,7 @@ class Placement(YamlModel):
|
|||
|
||||
class DiscreteResourceSpec(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
kind: Optional[str] = None
|
||||
value: Optional[float] = None
|
||||
|
@ -214,48 +213,49 @@ class DiscreteResourceSpec(YamlModel):
|
|||
|
||||
class GenericResource(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
discrete_resource_spec: Optional[DiscreteResourceSpec] = None
|
||||
|
||||
|
||||
class GenericResources(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: List[GenericResource]
|
||||
|
||||
|
||||
class ConfigItem(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
subnet: Optional[str] = None
|
||||
ip_range: Optional[str] = None
|
||||
gateway: Optional[str] = None
|
||||
aux_addresses: Optional[Dict[constr(regex=r"^.+$"), str]] = None # type: ignore # noqa: F722
|
||||
aux_addresses: Optional[Dict[constr(regex=r"^.+$"), str]] = None
|
||||
|
||||
|
||||
class Ipam(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
driver: Optional[str] = None
|
||||
config: Optional[List[ConfigItem]] = None
|
||||
options: Optional[Dict[constr(regex=r"^.+$"), str]] = None # type: ignore # noqa: F722
|
||||
options: Optional[Dict[constr(regex=r"^.+$"), str]] = None
|
||||
|
||||
|
||||
class ExternalNetwork(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
class ExternalVolume(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
|
||||
extra = Extra.allow
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
class ExternalSecret(YamlModel):
|
||||
name: Optional[str] = None
|
||||
|
||||
|
@ -263,20 +263,25 @@ class ExternalSecret(YamlModel):
|
|||
class ExternalConfig(YamlModel):
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
class ListOfStrings(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: List[str] = Field(..., unique_items=True)
|
||||
|
||||
|
||||
class ListOrDict(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: Union[
|
||||
Dict[constr(regex=r".+"), Optional[Union[str, float, bool]]], List[str] # type: ignore # noqa: F722
|
||||
Dict[constr(regex=r".+"), Optional[Union[str, float, bool]]], List[str]
|
||||
]
|
||||
|
||||
|
||||
class BlkioLimit(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
path: Optional[str] = None
|
||||
rate: Optional[Union[int, str]] = None
|
||||
|
@ -284,7 +289,7 @@ class BlkioLimit(YamlModel):
|
|||
|
||||
class BlkioWeight(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
path: Optional[str] = None
|
||||
weight: Optional[int] = None
|
||||
|
@ -292,7 +297,7 @@ class BlkioWeight(YamlModel):
|
|||
|
||||
class ServiceConfigOrSecretItem(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
source: Optional[str] = None
|
||||
target: Optional[str] = None
|
||||
|
@ -302,25 +307,33 @@ class ServiceConfigOrSecretItem(YamlModel):
|
|||
|
||||
|
||||
class ServiceConfigOrSecret(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: List[Union[str, ServiceConfigOrSecretItem]]
|
||||
|
||||
|
||||
class Constraints(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: Any
|
||||
|
||||
|
||||
class BuildItem(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
context: Optional[str] = None
|
||||
dockerfile: Optional[str] = None
|
||||
dockerfile_inline: Optional[str] = None
|
||||
args: Optional[ListOrDict] = None
|
||||
ssh: Optional[ListOrDict] = None
|
||||
labels: Optional[ListOrDict] = None
|
||||
cache_from: Optional[List[str]] = None
|
||||
cache_to: Optional[List[str]] = None
|
||||
no_cache: Optional[bool] = None
|
||||
additional_contexts: Optional[ListOrDict] = None
|
||||
network: Optional[str] = None
|
||||
pull: Optional[bool] = None
|
||||
target: Optional[str] = None
|
||||
|
@ -335,7 +348,7 @@ class BuildItem(YamlModel):
|
|||
|
||||
class BlkioConfig(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
device_read_bps: Optional[List[BlkioLimit]] = None
|
||||
device_read_iops: Optional[List[BlkioLimit]] = None
|
||||
|
@ -347,7 +360,7 @@ class BlkioConfig(YamlModel):
|
|||
|
||||
class ServiceNetwork(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
aliases: Optional[ListOfStrings] = None
|
||||
ipv4_address: Optional[str] = None
|
||||
|
@ -358,7 +371,7 @@ class ServiceNetwork(YamlModel):
|
|||
|
||||
class Device(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
capabilities: Optional[ListOfStrings] = None
|
||||
count: Optional[Union[str, int]] = None
|
||||
|
@ -368,18 +381,21 @@ class Device(YamlModel):
|
|||
|
||||
|
||||
class Devices(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: List[Device]
|
||||
|
||||
|
||||
class Network(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
name: Optional[str] = None
|
||||
driver: Optional[str] = None
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None # type: ignore # noqa: F722
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None
|
||||
ipam: Optional[Ipam] = None
|
||||
external: Optional[bool | ExternalNetwork] = None
|
||||
external: Optional[ExternalNetwork] = None
|
||||
internal: Optional[bool] = None
|
||||
enable_ipv6: Optional[bool] = None
|
||||
attachable: Optional[bool] = None
|
||||
|
@ -388,18 +404,18 @@ class Network(YamlModel):
|
|||
|
||||
class Volume(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
name: Optional[str] = None
|
||||
driver: Optional[str] = None
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None # type: ignore # noqa: F722
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None
|
||||
external: Optional[ExternalVolume] = None
|
||||
labels: Optional[ListOrDict] = None
|
||||
|
||||
|
||||
class Secret(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
name: Optional[str] = None
|
||||
environment: Optional[str] = None
|
||||
|
@ -407,13 +423,13 @@ class Secret(YamlModel):
|
|||
external: Optional[ExternalSecret] = None
|
||||
labels: Optional[ListOrDict] = None
|
||||
driver: Optional[str] = None
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None # type: ignore # noqa: F722
|
||||
driver_opts: Optional[Dict[constr(regex=r"^.+$"), Union[str, float]]] = None
|
||||
template_driver: Optional[str] = None
|
||||
|
||||
|
||||
class Config(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
name: Optional[str] = None
|
||||
file: Optional[str] = None
|
||||
|
@ -423,12 +439,15 @@ class Config(YamlModel):
|
|||
|
||||
|
||||
class StringOrList(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.allow
|
||||
|
||||
__root__: Union[str, ListOfStrings]
|
||||
|
||||
|
||||
class Reservations(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
cpus: Optional[Union[float, str]] = None
|
||||
memory: Optional[str] = None
|
||||
|
@ -438,7 +457,7 @@ class Reservations(YamlModel):
|
|||
|
||||
class Resources(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
limits: Optional[Limits] = None
|
||||
reservations: Optional[Reservations] = None
|
||||
|
@ -446,7 +465,7 @@ class Resources(YamlModel):
|
|||
|
||||
class Deployment(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
mode: Optional[str] = None
|
||||
endpoint_mode: Optional[str] = None
|
||||
|
@ -461,7 +480,7 @@ class Deployment(YamlModel):
|
|||
|
||||
class Service(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
deploy: Optional[Deployment] = None
|
||||
build: Optional[Union[str, BuildItem]] = None
|
||||
|
@ -470,11 +489,11 @@ class Service(YamlModel):
|
|||
cap_drop: Optional[List[str]] = Field(None, unique_items=True)
|
||||
cgroup: Optional[Cgroup] = None
|
||||
cgroup_parent: Optional[str] = None
|
||||
command: Optional[Union[str, List[str]]] = None
|
||||
command: Optional[ExternalVolume] = None
|
||||
configs: Optional[ServiceConfigOrSecret] = None
|
||||
container_name: Optional[str] = None
|
||||
cpu_count: Optional[conint(ge=0)] = None # type: ignore
|
||||
cpu_percent: Optional[conint(ge=0, le=100)] = None # type: ignore
|
||||
cpu_count: Optional[conint(ge=0)] = None
|
||||
cpu_percent: Optional[conint(ge=0, le=100)] = None
|
||||
cpu_shares: Optional[Union[float, str]] = None
|
||||
cpu_quota: Optional[Union[float, str]] = None
|
||||
cpu_period: Optional[Union[float, str]] = None
|
||||
|
@ -484,7 +503,7 @@ class Service(YamlModel):
|
|||
cpuset: Optional[str] = None
|
||||
credential_spec: Optional[CredentialSpec] = None
|
||||
depends_on: Optional[
|
||||
Union[ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), DependsOn]] # type: ignore # noqa: F722, E501
|
||||
Union[ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), DependsOn]]
|
||||
] = None
|
||||
device_cgroup_rules: Optional[ListOfStrings] = None
|
||||
devices: Optional[List[str]] = Field(None, unique_items=True)
|
||||
|
@ -492,7 +511,7 @@ class Service(YamlModel):
|
|||
dns_opt: Optional[List[str]] = Field(None, unique_items=True)
|
||||
dns_search: Optional[StringOrList] = None
|
||||
domainname: Optional[str] = None
|
||||
entrypoint: Optional[Union[str, List[str]]] = None
|
||||
entrypoint: Optional[ExternalVolume] = None
|
||||
env_file: Optional[StringOrList] = None
|
||||
environment: Optional[ListOrDict] = None
|
||||
expose: Optional[List[Union[str, float]]] = Field(None, unique_items=True)
|
||||
|
@ -517,11 +536,11 @@ class Service(YamlModel):
|
|||
network_mode: Optional[str] = None
|
||||
networks: Optional[
|
||||
Union[
|
||||
ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[ServiceNetwork]] # type: ignore # noqa: F722, E501
|
||||
ListOfStrings, Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[ServiceNetwork]]
|
||||
]
|
||||
] = None
|
||||
oom_kill_disable: Optional[bool] = None
|
||||
oom_score_adj: Optional[conint(ge=-1000, le=1000)] = None # type: ignore
|
||||
oom_score_adj: Optional[conint(ge=-1000, le=1000)] = None
|
||||
pid: Optional[str] = None
|
||||
pids_limit: Optional[Union[float, str]] = None
|
||||
platform: Optional[str] = None
|
||||
|
@ -543,26 +562,30 @@ class Service(YamlModel):
|
|||
storage_opt: Optional[Dict[str, Any]] = None
|
||||
tmpfs: Optional[StringOrList] = None
|
||||
tty: Optional[bool] = None
|
||||
ulimits: Optional[Dict[constr(regex=r"^[a-z]+$"), Union[int, Ulimit]]] = None # type: ignore # noqa: F722
|
||||
ulimits: Optional[Dict[constr(regex=r"^[a-z]+$"), Union[int, Ulimit]]] = None
|
||||
user: Optional[str] = None
|
||||
uts: Optional[str] = None
|
||||
userns_mode: Optional[str] = None
|
||||
volumes: Optional[List[Union[str, ServiceVolume]]] = Field(None, unique_items=True)
|
||||
volumes: Optional[List[Union[str, AdditionalVolumeOption]]] = Field(None, unique_items=True)
|
||||
volumes_from: Optional[List[str]] = Field(None, unique_items=True)
|
||||
working_dir: Optional[str] = None
|
||||
|
||||
|
||||
class ComposeSpecification(YamlModel):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
extra = Extra.allow
|
||||
|
||||
version: Optional[str] = Field(None, description="declared for backward compatibility, ignored.")
|
||||
name: Optional[str] = Field(
|
||||
version: Optional[str] = Field(
|
||||
None, description="declared for backward compatibility, ignored."
|
||||
)
|
||||
name: Optional[constr(regex=r"^[a-z0-9][a-z0-9_-]*$")] = Field(
|
||||
None,
|
||||
description="define the Compose project name, until user defines one explicitly.",
|
||||
)
|
||||
services: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Service]] = None # type: ignore # noqa: F722
|
||||
networks: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[Network]]] = None # type: ignore # noqa: F722
|
||||
volumes: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[Volume]]] = None # type: ignore # noqa: F722
|
||||
secrets: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Secret]] = None # type: ignore # noqa: F722
|
||||
configs: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Config]] = None # type: ignore # noqa: F722
|
||||
services: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Service]] = None
|
||||
networks: Optional[
|
||||
Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[Network]]
|
||||
] = None
|
||||
volumes: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Optional[Volume]]] = None
|
||||
secrets: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Secret]] = None
|
||||
configs: Optional[Dict[constr(regex=r"^[a-zA-Z0-9._-]+$"), Config]] = None
|
||||
|
|
Loading…
Reference in a new issue