Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loose_id field. #138

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/arcaflow_plugin_sdk/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2522,6 +2522,12 @@ class ObjectSchema(_JSONSchemaGenerator, _OpenAPIGenerator):
_name("Properties"),
_description("Properties of this object."),
]
id_unenforced: typing.Annotated[
typing.Optional[bool],
_name("ID Unenforced"),
_description("If true, the ID does not need to match another object "
"for them to be considered compatible."),
] = None

def _to_jsonschema_fragment(
self, scope: typing.ForwardRef("ScopeSchema"), defs: _JSONSchemaDefs
Expand Down Expand Up @@ -4887,13 +4893,14 @@ class ObjectType(ObjectSchema, AbstractType, Generic[ObjectT]):
You can now use the object_type to unserialize, validate, and serialize properties.
""" # noqa: E501

_cls: Type[ObjectT]
properties: Dict[str, PropertyType]
_cls: Type[ObjectT] = None
properties: Dict[str, PropertyType] = None
id_unenforced: Optional[bool] = None
dbutenhof marked this conversation as resolved.
Show resolved Hide resolved

def __init__(
self, cls: Type[ObjectT], properties: Dict[str, PropertyType]
):
super().__init__(cls.__name__, properties)
super().__init__(cls.__name__, properties, self.id_unenforced)
dbutenhof marked this conversation as resolved.
Show resolved Hide resolved
self._cls = cls
self._validate_config(cls, properties)

Expand Down