config.xsd 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. /**
  4. * Schema for DI configuration
  5. *
  6. * Copyright © Magento, Inc. All rights reserved.
  7. * See COPYING.txt for license details.
  8. */
  9. -->
  10. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  11. <xs:redefine schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd">
  12. <xs:complexType name="string">
  13. <xs:complexContent>
  14. <xs:extension base="argumentType">
  15. <xs:attribute name="translatable" use="optional" type="xs:boolean" />
  16. </xs:extension>
  17. </xs:complexContent>
  18. </xs:complexType>
  19. <xs:complexType name="argumentType" abstract="true" mixed="false">
  20. <xs:complexContent>
  21. <xs:extension base="argumentType" />
  22. </xs:complexContent>
  23. </xs:complexType>
  24. <xs:complexType name="object">
  25. <xs:complexContent>
  26. <xs:extension base="object">
  27. <xs:attribute name="shared" use="optional" type="xs:boolean"/>
  28. <xs:attribute name="sortOrder" use="optional" type="xs:integer"/>
  29. </xs:extension>
  30. </xs:complexContent>
  31. </xs:complexType>
  32. </xs:redefine>
  33. <xs:simpleType name="phpClassName">
  34. <xs:annotation>
  35. <xs:documentation>
  36. A string that matches a Fully Qualified Class Name from PHP, especially not starting
  37. with a backslash as this is an invalid character to start a class name with but a
  38. somewhat common mistake so this simple type can be used to validate against it
  39. already
  40. </xs:documentation>
  41. </xs:annotation>
  42. <xs:restriction base="xs:string">
  43. <xs:pattern value="(\\?[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
  44. </xs:restriction>
  45. </xs:simpleType>
  46. <xs:complexType name="init_parameter">
  47. <xs:complexContent>
  48. <xs:extension base="argumentType" />
  49. </xs:complexContent>
  50. </xs:complexType>
  51. <xs:complexType name="const">
  52. <xs:complexContent>
  53. <xs:extension base="argumentType" />
  54. </xs:complexContent>
  55. </xs:complexType>
  56. <xs:element name="config">
  57. <xs:complexType>
  58. <xs:choice maxOccurs="unbounded">
  59. <xs:element name="preference" type="preferenceType" minOccurs="0" maxOccurs="unbounded" />
  60. <xs:element name="type" type="typeType" minOccurs="0" maxOccurs="unbounded">
  61. <xs:unique name="uniqueTypeParam">
  62. <xs:annotation>
  63. <xs:documentation>
  64. Param name should be unique in scope of type
  65. </xs:documentation>
  66. </xs:annotation>
  67. <xs:selector xpath="param" />
  68. <xs:field xpath="@name" />
  69. </xs:unique>
  70. </xs:element>
  71. <xs:element name="virtualType" type="virtualTypeType" minOccurs="0" maxOccurs="unbounded">
  72. <xs:unique name="uniqueVirtualTypeParam">
  73. <xs:annotation>
  74. <xs:documentation>
  75. Param name should be unique in scope of virtual type
  76. </xs:documentation>
  77. </xs:annotation>
  78. <xs:selector xpath="param" />
  79. <xs:field xpath="@name" />
  80. </xs:unique>
  81. </xs:element>
  82. </xs:choice>
  83. </xs:complexType>
  84. <xs:unique name="uniquePreference">
  85. <xs:annotation>
  86. <xs:documentation>
  87. Preference for each class should be unique in scope of file
  88. </xs:documentation>
  89. </xs:annotation>
  90. <xs:selector xpath="preference" />
  91. <xs:field xpath="@for" />
  92. </xs:unique>
  93. <xs:unique name="uniqueType">
  94. <xs:annotation>
  95. <xs:documentation>
  96. Type name should be unique in scope of file
  97. </xs:documentation>
  98. </xs:annotation>
  99. <xs:selector xpath="type" />
  100. <xs:field xpath="@name" />
  101. </xs:unique>
  102. <xs:unique name="uniqueVirtualType">
  103. <xs:annotation>
  104. <xs:documentation>
  105. Virtual type name should be unique in scope of file
  106. </xs:documentation>
  107. </xs:annotation>
  108. <xs:selector xpath="virtualType" />
  109. <xs:field xpath="@name" />
  110. </xs:unique>
  111. </xs:element>
  112. <xs:complexType name="preferenceType">
  113. <xs:annotation>
  114. <xs:documentation>
  115. Preference help Object Manager to choose class for corresponding interface
  116. </xs:documentation>
  117. </xs:annotation>
  118. <xs:attribute name="for" type="phpClassName" use="required"/>
  119. <xs:attribute name="type" type="phpClassName" use="required" />
  120. </xs:complexType>
  121. <xs:complexType name="typeType">
  122. <xs:annotation>
  123. <xs:documentation>
  124. With 'type' tag you can point parameters and plugins for certain class
  125. </xs:documentation>
  126. </xs:annotation>
  127. <xs:choice maxOccurs="unbounded">
  128. <xs:element name="arguments" type="argumentsType" minOccurs="0" maxOccurs="1">
  129. <xs:key name="argumentName">
  130. <xs:selector xpath="argument"></xs:selector>
  131. <xs:field xpath="@name"></xs:field>
  132. </xs:key>
  133. </xs:element>
  134. <xs:element name="plugin" type="pluginType" minOccurs="0" maxOccurs="unbounded" />
  135. </xs:choice>
  136. <xs:attribute name="name" type="phpClassName" use="required" />
  137. <xs:attribute name="shared" type="xs:boolean" use="optional" />
  138. </xs:complexType>
  139. <xs:complexType name="virtualTypeType">
  140. <xs:complexContent>
  141. <xs:extension base="typeType">
  142. <xs:annotation>
  143. <xs:documentation>
  144. With 'virtualType' tag you can point parameters and plugins for autogenerated class
  145. </xs:documentation>
  146. </xs:annotation>
  147. <xs:attribute name="type" type="phpClassName" use="optional" />
  148. </xs:extension>
  149. </xs:complexContent>
  150. </xs:complexType>
  151. <xs:complexType name="pluginType">
  152. <xs:attribute name="name" type="xs:string" use="required" />
  153. <xs:attribute name="type" type="phpClassName" use="optional" />
  154. <xs:attribute name="disabled" type="xs:boolean" use="optional" />
  155. <xs:attribute name="sortOrder" type="xs:int" use="optional" />
  156. </xs:complexType>
  157. </xs:schema>