atlasmap-attic / atlasmap-runtime

AtlasMap runtime engine and design time services
http://atlasmap.io
Other
3 stars 8 forks source link

Validation result should be traceable to corresponding mapping entry #237

Closed igarashitm closed 6 years ago

igarashitm commented 6 years ago

io.atlasmap.v2.Validation right now only has free style string literals and therefore impossible to identify the mapping entry corresponds to that result. It should have identifiers for the corresponding fields, docId+path is the candidate. If the validation errors are not entry level, they can be null so that UI can handle it as a global error.

igarashitm commented 6 years ago

Current model

https://github.com/atlasmap/atlasmap-runtime/blob/ce498616965254723428641ab5c03ed80cff4d40/atlas-model/src/main/resources/atlas-model-v2.xsd#L201-L212

All attributes other than status are free format text. Mainly message, field and value are used to carry validation results, but the field and value are just another messages and their role is not really distinguished from message attribute. name and group attributes are not even used at all. Surprisingly name is a required attribute though.

To be

<complexType name="Validation">
    <sequence>
        <element name="message" type="string" minOccurs="0" maxOccurs="1" />
    </sequence>
    <attribute name="id" type="string" use="optional"/>
    <attribute name="scope" type="atlas:ValidationScope" use="required" />
    <attribute name="status" type="atlas:ValidationStatus" use="required" />
</complexType>
<complexType name="ValidationScope">
    <restriction base="string">
        <enumeration value="All"/>
        <enumeration value="DataSource"/>
        <enumeration value="Mapping"/>
        <enumeration value="LookupTable"/>
        <enumeration value="Property"/>
    </restriction>
</complexType>

Type atlas:Field might be a bit too verbose for validation result. But we can strip unneccessary attributes off when it's used for validation result. And eventually we'll get mapping entry level light weight validation by #238. Instead of having a list of atlas:Field, we can simply add an id attribute on the /AtlasMapping/Mappings/Mapping and let UI assign a unique ID for each mapping entries. What we really want to link is mapping entry and validation result, not the field. Plus UI already knows those field details. We'll also need to add id to LookupTable and Property as well. DataSource already has an id attribute.