craft_parts.pydantic_schema module¶
Experiments with pydantic schemas.
- class craft_parts.pydantic_schema.Part(**data)[source]¶
Bases:
BaseModel
Generic schema for all parts.
- Parameters:
data (
Any
)
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation')[source]¶
Create the JSON schema for a Part.
- Parameters:
by_alias (
bool
)ref_template (
str
)schema_generator (
type
[GenerateJsonSchema
])mode (
Literal
['validation'
,'serialization'
])
- Return type:
dict
[str
,Any
]
-
plugin_data:
PluginProperties
¶
-
source_data:
Annotated
[DebSourceModel
|FileSourceModel
|GitSourceModel
|LocalSourceModel
|RpmSourceModel
|SevenzipSourceModel
|SnapSourceModel
|TarSourceModel
|ZipSourceModel
]¶
- class craft_parts.pydantic_schema.PartsFile(**data)[source]¶
Bases:
BaseModel
A root model for a file that contains a ‘parts’ key.
- Parameters:
data (
Any
)
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod model_json_schema(by_alias=True, ref_template='#/$defs/{model}', schema_generator=<class 'pydantic.json_schema.GenerateJsonSchema'>, mode='validation')[source]¶
Create the JSON schema for a file with Parts.
- Parameters:
by_alias (
bool
)ref_template (
str
)schema_generator (
type
[GenerateJsonSchema
])mode (
Literal
['validation'
,'serialization'
])
- Return type:
dict
[str
,Any
]
-
parts:
dict
[str
,Any
]¶