From 40245f29b317297d023cf4c82973bf3208e4cdfd Mon Sep 17 00:00:00 2001 From: "julije.kostov" Date: Wed, 17 Mar 2021 14:42:21 +0100 Subject: [PATCH] Add support for plain/text response type Signed-off-by: julije.kostov --- packages/openapi-to-graphql/src/oas_3_tools.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/openapi-to-graphql/src/oas_3_tools.ts b/packages/openapi-to-graphql/src/oas_3_tools.ts index 908993db..32287a0f 100644 --- a/packages/openapi-to-graphql/src/oas_3_tools.ts +++ b/packages/openapi-to-graphql/src/oas_3_tools.ts @@ -758,6 +758,22 @@ export function getResponseSchemaAndNames( if (responseContentType) { let responseSchema = responseObject.content[responseContentType].schema + + if (!responseSchema && responseContentType === 'text/plain') { + return { + responseContentType, + statusCode, + responseSchemaNames: { + fromPath: inferResourceNameFromPath(path) + }, + responseSchema: { + description: + 'Placeholder to support operations with no response schema and text/plain response type', + type: 'string' + } + } + } + let fromRef: string if ('$ref' in responseSchema) { fromRef = responseSchema['$ref'].split('/').pop()