From 9cd5cd71c36e502b26abf0306e61f276fbad676c Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Tue, 20 Aug 2024 17:23:07 -0400 Subject: [PATCH 1/5] Add field used by Go SDK --- src/arcaflow_plugin_sdk/schema.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index 971df87..d67a5bc 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."), ] + loose_id: typing.Annotated[ + typing.Optional[bool], + _name("Loose ID Check"), + _description("If true, the ID does not need to match another object for " + "them to be considered compatible."), + ] = False def _to_jsonschema_fragment( self, scope: typing.ForwardRef("ScopeSchema"), defs: _JSONSchemaDefs From bf7dd2cc09a9ff35e760ee188ad05d43fe1c0457 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Tue, 20 Aug 2024 17:35:07 -0400 Subject: [PATCH 2/5] Fix problems caused by an optional field --- src/arcaflow_plugin_sdk/schema.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index d67a5bc..0e15587 100644 --- a/src/arcaflow_plugin_sdk/schema.py +++ b/src/arcaflow_plugin_sdk/schema.py @@ -2527,7 +2527,7 @@ class ObjectSchema(_JSONSchemaGenerator, _OpenAPIGenerator): _name("Loose ID Check"), _description("If true, the ID does not need to match another object for " "them to be considered compatible."), - ] = False + ] = None def _to_jsonschema_fragment( self, scope: typing.ForwardRef("ScopeSchema"), defs: _JSONSchemaDefs @@ -4893,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 + loose_id: Optional[bool] = None def __init__( self, cls: Type[ObjectT], properties: Dict[str, PropertyType] ): - super().__init__(cls.__name__, properties) + super().__init__(cls.__name__, properties, False) self._cls = cls self._validate_config(cls, properties) From 63f6c55f884b5b7ba10b53c17b8c34bca122295f Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Tue, 20 Aug 2024 17:40:30 -0400 Subject: [PATCH 3/5] Fix linter error --- src/arcaflow_plugin_sdk/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index 0e15587..f6bfbda 100644 --- a/src/arcaflow_plugin_sdk/schema.py +++ b/src/arcaflow_plugin_sdk/schema.py @@ -2525,8 +2525,8 @@ class ObjectSchema(_JSONSchemaGenerator, _OpenAPIGenerator): loose_id: typing.Annotated[ typing.Optional[bool], _name("Loose ID Check"), - _description("If true, the ID does not need to match another object for " - "them to be considered compatible."), + _description("If true, the ID does not need to match another object " + "for them to be considered compatible."), ] = None def _to_jsonschema_fragment( From e80f299c8dd2d842c57cad0020770eff9692b1e3 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Thu, 22 Aug 2024 17:50:10 -0400 Subject: [PATCH 4/5] Update to match final changes in the Go SDK --- src/arcaflow_plugin_sdk/schema.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index f6bfbda..59428c7 100644 --- a/src/arcaflow_plugin_sdk/schema.py +++ b/src/arcaflow_plugin_sdk/schema.py @@ -2522,9 +2522,9 @@ class ObjectSchema(_JSONSchemaGenerator, _OpenAPIGenerator): _name("Properties"), _description("Properties of this object."), ] - loose_id: typing.Annotated[ + id_unenforced: typing.Annotated[ typing.Optional[bool], - _name("Loose ID Check"), + _name("ID Unenforced"), _description("If true, the ID does not need to match another object " "for them to be considered compatible."), ] = None @@ -4895,7 +4895,7 @@ class ObjectType(ObjectSchema, AbstractType, Generic[ObjectT]): _cls: Type[ObjectT] = None properties: Dict[str, PropertyType] = None - loose_id: Optional[bool] = None + id_unenforced: Optional[bool] = None def __init__( self, cls: Type[ObjectT], properties: Dict[str, PropertyType] From 6af6b03388ae3feff42c2b9cf4f56d219c1611c2 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Thu, 29 Aug 2024 14:32:40 -0400 Subject: [PATCH 5/5] Pass in proper value into super class --- src/arcaflow_plugin_sdk/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arcaflow_plugin_sdk/schema.py b/src/arcaflow_plugin_sdk/schema.py index 59428c7..023905b 100644 --- a/src/arcaflow_plugin_sdk/schema.py +++ b/src/arcaflow_plugin_sdk/schema.py @@ -4900,7 +4900,7 @@ class ObjectType(ObjectSchema, AbstractType, Generic[ObjectT]): def __init__( self, cls: Type[ObjectT], properties: Dict[str, PropertyType] ): - super().__init__(cls.__name__, properties, False) + super().__init__(cls.__name__, properties, self.id_unenforced) self._cls = cls self._validate_config(cls, properties)