diff --git a/src/components/api/ResponseBody.vue b/src/components/api/ResponseBody.vue new file mode 100644 index 00000000..4e3f7a80 --- /dev/null +++ b/src/components/api/ResponseBody.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/components/api/Result.vue b/src/components/api/Responses.vue similarity index 90% rename from src/components/api/Result.vue rename to src/components/api/Responses.vue index f1c0027c..11997d5e 100644 --- a/src/components/api/Result.vue +++ b/src/components/api/Responses.vue @@ -28,19 +28,9 @@ -
+

{{ $t('api.entity.responseBody') }}

-
-
-
- {{ itemKey }} - {{ item?.type }} -
-
- {{ item?.title }} -
-
-
+

{{ $t('api.entity.responseExample') }}

@@ -56,6 +46,7 @@ import { defineComponent } from 'vue'; import { IResponse } from '@/operators/api/models'; import CodeSnippet from '../common/CodeSnippet.vue'; import { ElCollapse, ElCollapseItem, ElTag } from 'element-plus'; +import ResponseBody from './ResponseBody.vue'; interface IData { value: { @@ -69,7 +60,8 @@ export default defineComponent({ CodeSnippet, ElCollapse, ElCollapseItem, - ElTag + ElTag, + ResponseBody }, props: { responses: { diff --git a/src/components/api/Usage.vue b/src/components/api/Usage.vue index 2e5627b4..911fd338 100644 --- a/src/components/api/Usage.vue +++ b/src/components/api/Usage.vue @@ -1,6 +1,6 @@ @@ -35,7 +35,7 @@ import { defineComponent } from 'vue'; import { IApi, IForm } from '@/operators/api/models'; import ApiForm from './Form.vue'; -import ApiResult from './Result.vue'; +import ApiResponses from './Responses.vue'; import { applicationOperator } from '@/operators/application/operator'; import { IApplication, IApplicationListResponse } from '@/operators/application/models'; @@ -49,7 +49,7 @@ export default defineComponent({ name: 'ApiUsage', components: { ApiForm, - ApiResult + ApiResponses }, props: { api: { diff --git a/src/i18n/zh/api/entity.ts b/src/i18n/zh/api/entity.ts index c1796ffc..24d77273 100644 --- a/src/i18n/zh/api/entity.ts +++ b/src/i18n/zh/api/entity.ts @@ -10,5 +10,6 @@ export default { failure: '失败', responseExample: '样例', authentication: '认证', + arrayOf: '列表', apiKey: 'API Key' }; diff --git a/src/operators/api/models.ts b/src/operators/api/models.ts index 80238e5f..a0edfdd5 100644 --- a/src/operators/api/models.ts +++ b/src/operators/api/models.ts @@ -14,14 +14,15 @@ export interface IForm { } export interface ISchema { - properties: { + properties?: { [key: string]: ISchema; }; - enum: (string | number)[]; + items?: ISchema[]; + enum?: (string | number)[]; type: 'object' | 'array' | 'string' | 'number' | 'boolean'; title: string; - optional: boolean; - example: string | number; + optional?: boolean; + example?: string | number; } export interface IRequest {