Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/etc/elasticsuite_relevance_config.xsd

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteCore
 * @author    Aurelien FOUCRET <aurelien.foucret@smile.fr>
 * @author    Romain RUAUD <romain.ruaud@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="config">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="system" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="system">
        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="tab" />
                    <xs:element ref="section"/>
                </xs:choice>
            </xs:sequence>
        </xs:complexType>

        <xs:unique name="uniqueTabId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under all tabs
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath="tab"/>
            <xs:field xpath="@id"/>
        </xs:unique>

        <xs:unique name="uniqueSectionId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under all sections
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath="section"/>
            <xs:field xpath="@id"/>
        </xs:unique>
    </xs:element>

    <xs:attributeGroup name="tabAttributeGroup">
        <xs:attribute name="id" type="typeId" use="required" />
        <xs:attribute name="translate" type="xs:string" use="optional" />
        <xs:attribute name="sortOrder" type="xs:float" use="optional" />
        <xs:attribute name="class" type="xs:string" use="optional" />
    </xs:attributeGroup>

    <xs:attributeGroup name="elementsAttributeGroup">
        <xs:attribute name="id" type="typeId" use="required" />
        <xs:attribute name="translate" type="xs:string" use="optional" />
        <xs:attribute name="type" type="xs:string" use="optional" />
        <xs:attribute name="sortOrder" type="xs:float" use="optional" />
        <xs:attribute name="showInDefault" type="xs:int" use="optional" />
        <xs:attribute name="showInStore" type="xs:int" use="optional" />
        <xs:attribute name="showInContainer" type="xs:int" use="optional" />
        <xs:attribute name="advanced" type="xs:boolean" use="optional" />
        <xs:attribute name="extends" type="xs:string" use="optional" />
    </xs:attributeGroup>

    <xs:element name="tab">
        <xs:annotation>
            <xs:documentation>
                Tab resource. Recursive complex type.
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="1" name="label" type="xs:string" />
            </xs:sequence>
            <xs:attributeGroup ref="tabAttributeGroup"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="section">
        <xs:annotation>
            <xs:documentation>
                Section Resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="1" maxOccurs="unbounded">
                    <xs:element name="label" type="xs:string" />
                    <xs:element name="class" type="xs:string" />
                    <xs:element name="tab" type="typeTabId" />
                    <xs:element name="header_css" type="xs:string" />
                    <xs:element name="resource" type="typeAclResourceId" />
                    <xs:element ref="group" />
                </xs:choice>
            </xs:sequence>
            <xs:attributeGroup ref="elementsAttributeGroup"/>
        </xs:complexType>

        <xs:unique name="uniqueGroupId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under all groups for each section
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath="group"/>
            <xs:field xpath="@id"/>
        </xs:unique>
    </xs:element>

    <xs:element name="group">
        <xs:annotation>
            <xs:documentation>
                Group Resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="1" maxOccurs="unbounded">
                    <xs:element name="label" type="xs:string" />
                    <xs:element name="fieldset_css" type="xs:string" />
                    <xs:element name="frontend_model" type="typeModel" />
                    <xs:element name="clone_model" type="typeModel" />
                    <xs:element name="clone_fields" type="xs:int" />
                    <xs:element name="help_url" type="typeUrl" />
                    <xs:element name="more_url" type="typeUrl" />
                    <xs:element name="demo_link" type="typeUrl" />
                    <xs:element name="comment" type="xs:string" />
                    <xs:element name="hide_in_single_store_mode" type="xs:int" />
                    <xs:element ref="field" />
                    <xs:element ref="group" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="depends" />
                    <xs:element ref="attribute" />
                </xs:choice>
            </xs:sequence>

            <xs:attributeGroup ref="elementsAttributeGroup"/>
        </xs:complexType>

        <xs:unique name="uniqueFieldId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under all fields for each group
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath="field"/>
            <xs:field xpath="@id"/>
        </xs:unique>
    </xs:element>

    <xs:element name="field">
        <xs:annotation>
            <xs:documentation>
                Field Resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="label" type="xs:string" />
                    <xs:element name="comment" type="xs:string" />
                    <xs:element name="tooltip" type="xs:string" />
                    <xs:element name="hint" type="xs:string" />
                    <xs:element name="frontend_class" type="xs:string" />
                    <xs:element name="frontend_model" type="typeModel" />
                    <xs:element name="backend_model" type="typeModel" />
                    <xs:element name="source_model" type="typeModel" />
                    <xs:element name="config_path" type="typeConfigPath" />
                    <xs:element name="validate" type="xs:string" />
                    <xs:element name="can_be_empty" type="xs:int" />
                    <xs:element name="if_module_enabled" type="typeModule" />
                    <xs:element name="base_url" type="typeUrl" />
                    <xs:element name="button_url" type="typeUrl" />
                    <xs:element name="more_url" type="typeUrl" />
                    <xs:element name="demo_url" type="typeUrl" />
                    <xs:element name="button_label" type="xs:string" />
                    <xs:element name="hide_in_single_store_mode" type="xs:int" />
                    <xs:element name="upload_dir" type="typeUploadDir" />
                    <xs:element ref="source_service" />
                    <xs:element ref="options" />
                    <xs:element ref="depends" />
                    <xs:element ref="attribute" />
                    <xs:element ref="requires" />
                </xs:choice>
            </xs:sequence>

            <xs:attributeGroup ref="elementsAttributeGroup"/>
        </xs:complexType>

        <xs:unique name="uniqueAttributeType">
            <xs:annotation>
                <xs:documentation>
                    Attribute type is unique under all node attributes per field
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath=".//attribute"/>
            <xs:field xpath="@type"/>
        </xs:unique>
    </xs:element>

    <xs:element name="source_service">
        <xs:annotation>
            <xs:documentation>
                Service used to populate select options
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="idField" type="xs:string" use="optional" />
                    <xs:attribute name="labelField" type="xs:string" use="optional" />
                    <xs:attribute name="includeEmptyValueOption" type="xs:boolean" use="optional" />
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="options">
        <xs:annotation>
            <xs:documentation>
                Options of a select field
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:element name="option" maxOccurs="unbounded" minOccurs="1">
                    <xs:complexType>
                        <xs:annotation>
                            <xs:documentation>
                                Option of a select field
                            </xs:documentation>
                        </xs:annotation>

                        <xs:simpleContent>
                            <xs:extension base="xs:string">
                                <xs:attribute type="xs:string" name="label" use="required"/>
                            </xs:extension>
                        </xs:simpleContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="requires">
        <xs:annotation>
            <xs:documentation>
                Field Requirements
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element type="requiresField" name="field" />
                    <xs:element type="requiresGroup" name="group" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>

        <xs:unique name="uniqueRequiresFieldId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under field requires block
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath=".//field"/>
            <xs:field xpath="@id"/>
        </xs:unique>

        <xs:unique name="uniqueRequiresGroupId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under group requires block
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath=".//group"/>
            <xs:field xpath="@id"/>
        </xs:unique>
    </xs:element>

    <xs:complexType name="requiresField" mixed="true">
        <xs:annotation>
            <xs:documentation>
                Required field resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="id" type="typeElementPath" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="requiresGroup">
        <xs:annotation>
            <xs:documentation>
                Required group resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="id" type="typeElementPath" use="required" />
    </xs:complexType>

    <xs:simpleType name="typeElementPath">
        <xs:annotation>
            <xs:documentation>
                Element path attribute for elements section, group, field.
            </xs:documentation>
        </xs:annotation>

        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z0-9_///\\\\*]{3,}" />
            <xs:minLength value="3" />
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="attribute">
        <xs:annotation>
            <xs:documentation>
                Attribute Resource. Recursive complex type
            </xs:documentation>
        </xs:annotation>

        <xs:complexType mixed="true">
            <xs:sequence>
                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
            </xs:sequence>
            <xs:attributeGroup ref="attributeAttributeGroup"/>
        </xs:complexType>
    </xs:element>

    <xs:attributeGroup name="attributeAttributeGroup">
        <xs:attribute name="type" type="xs:string" use="required" />
        <xs:anyAttribute processContents="lax"/>
    </xs:attributeGroup>

    <xs:element name="depends">
        <xs:annotation>
            <xs:documentation>
                Describe which elements are regulator for current field
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="field">
                    <xs:complexType>
                        <xs:annotation>
                            <xs:documentation>
                                Field resource. Recursive complex type. Define element is influence on current field/group
                            </xs:documentation>
                        </xs:annotation>

                        <xs:simpleContent>
                            <xs:extension base="xs:string">
                                <xs:attribute name="id" type="typeElementPath" use="required" />
                                <xs:attribute name="separator" type='xs:string' use='optional' />
                                <xs:attribute name="negative" type='xs:int' use='optional' />
                            </xs:extension>
                        </xs:simpleContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>

        <xs:unique name="uniqueDependsFieldId">
            <xs:annotation>
                <xs:documentation>
                    Attribute id is unique under all regulatory elements per section/group/field
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath=".//field"/>
            <xs:field xpath="@id"/>
        </xs:unique>
    </xs:element>

    <xs:simpleType name="typeTabId">
        <xs:annotation>
            <xs:documentation>
                Item id attribute for element tab can has only [a-zA-Z0-9/_\]. Minimal length 3 symbol. Case sensitive.
            </xs:documentation>
        </xs:annotation>

        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z0-9_\\\\]{1,}" />
            <xs:minLength value="3" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeId">
        <xs:annotation>
            <xs:documentation>
                Item id attribute for elements section, group, field can has only [a-zA-Z0-9/_\]. Minimal length 2 symbol. Case sensitive.
            </xs:documentation>
        </xs:annotation>

        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z0-9_\\\\]{1,}" />
            <xs:minLength value="2" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeAclResourceId">
        <xs:annotation>
            <xs:documentation>
                Acl Resource identifier. Item can has only [a-zA-Z0-9/_:]. Minimal length 8 symbol. Case sensitive.
            </xs:documentation>
        </xs:annotation>

        <xs:restriction base="xs:string">
            <xs:pattern value="([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" />
            <xs:minLength value="8" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeModule">
        <xs:annotation>
            <xs:documentation>
                Item module attribute can have only [a-zA-Z0-9_\]. Minimal length 5 symbol. Case insensitive.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}[_\\\\][A-Z]+[A-Z0-9a-z]{1,}" />
            <xs:minLength value="5" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeModel">
        <xs:annotation>
            <xs:documentation>
                Item model attribute can have only [a-zA-Z0-9_]. Minimal length 5 symbol. Case insensitive.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Za-z0-9_\\\\:]+" />
            <xs:minLength value="5" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeConfigPath">
        <xs:annotation>
            <xs:documentation>
                Item configPath attribute can has only three groups of [a-zA-Z0-9_] characters split by '/'.
                Minimal length 5 symbol. Case insensitive.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+" />
            <xs:minLength value="5" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="typeUploadDirRestriction">
        <xs:restriction base="xs:string">
            <xs:pattern value="([a-zA-Z0-9_\\\\]+/{0,1}){1,}" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="typeUploadDir">
        <xs:annotation>
            <xs:documentation>
                Item uploadDir value can has only [a-zA-Z0-9_] characters split by '/'. Case insensitive.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="typeUploadDirRestriction">
                <xs:attribute type="xs:string" name="config" use="optional"/>
                <xs:attribute type="xs:string" name="scope_info" use="optional"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="typeUrlRestriction">
        <xs:restriction base="xs:anyURI">
            <xs:minLength value="3" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="typeUrl" mixed="true">
        <xs:annotation>
            <xs:documentation>
                typeUrl value can contain only valid uri with minimal length 3.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="typeUrlRestriction">
                <xs:attribute type="xs:string" name="type" use="optional"/>
                <xs:attribute type="xs:string" name="scope_info" use="optional"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
</xs:schema>