Skip to content
New issue

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

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

Already on GitHub? # to your account

Circular base type dependency #543

Closed
leus opened this issue Jan 22, 2025 · 1 comment
Closed

Circular base type dependency #543

leus opened this issue Jan 22, 2025 · 1 comment

Comments

@leus
Copy link

leus commented Jan 22, 2025

Using the following schemas:

Schemas.zip

I'm trying to generate classes using the following command line:

xscgen --namespace=MyProject --separateFiles --output=../Generated --namingScheme=Direct DU_Wrapper_3.4.0_B324.xsd

Files seem to generate correctly, but I get a bunch of "Circular base type dependency" errors. Other than manually changing these definitions, what else can be done to fix this? Also, any options to #pragma disable warnings like CS8981 (lower case type names) , or an option to normalize only those special cases?

C:\dev\myproject\Generated\LANGUAGE_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'LANGUAGE_EXTENSION' and 'LANGUAGE_EXTENSION'
C:\dev\myproject\Generated\DECLARATION_DETAIL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'DECLARATION_DETAIL_EXTENSION' and 'DECLARATION_DETAIL_EXTENSION'
C:\dev\myproject\Generated\PROPERTY_VALUATION_DETAIL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'PROPERTY_VALUATION_DETAIL_EXTENSION' and 'PROPERTY_VALUATION_DETAIL_EXTENSION'
C:\dev\myproject\Generated\GOVERNMENT_MONITORING_DETAIL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'GOVERNMENT_MONITORING_DETAIL_EXTENSION' and 'GOVERNMENT_MONITORING_DETAIL_EXTENSION'
C:\dev\myproject\Generated\GOVERNMENT_MONITORING_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'GOVERNMENT_MONITORING_EXTENSION' and 'GOVERNMENT_MONITORING_EXTENSION'
C:\dev\myproject\Generated\CONSTRUCTION_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'CONSTRUCTION_EXTENSION' and 'CONSTRUCTION_EXTENSION'
C:\dev\myproject\Generated\QUALIFICATION_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'QUALIFICATION_EXTENSION' and 'QUALIFICATION_EXTENSION'
C:\dev\myproject\Generated\ASSET_DETAIL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'ASSET_DETAIL_EXTENSION' and 'ASSET_DETAIL_EXTENSION'
C:\dev\myproject\Generated\LOAN_DETAIL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'LOAN_DETAIL_EXTENSION' and 'LOAN_DETAIL_EXTENSION'
C:\dev\myproject\Generated\LOAN_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'LOAN_EXTENSION' and 'LOAN_EXTENSION'
C:\dev\myproject\Generated\EMPLOYMENT_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'EMPLOYMENT_EXTENSION' and 'EMPLOYMENT_EXTENSION'
C:\dev\myproject\Generated\HMDA_RACE_DESIGNATION_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'HMDA_RACE_DESIGNATION_EXTENSION' and 'HMDA_RACE_DESIGNATION_EXTENSION'
C:\dev\myproject\Generated\extended.cs(29,26): error CS8981: The type name 'extended' only contains lower-cased ascii characters. Such names may become reserved for the language.
C:\dev\myproject\Generated\BORROWER_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'BORROWER_EXTENSION' and 'BORROWER_EXTENSION'
C:\dev\myproject\Generated\URLA_TOTAL_EXTENSION.cs(22,26): error CS0146: Circular base type dependency involving 'URLA_TOTAL_EXTENSION' and 'URLA_TOTAL_EXTENSION'
C:\dev\myproject\Generated\simple.cs(27,26): error CS8981: The type name 'simple' only contains lower-cased ascii characters. Such names may become reserved for the language.
@mganss mganss closed this as completed in be79661 Feb 13, 2025
@mganss
Copy link
Owner

mganss commented Feb 13, 2025

This occurs because of these definitions which are restrictions of themselves:

<xsd:complexType name="ASSET_DETAIL_EXTENSION">
	<xsd:complexContent>
		<xsd:restriction base="ASSET_DETAIL_EXTENSION">
			<xsd:sequence>
				<xsd:element name="MISMO" type="MISMO_BASE" minOccurs="0"/>
				<xsd:element name="OTHER" minOccurs="0">
					<xsd:complexType>
						<xsd:complexContent>
							<xsd:restriction base="OTHER_BASE">
								<xsd:sequence>
									<xsd:group ref="ULAD:grpASSET_DETAIL_EXTENSION"/>
								</xsd:sequence>
							</xsd:restriction>
						</xsd:complexContent>
					</xsd:complexType>
				</xsd:element>
			</xsd:sequence>
		</xsd:restriction>
	</xsd:complexContent>
</xsd:complexType>

I've added a check that just adds the fixed string "Redefinition" to the type name of the derived class if a circular definition is detected.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants