# Talend 扩展和注解

导出带有 Talend 扩展或注解的 API，以保留 API 契约所提供的表达能力。

导出 API 时，您可以选择包含适用于 OpenAPI Specification 的 Talend 扩展，或适用于 RAML 的 Talend 注释。这使您能够保持在 API 契约 中定义的 API 结构。

例如，在 Contacts API 中，资源和操作被划分到不同部分，并使用文本块来添加信息。

![Contacts API 的屏幕截图。](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Resources/Images/ApiDesigner/designer_talend_extensions.png)

如果您在导出此定义时不包含 Talend 扩展或注释，则章节和文本块不会被导出。然而，通过扩展或注解，它们会包含 在代码中。

部分信息将添加到部分所包含的任何元素中：

```
    x-talend:
      section: "Companies"
```

文本块会添加到文件末尾：

```
  texts:
    3a36b8ba-2969-46f0-a36e-9d715eeece36:
      title: "Authentication"
      content: "This API is secured using Basic Authentication.\n\nAll **read operations are open** and don't require authentication. However, all **write operations require authentication**. "
      section: "General"
    612e4b7f-0530-4835-8a47-f580869c67df:
      title: "Error handling"
      content: "This API uses standard HTTP status codes to indicate the status of a response.\n\nThere are two main categories of error responses. Each have a different response payload structure.\n\n* Simple errors\n* Detailed errors\n\n\n# Simple errors\n\n| Name | Code | Description |\n| -------- | -------- | -------- |\n| Bad request     | 400     | The request was unacceptable     |\n| Unauthorized     | 401     | The request has not been applied because it lacks valid authentication credentials for the target resource.     |\n| Forbidden     | 403     | The server understood the request, but is refusing to fulfill it     |\n| Not Found     | 404     | The server has not found anything matching the request URI     |\n| Not acceptable     | 406     | The server is unable to return a response in the format that was requested by the client     |\n| Unsupported Media Type     | 415     | The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method     |\n| Too many requests     | 429     | Too many requests hit the API too quickly     |\n| Server error     | 500     | A technical error occured  |\n\n\n\n\n\n\n# Detailed errors\n| Name | Code | Description |\n| -------- | -------- | -------- |\n| Unprocessable entity     | 422     | The server understands the content type of the request entity, and the syntax of the request entity is correct, but was unable to process the contained instructions.     |\n\n\n\n\n"
| Server error     | 500     | A technical error occurred  |\n\n\n\n\n\n\n# Detailed errors\n| Name | Code | Description |\n| -------- | -------- | -------- |\n| Unprocessable entity     | 422     | The server understands the content type of the request entity, and the syntax of the request entity is correct, but was unable to process the contained instructions.     |\n\n\n\n\n"
      section: "General"
```