RAML 内联 application/xml 示例
RAML inline application/xml example
responses:
200:
body:
application/xml:
example: |
<?xml version="1.0" encoding="UTF-8"?>
<my_response>
<result>success</result>
<message>great</message>
</my_response>
这是 RAML 端点定义的有效内联 application/xml 正文示例吗?如果不是应该怎么办?
是的。
根据您想要执行的操作,您可能还需要使用 XSD 指定类型。
例如:
/jobs:
displayName: Jobs
post:
description: Create a Job
body:
text/xml:
type: |
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="api-request">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="input"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
还有一些特殊的关键字用于XML序列化:https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#xml-serialization-of-type-instances
responses:
200:
body:
application/xml:
example: |
<?xml version="1.0" encoding="UTF-8"?>
<my_response>
<result>success</result>
<message>great</message>
</my_response>
这是 RAML 端点定义的有效内联 application/xml 正文示例吗?如果不是应该怎么办?
是的。 根据您想要执行的操作,您可能还需要使用 XSD 指定类型。 例如:
/jobs:
displayName: Jobs
post:
description: Create a Job
body:
text/xml:
type: |
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="api-request">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="input"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
还有一些特殊的关键字用于XML序列化:https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#xml-serialization-of-type-instances