From b87ebc8284a2b54499c7b5ced6fa33d37bcc3fc6 Mon Sep 17 00:00:00 2001 From: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:09:39 -0400 Subject: [PATCH] Add loose_id field. (#138) * Add field used by Go SDK * Fix problems caused by an optional field * Fix linter error * Update to match final changes in the Go SDK * Pass in proper value into super class --- src/arcaflow_plugin_sdk/schema.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index 971df87..023905b 100644 --- a/src/arcaflow_plugin_sdk/schema.py +++ b/src/arcaflow_plugin_sdk/schema.py @@ -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 @@ -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 def __init__( self, cls: Type[ObjectT], properties: Dict[str, PropertyType] ): - super().__init__(cls.__name__, properties) + super().__init__(cls.__name__, properties, self.id_unenforced) self._cls = cls self._validate_config(cls, properties)