The component library is used to manage all responsive components in the current project, including the creation, editing, deletion and grouping of responsive components.
The original "Public Response" has now migrated to "Component Library" → "Response Component". You can more conveniently reference public response components in response examples.
Create Response Component
The response component is mainly designed for the API documentation design scenario. In normal cases, the response example of an API is divided into two types of successful example and failed example. Even if the status codes in the failed example may differ, the returned response data structure is usually consistent, so it can be extracted as a public response component and incorporated into unified management, so that it can be more conveniently referenced in other API documents.
+ sign on the response component on the right to click the "New Response Component" button.
Edit Response Component
Fill in the status code of the response component, fill in the name of the response and specify the content format. The data structure in the response component supports importing through multiple formats such as
Mockjs; or references existing data models in the project to complete the writing of the data structure.
You can set some commonly used public response components (such as 404 errors) as default response components. When creating a new API, the public response component will be automatically added to "Return Response" without the need to manually add frequently.
Use Response Component
In the API document, click the "+" sign on the right side of "Return Response", select the desired response component from the "Reference Response Component" column to complete the addition.
If you need to customize a response component separately for a specific API response, click the
... button on the right and click "Dereference" to customize separately.