From 10c1e8161f1d264067feb0c6134508dc58778004 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jan 2021 11:16:20 +0900 Subject: [PATCH] wip --- src/client/pages/api-docs/endpoint.vue | 2 +- src/client/pages/api-docs/value.array.vue | 2 +- src/client/pages/api-docs/value.object.vue | 32 +++++++++++------ src/client/pages/api-docs/value.vue | 40 ++++++++-------------- src/server/api/openapi/gen-spec.ts | 10 +++++- 5 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/client/pages/api-docs/endpoint.vue b/src/client/pages/api-docs/endpoint.vue index 7b9a92867..4eabedcb9 100644 --- a/src/client/pages/api-docs/endpoint.vue +++ b/src/client/pages/api-docs/endpoint.vue @@ -13,7 +13,7 @@

Response

{{ status }}

- +
diff --git a/src/client/pages/api-docs/value.array.vue b/src/client/pages/api-docs/value.array.vue index 887165215..9ffd0e88b 100644 --- a/src/client/pages/api-docs/value.array.vue +++ b/src/client/pages/api-docs/value.array.vue @@ -2,7 +2,7 @@
Array of
- +
diff --git a/src/client/pages/api-docs/value.object.vue b/src/client/pages/api-docs/value.object.vue index 6b7aadf7e..ccbf62193 100644 --- a/src/client/pages/api-docs/value.object.vue +++ b/src/client/pages/api-docs/value.object.vue @@ -1,7 +1,8 @@ @@ -43,16 +44,27 @@ export default defineComponent({ diff --git a/src/server/api/openapi/gen-spec.ts b/src/server/api/openapi/gen-spec.ts index ccf35f7c7..87cddedac 100644 --- a/src/server/api/openapi/gen-spec.ts +++ b/src/server/api/openapi/gen-spec.ts @@ -8,7 +8,15 @@ import { schemas, convertSchemaToOpenApiSchema } from './schemas'; import { getDescription } from './description'; export function genOpenapiSpecForEndpoint(endpoint: IEndpoint, lang = 'ja-JP') { - const locale = yaml.safeLoad(fs.readFileSync(__dirname + `/../../../api-docs/${lang}/` + endpoint.name + '.yml', 'utf-8')); + let locale; + + try { + locale = yaml.safeLoad(fs.readFileSync(__dirname + `/../../../api-docs/${lang}/` + endpoint.name + '.yml', 'utf-8')); + } catch (e) { + locale = { + params: {} + }; + } function genProps(props: { [key: string]: Context; }) { const properties = {} as any;