xsdata icon indicating copy to clipboard operation
xsdata copied to clipboard

identity-constraints as part of metadata

Open skinkie opened this issue 2 years ago • 1 comments

Currently the code generation is able to add meta data at this level;

@dataclass
class StopPlaceRef(StopPlaceRefStructure):
    """
    Reference to a STOP PLACE.
    """
    class Meta:
        namespace = "http://www.netex.org.uk/netex"

From my XSD I know there is a constraint like below. Now we know that the reference for a StopPlaceRef would point to the selector StopPlace. Would it be possible to add the fact that the selector is of type StopPlace as part of the metadata?

        <!-- =====StopPlace Key ========================== -->
        <xsd:keyref name="StopPlace_KeyRef" refer="netex:StopPlace_AnyVersionedKey">
            <xsd:selector xpath=".//netex:StopPlaceRef | .//netex:AdjacentStopPlaceRef"/>
            <xsd:field xpath="@ref"/>
            <xsd:field xpath="@version"/>
        </xsd:keyref>
        <xsd:key name="StopPlace_AnyVersionedKey">
            <xsd:selector xpath=".//netex:StopPlace"/>
            <xsd:field xpath="@id"/>
            <xsd:field xpath="@version"/>
        </xsd:key>

In my ideal world the relationship is resolved to the foreign object referred transparantly. But even something as 'getRef()' would be very cool.

skinkie avatar Jan 17 '22 20:01 skinkie

Not really sure, what this is about, please add an api examle or something...

I am doing spring cleaning and trying to reduce the number of open issues.

tefra avatar May 08 '22 07:05 tefra

I am closing this one for now, @skinkie

tefra avatar Feb 21 '23 17:02 tefra