communication.xsd 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  9. <xs:element name="config">
  10. <xs:complexType>
  11. <xs:choice minOccurs="0" maxOccurs="unbounded">
  12. <xs:element name="topic" type="topicType">
  13. <xs:unique name="uniqueHandlerName">
  14. <xs:annotation>
  15. <xs:documentation>
  16. Handler name must be unique.
  17. </xs:documentation>
  18. </xs:annotation>
  19. <xs:selector xpath="handler"/>
  20. <xs:field xpath="@name"/>
  21. </xs:unique>
  22. </xs:element>
  23. </xs:choice>
  24. </xs:complexType>
  25. <xs:unique name="topic-unique-name">
  26. <xs:annotation>
  27. <xs:documentation>
  28. Topic name must be unique.
  29. </xs:documentation>
  30. </xs:annotation>
  31. <xs:selector xpath="topic"/>
  32. <xs:field xpath="@name"/>
  33. </xs:unique>
  34. </xs:element>
  35. <xs:complexType name="topicType">
  36. <xs:choice minOccurs="0" maxOccurs="unbounded">
  37. <xs:element name="handler" type="handlerType"/>
  38. </xs:choice>
  39. <xs:attribute type="xs:string" name="name" use="required"/>
  40. <xs:attribute type="schemaType" name="schema" use="optional"/>
  41. <xs:attribute type="xs:string" name="request" use="optional"/>
  42. <xs:attribute type="xs:string" name="response" use="optional"/>
  43. <xs:attribute type="xs:boolean" name="is_synchronous" use="optional"/>
  44. </xs:complexType>
  45. <xs:complexType name="handlerType">
  46. <xs:attribute type="xs:string" name="name" use="required"/>
  47. <xs:attribute type="serviceTypeType" name="type" use="required"/>
  48. <xs:attribute type="serviceMethodType" name="method" use="required"/>
  49. <xs:attribute type="xs:boolean" name="disabled" use="optional"/>
  50. </xs:complexType>
  51. <xs:simpleType name="schemaType">
  52. <xs:annotation>
  53. <xs:documentation>
  54. Service schema is expected in a format "Vendor\Module\Api\ServiceName::methodName".
  55. </xs:documentation>
  56. </xs:annotation>
  57. <xs:restriction base="xs:string">
  58. <xs:pattern value="[a-zA-Z]+[a-zA-Z0-9\\]+::[a-zA-Z0-9]+" />
  59. <xs:minLength value="5" />
  60. </xs:restriction>
  61. </xs:simpleType>
  62. <xs:simpleType name="serviceTypeType">
  63. <xs:annotation>
  64. <xs:documentation>
  65. Service class/interface name is expected in a format "Vendor\Module\Api\ServiceName".
  66. </xs:documentation>
  67. </xs:annotation>
  68. <xs:restriction base="xs:string">
  69. <xs:pattern value="[a-zA-Z]+[a-zA-Z0-9\\]+" />
  70. <xs:minLength value="4" />
  71. </xs:restriction>
  72. </xs:simpleType>
  73. <xs:simpleType name="serviceMethodType">
  74. <xs:annotation>
  75. <xs:documentation>
  76. Method name is expected in a format "someMethodName".
  77. </xs:documentation>
  78. </xs:annotation>
  79. <xs:restriction base="xs:string">
  80. <xs:pattern value="[a-zA-Z0-9]+" />
  81. <xs:minLength value="2" />
  82. </xs:restriction>
  83. </xs:simpleType>
  84. </xs:schema>