Skip to content

Duplicate names when enumeration has empty value #169

@F21

Description

@F21

Given the following xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:simpleType name="state">
        <xs:restriction base="xs:string">
            <xs:enumeration value="" />
            <xs:enumeration value="AK">
                <xs:annotation>
                    <xs:documentation>Alaska</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

If an enumeration has its value set to an empty string, the following code is generated:

// Code generated by https://github.com/gocomply/xsd2go; DO NOT EDIT.
// Models for test
package test

import ()

// XSD ComplexType declarations

// XSD SimpleType declarations

type State string

const State State = "" // Name clashes with State type

const StateAk State = "AK"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions