From d1bbb502808e0ed5db1dfd3feaeec29adab94abf Mon Sep 17 00:00:00 2001 From: Christodoulos Tsoulloftas Date: Sat, 9 Mar 2024 17:06:25 +0200 Subject: [PATCH] feat: Detect circular references more accurately --- output/instances/saxonData/Open/open005.v1.py | 2 +- output/instances/saxonData/Open/open005.v2.py | 2 +- output/instances/saxonData/Open/open005.v3.py | 2 +- output/instances/saxonData/Open/open005.v4.py | 2 +- .../saxonData/Override/over001.v01.py | 2 +- output/instances/saxonData/VC/vc001.n1.py | 2 +- output/instances/saxonData/VC/vc001.v1.py | 2 +- .../d4_3_15/d4_3_15v14_xsd/d4_3_15v14.py | 34 ++++---- .../d4_3_15/d4_3_15v15_xsd/d4_3_15v15.py | 38 ++++----- .../override/over030_xsd/over030a.py | 84 +++++++++---------- 10 files changed, 85 insertions(+), 85 deletions(-) diff --git a/output/instances/saxonData/Open/open005.v1.py b/output/instances/saxonData/Open/open005.v1.py index 136df09cff..98b1cf4db1 100644 --- a/output/instances/saxonData/Open/open005.v1.py +++ b/output/instances/saxonData/Open/open005.v1.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.open.open006_xsd.open006 import Doc +from output.models.saxon_data.open.open005_xsd.open005 import Doc from xsdata.formats.dataclass.models.generics import AnyElement diff --git a/output/instances/saxonData/Open/open005.v2.py b/output/instances/saxonData/Open/open005.v2.py index afb330922a..0e749c7c67 100644 --- a/output/instances/saxonData/Open/open005.v2.py +++ b/output/instances/saxonData/Open/open005.v2.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.open.open006_xsd.open006 import Doc +from output.models.saxon_data.open.open005_xsd.open005 import Doc from xsdata.formats.dataclass.models.generics import AnyElement diff --git a/output/instances/saxonData/Open/open005.v3.py b/output/instances/saxonData/Open/open005.v3.py index 8bdbd431a2..2de7b47dfe 100644 --- a/output/instances/saxonData/Open/open005.v3.py +++ b/output/instances/saxonData/Open/open005.v3.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.open.open006_xsd.open006 import Doc +from output.models.saxon_data.open.open005_xsd.open005 import Doc from xsdata.formats.dataclass.models.generics import AnyElement diff --git a/output/instances/saxonData/Open/open005.v4.py b/output/instances/saxonData/Open/open005.v4.py index c4a98993bb..c82d4e88e7 100644 --- a/output/instances/saxonData/Open/open005.v4.py +++ b/output/instances/saxonData/Open/open005.v4.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.open.open006_xsd.open006 import Doc +from output.models.saxon_data.open.open005_xsd.open005 import Doc obj = Doc( diff --git a/output/instances/saxonData/Override/over001.v01.py b/output/instances/saxonData/Override/over001.v01.py index 8501a05dd3..bf3f1d96b7 100644 --- a/output/instances/saxonData/Override/over001.v01.py +++ b/output/instances/saxonData/Override/over001.v01.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.override.over023_xsd.over023 import Doc +from output.models.saxon_data.override.over001_xsd.over001 import Doc from xsdata.models.datatype import XmlDate diff --git a/output/instances/saxonData/VC/vc001.n1.py b/output/instances/saxonData/VC/vc001.n1.py index aaf32d398d..054ec78a66 100644 --- a/output/instances/saxonData/VC/vc001.n1.py +++ b/output/instances/saxonData/VC/vc001.n1.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.vc.vc024_xsd.vc024 import Temp +from output.models.saxon_data.vc.vc001_xsd.vc001 import Temp obj = Temp( diff --git a/output/instances/saxonData/VC/vc001.v1.py b/output/instances/saxonData/VC/vc001.v1.py index 0b37b2e4ad..93b38b7adc 100644 --- a/output/instances/saxonData/VC/vc001.v1.py +++ b/output/instances/saxonData/VC/vc001.v1.py @@ -1,4 +1,4 @@ -from output.models.saxon_data.vc.vc008_xsd.vc008 import Temp +from output.models.saxon_data.vc.vc001_xsd.vc001 import Temp obj = Temp( diff --git a/output/models/ibm_data/valid/d4_3_15/d4_3_15v14_xsd/d4_3_15v14.py b/output/models/ibm_data/valid/d4_3_15/d4_3_15v14_xsd/d4_3_15v14.py index 8f8e8a10d0..a8aae33dbd 100644 --- a/output/models/ibm_data/valid/d4_3_15/d4_3_15v14_xsd/d4_3_15v14.py +++ b/output/models/ibm_data/valid/d4_3_15/d4_3_15v14_xsd/d4_3_15v14.py @@ -3,29 +3,20 @@ @dataclass -class ElementType1: +class RootType: class Meta: - name = "elementType1" + name = "rootType" - sub_element1: List["RootType"] = field( + ele1: List["ElementType1"] = field( default_factory=list, metadata={ - "name": "subElement1", "type": "Element", "namespace": "", }, ) - - -@dataclass -class ElementType2: - class Meta: - name = "elementType2" - - sub_element2: List["RootType"] = field( + ele2: List["ElementType2"] = field( default_factory=list, metadata={ - "name": "subElement2", "type": "Element", "namespace": "", }, @@ -33,20 +24,29 @@ class Meta: @dataclass -class RootType: +class ElementType1: class Meta: - name = "rootType" + name = "elementType1" - ele1: List[ElementType1] = field( + sub_element1: List[RootType] = field( default_factory=list, metadata={ + "name": "subElement1", "type": "Element", "namespace": "", }, ) - ele2: List[ElementType2] = field( + + +@dataclass +class ElementType2: + class Meta: + name = "elementType2" + + sub_element2: List[RootType] = field( default_factory=list, metadata={ + "name": "subElement2", "type": "Element", "namespace": "", }, diff --git a/output/models/ibm_data/valid/d4_3_15/d4_3_15v15_xsd/d4_3_15v15.py b/output/models/ibm_data/valid/d4_3_15/d4_3_15v15_xsd/d4_3_15v15.py index 8645f3f523..8bdaed3fc4 100644 --- a/output/models/ibm_data/valid/d4_3_15/d4_3_15v15_xsd/d4_3_15v15.py +++ b/output/models/ibm_data/valid/d4_3_15/d4_3_15v15_xsd/d4_3_15v15.py @@ -3,40 +3,40 @@ @dataclass -class ElementType1: +class RootType: class Meta: - name = "elementType1" + name = "rootType" - sub_element1: List["RootType"] = field( + ele1: List["ElementType1"] = field( default_factory=list, metadata={ - "name": "subElement1", "type": "Element", "namespace": "", }, ) - attr1: Optional[str] = field( - default=None, + ele2: List["ElementType2"] = field( + default_factory=list, metadata={ - "type": "Attribute", + "type": "Element", + "namespace": "", }, ) @dataclass -class ElementType2: +class ElementType1: class Meta: - name = "elementType2" + name = "elementType1" - sub_element2: List["RootType"] = field( + sub_element1: List[RootType] = field( default_factory=list, metadata={ - "name": "subElement2", + "name": "subElement1", "type": "Element", "namespace": "", }, ) - attr2: Optional[str] = field( + attr1: Optional[str] = field( default=None, metadata={ "type": "Attribute", @@ -45,22 +45,22 @@ class Meta: @dataclass -class RootType: +class ElementType2: class Meta: - name = "rootType" + name = "elementType2" - ele1: List[ElementType1] = field( + sub_element2: List[RootType] = field( default_factory=list, metadata={ + "name": "subElement2", "type": "Element", "namespace": "", }, ) - ele2: List[ElementType2] = field( - default_factory=list, + attr2: Optional[str] = field( + default=None, metadata={ - "type": "Element", - "namespace": "", + "type": "Attribute", }, ) diff --git a/output/models/saxon_data/override/over030_xsd/over030a.py b/output/models/saxon_data/override/over030_xsd/over030a.py index 35180bd330..c0a509ca70 100644 --- a/output/models/saxon_data/override/over030_xsd/over030a.py +++ b/output/models/saxon_data/override/over030_xsd/over030a.py @@ -135,47 +135,6 @@ class Meta: namespace = "http://example.org/ns/document" -@dataclass -class Blockquote: - class Meta: - name = "blockquote" - namespace = "http://example.org/ns/document" - - title: Optional[Title] = field( - default=None, - metadata={ - "type": "Element", - }, - ) - p: Optional["P"] = field( - default=None, - metadata={ - "type": "Element", - "required": True, - }, - ) - role: Optional[object] = field( - default=None, - metadata={ - "type": "Attribute", - }, - ) - id: Optional[str] = field( - default=None, - metadata={ - "type": "Attribute", - "namespace": "http://www.w3.org/XML/1998/namespace", - }, - ) - base: Optional[str] = field( - default=None, - metadata={ - "type": "Attribute", - "namespace": "http://www.w3.org/XML/1998/namespace", - }, - ) - - @dataclass class ParaType: class Meta: @@ -240,7 +199,7 @@ class Meta: }, { "name": "blockquote", - "type": Blockquote, + "type": Type["Blockquote"], "namespace": "http://example.org/ns/document", }, ), @@ -255,6 +214,47 @@ class Meta: namespace = "http://example.org/ns/document" +@dataclass +class Blockquote: + class Meta: + name = "blockquote" + namespace = "http://example.org/ns/document" + + title: Optional[Title] = field( + default=None, + metadata={ + "type": "Element", + }, + ) + p: Optional[P] = field( + default=None, + metadata={ + "type": "Element", + "required": True, + }, + ) + role: Optional[object] = field( + default=None, + metadata={ + "type": "Attribute", + }, + ) + id: Optional[str] = field( + default=None, + metadata={ + "type": "Attribute", + "namespace": "http://www.w3.org/XML/1998/namespace", + }, + ) + base: Optional[str] = field( + default=None, + metadata={ + "type": "Attribute", + "namespace": "http://www.w3.org/XML/1998/namespace", + }, + ) + + @dataclass class Doc: class Meta: