wiki/assets/opensearch/parameters.xsd

244 lines
9.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
OpenSearch Parameter Extension 1.0 Draft 2 XML Schema
Copyright (c) 2021 ~lucidiot
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file was derived from the OpenSearch Parameter Extension 1.0 Draft 2 specification at
<https://github.com/dewitt/opensearch/blob/8446769af24e313f308beeb590173c1aca57de9f/mediawiki/Specifications/OpenSearch/Extensions/Parameter/1.0/Draft%202.wiki>
-->
<xs:schema
targetNamespace="http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"
elementFormDefault="qualified"
xmlns="http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:simpleType name="HTTPMethod">
<!--
This uses both enumerations and patterns to provide good autocompletion
in some XML editors as well as a case-insensitive validation to match
the specification.
-->
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="head" />
<xs:enumeration value="get" />
<xs:enumeration value="options" />
<xs:enumeration value="trace" />
<xs:enumeration value="post" />
<xs:enumeration value="put" />
<xs:enumeration value="patch" />
<xs:enumeration value="delete" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[Hh][Ee][Aa][Dd]" />
<xs:pattern value="[Gg][Ee][Tt]" />
<xs:pattern value="[Oo][Pp][Tt][Ii][Oo][Nn][Ss]" />
<xs:pattern value="[Tt][Rr][Aa][Cc][Ee]" />
<xs:pattern value="[Pp][Oo][Ss][Tt]" />
<xs:pattern value="[Pp][Uu][Tt]" />
<xs:pattern value="[Pp][Aa][Tt][Cc][Hh]" />
<xs:pattern value="[Dd][Ee][Ll][Ee][Tt][Ee]" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:attributeGroup name="UrlAttributes">
<xs:annotation>
<xs:documentation>
Additional attributes defined by the OpenSearch Parameters extension for the Url element.
</xs:documentation>
</xs:annotation>
<xs:attribute name="method" type="HTTPMethod" default="get">
<xs:annotation>
<xs:documentation>
Contains a case-insensitive string that identifies the HTTP request method that the search client should use to perform the search request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="enctype" type="xs:string" default="application/x-www-form-urlencoded">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the content encoding the search client should use to perform the search request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:simpleType name="Maximum">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="*">
<xs:annotation>
<xs:documentation>
The parameter may be repeated an arbitrary number of times.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:nonNegativeInteger" />
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="Title">
<xs:restriction base="xs:string">
<xs:maxLength value="1024" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="NumericOrDate">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:decimal" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:date" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:time" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:dateTime" />
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="Label">
<xs:restriction base="xs:string">
<xs:maxLength value="512" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Option">
<xs:annotation>
<xs:documentation>
Describes a value/label pair suggested to the client for the parent element.
</xs:documentation>
</xs:annotation>
<xs:attribute name="value" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
Contains a string with the value of the option.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="label" type="Label" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that provides a label for the option.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="Parameter">
<xs:annotation>
<xs:documentation>
Describes a name/value pair to be included in the search request.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Option" type="Option" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
Contains the name of the parameter.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="value" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that will be processed according to the rules of the OpenSearch URL template syntax.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="minimum" type="xs:nonNegativeInteger" default="0">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the minimum number of times this parameter must be included in the search request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maximum" type="Maximum" default="1">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the maximum number of times this parameter must be included in the search request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="pattern" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that specifies a regular expression against which the parameter's value is validated.
When present the element should also include a title attribute to inform the client application of the format expected.
Must be a valid pattern according to the JavaScript Pattern production.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="title" type="Title" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string with advisory information for the format and valid values of the parameter, such as would be appropriate for a tooltip.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="minExclusive" type="NumericOrDate" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the minimum value for the element that cannot be reached. Applies only to numeric and date types.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxExclusive" type="NumericOrDate" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the maximum value for the element that cannot be reached. Applies only to numeric and date types.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="minInclusive" type="NumericOrDate" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the minimum value for the element that can be reached. Applies only to numeric and date types.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxInclusive" type="NumericOrDate" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the maximum value for the element that can be reached. Applies only to numeric and date types.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="step" type="NumericOrDate" use="optional">
<xs:annotation>
<xs:documentation>
Contains a string that identifies the granularity of the allowed values between the minimal and maximal range.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:schema>