From 5f58982210bdd263de9b90740e1c8042e609fce1 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Tue, 25 Jan 2022 14:37:41 +0100 Subject: [PATCH] - Working solution for export client --- src/index.ts | 14 ++++----- src/openApi/v2/parser/getOperation.ts | 4 +-- .../v2/parser/getOperationPath.spec.ts | 18 ------------ src/openApi/v2/parser/getOperationPath.ts | 16 ---------- src/openApi/v3/parser/getOperation.ts | 4 +-- .../v3/parser/getOperationPath.spec.ts | 18 ------------ src/openApi/v3/parser/getOperationPath.ts | 16 ---------- src/templates/client.hbs | 4 +-- src/templates/core/ApiRequestOptions.hbs | 3 +- src/templates/core/BaseHttpRequest.hbs | 1 + src/templates/core/functions/getUrl.hbs | 21 ++++++++++---- src/templates/exportService.hbs | 29 +++++++++++++++++-- src/utils/getOpenApiSpec.ts | 2 +- src/utils/postProcessModel.ts | 4 +-- src/utils/writeClient.ts | 21 +++++++------- src/utils/writeClientClass.ts | 4 +-- src/utils/writeClientCore.ts | 5 ++-- src/utils/writeClientIndex.ts | 10 +++---- src/utils/writeClientModels.ts | 2 +- src/utils/writeClientSchemas.ts | 2 +- src/utils/writeClientServices.ts | 14 ++++----- test/custom/request.ts | 2 +- test/index.js | 2 +- test/spec/v2.json | 14 ++++----- test/spec/v3.json | 10 +++---- 25 files changed, 102 insertions(+), 138 deletions(-) delete mode 100644 src/openApi/v2/parser/getOperationPath.spec.ts delete mode 100644 src/openApi/v2/parser/getOperationPath.ts delete mode 100644 src/openApi/v3/parser/getOperationPath.spec.ts delete mode 100644 src/openApi/v3/parser/getOperationPath.ts diff --git a/src/index.ts b/src/index.ts index eef0c2dc..ef7a8b1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,13 +39,13 @@ export type Options = { * @param clientName Custom client class name * @param useOptions Use options or arguments functions * @param useUnionTypes Use union types instead of enums - * @param exportCore: Generate core client classes - * @param exportServices: Generate services - * @param exportModels: Generate models - * @param exportSchemas: Generate schemas - * @param indent: Indentation options (4, 2 or tab) - * @param postfix: Service name postfix - * @param request: Path to custom request file + * @param exportCore Generate core client classes + * @param exportServices Generate services + * @param exportModels Generate models + * @param exportSchemas Generate schemas + * @param indent Indentation options (4, 2 or tab) + * @param postfix Service name postfix + * @param request Path to custom request file * @param write Write the files to disk (true or false) */ export const generate = async ({ diff --git a/src/openApi/v2/parser/getOperation.ts b/src/openApi/v2/parser/getOperation.ts index e344c7f9..089ade17 100644 --- a/src/openApi/v2/parser/getOperation.ts +++ b/src/openApi/v2/parser/getOperation.ts @@ -5,7 +5,6 @@ import type { OpenApiOperation } from '../interfaces/OpenApiOperation'; import { getOperationErrors } from './getOperationErrors'; import { getOperationName } from './getOperationName'; import { getOperationParameters } from './getOperationParameters'; -import { getOperationPath } from './getOperationPath'; import { getOperationResponseHeader } from './getOperationResponseHeader'; import { getOperationResponses } from './getOperationResponses'; import { getOperationResults } from './getOperationResults'; @@ -22,7 +21,6 @@ export const getOperation = ( ): Operation => { const serviceName = getServiceName(tag); const operationName = getOperationName(op.operationId || `${method}`); - const operationPath = getOperationPath(url); // Create a new operation object for this method. const operation: Operation = { @@ -32,7 +30,7 @@ export const getOperation = ( description: op.description || null, deprecated: op.deprecated === true, method: method.toUpperCase(), - path: operationPath, + path: url, parameters: [...pathParams.parameters], parametersPath: [...pathParams.parametersPath], parametersQuery: [...pathParams.parametersQuery], diff --git a/src/openApi/v2/parser/getOperationPath.spec.ts b/src/openApi/v2/parser/getOperationPath.spec.ts deleted file mode 100644 index d69ac899..00000000 --- a/src/openApi/v2/parser/getOperationPath.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { getOperationPath } from './getOperationPath'; - -describe('getOperationPath', () => { - it('should produce correct result', () => { - expect(getOperationPath('/api/v{api-version}/list/{id}/{type}')).toEqual( - '/api/v${OpenAPI.VERSION}/list/${id}/${type}' - ); - expect(getOperationPath('/api/v{api-version}/list/{id}')).toEqual('/api/v${OpenAPI.VERSION}/list/${id}'); - expect(getOperationPath('/api/v1/list/{id}')).toEqual('/api/v1/list/${id}'); - expect(getOperationPath('/api/{foobar}')).toEqual('/api/${foobar}'); - expect(getOperationPath('/api/{fooBar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo-bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo_bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo.bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{Foo-Bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{FOO-BAR}')).toEqual('/api/${fooBar}'); - }); -}); diff --git a/src/openApi/v2/parser/getOperationPath.ts b/src/openApi/v2/parser/getOperationPath.ts deleted file mode 100644 index 17594a2c..00000000 --- a/src/openApi/v2/parser/getOperationPath.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { getOperationParameterName } from './getOperationParameterName'; - -/** - * Get the final service path, this replaces the "{api-version}" placeholder - * with a new template string placeholder so we can dynamically inject the - * OpenAPI version without the need to hardcode this in the URL. - * Plus we return the correct parameter names to replace in the URL. - * @param path - */ -export const getOperationPath = (path: string): string => { - return path - .replace(/\{(.*?)\}/g, (_, w: string) => { - return `\${${getOperationParameterName(w)}}`; - }) - .replace('${apiVersion}', '${OpenAPI.VERSION}'); -}; diff --git a/src/openApi/v3/parser/getOperation.ts b/src/openApi/v3/parser/getOperation.ts index 027d9f13..c8b3e316 100644 --- a/src/openApi/v3/parser/getOperation.ts +++ b/src/openApi/v3/parser/getOperation.ts @@ -6,7 +6,6 @@ import type { OpenApiRequestBody } from '../interfaces/OpenApiRequestBody'; import { getOperationErrors } from './getOperationErrors'; import { getOperationName } from './getOperationName'; import { getOperationParameters } from './getOperationParameters'; -import { getOperationPath } from './getOperationPath'; import { getOperationRequestBody } from './getOperationRequestBody'; import { getOperationResponseHeader } from './getOperationResponseHeader'; import { getOperationResponses } from './getOperationResponses'; @@ -25,7 +24,6 @@ export const getOperation = ( ): Operation => { const serviceName = getServiceName(tag); const operationName = getOperationName(op.operationId || `${method}`); - const operationPath = getOperationPath(url); // Create a new operation object for this method. const operation: Operation = { @@ -35,7 +33,7 @@ export const getOperation = ( description: op.description || null, deprecated: op.deprecated === true, method: method.toUpperCase(), - path: operationPath, + path: url, parameters: [...pathParams.parameters], parametersPath: [...pathParams.parametersPath], parametersQuery: [...pathParams.parametersQuery], diff --git a/src/openApi/v3/parser/getOperationPath.spec.ts b/src/openApi/v3/parser/getOperationPath.spec.ts deleted file mode 100644 index d69ac899..00000000 --- a/src/openApi/v3/parser/getOperationPath.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { getOperationPath } from './getOperationPath'; - -describe('getOperationPath', () => { - it('should produce correct result', () => { - expect(getOperationPath('/api/v{api-version}/list/{id}/{type}')).toEqual( - '/api/v${OpenAPI.VERSION}/list/${id}/${type}' - ); - expect(getOperationPath('/api/v{api-version}/list/{id}')).toEqual('/api/v${OpenAPI.VERSION}/list/${id}'); - expect(getOperationPath('/api/v1/list/{id}')).toEqual('/api/v1/list/${id}'); - expect(getOperationPath('/api/{foobar}')).toEqual('/api/${foobar}'); - expect(getOperationPath('/api/{fooBar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo-bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo_bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{foo.bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{Foo-Bar}')).toEqual('/api/${fooBar}'); - expect(getOperationPath('/api/{FOO-BAR}')).toEqual('/api/${fooBar}'); - }); -}); diff --git a/src/openApi/v3/parser/getOperationPath.ts b/src/openApi/v3/parser/getOperationPath.ts deleted file mode 100644 index 17594a2c..00000000 --- a/src/openApi/v3/parser/getOperationPath.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { getOperationParameterName } from './getOperationParameterName'; - -/** - * Get the final service path, this replaces the "{api-version}" placeholder - * with a new template string placeholder so we can dynamically inject the - * OpenAPI version without the need to hardcode this in the URL. - * Plus we return the correct parameter names to replace in the URL. - * @param path - */ -export const getOperationPath = (path: string): string => { - return path - .replace(/\{(.*?)\}/g, (_, w: string) => { - return `\${${getOperationParameterName(w)}}`; - }) - .replace('${apiVersion}', '${OpenAPI.VERSION}'); -}; diff --git a/src/templates/client.hbs b/src/templates/client.hbs index 4f643fb2..bd29b940 100644 --- a/src/templates/client.hbs +++ b/src/templates/client.hbs @@ -14,9 +14,9 @@ type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; export class {{{clientName}}} { -{{#each services}} + {{#each services}} public readonly {{{camelCase name}}}: {{{name}}}{{{@root.postfix}}}; -{{/each}} + {{/each}} private readonly request: BaseHttpRequest; diff --git a/src/templates/core/ApiRequestOptions.hbs b/src/templates/core/ApiRequestOptions.hbs index 690c19f8..355929a7 100644 --- a/src/templates/core/ApiRequestOptions.hbs +++ b/src/templates/core/ApiRequestOptions.hbs @@ -2,7 +2,8 @@ export type ApiRequestOptions = { readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; - readonly path: string; + readonly url: string; + readonly path?: Record; readonly cookies?: Record; readonly headers?: Record; readonly query?: Record; diff --git a/src/templates/core/BaseHttpRequest.hbs b/src/templates/core/BaseHttpRequest.hbs index 6a70629a..2b7ca480 100644 --- a/src/templates/core/BaseHttpRequest.hbs +++ b/src/templates/core/BaseHttpRequest.hbs @@ -5,6 +5,7 @@ import type { CancelablePromise } from './CancelablePromise'; import type { OpenAPIConfig } from './OpenAPI'; export class BaseHttpRequest { + protected readonly config: OpenAPIConfig; constructor(config: OpenAPIConfig) { diff --git a/src/templates/core/functions/getUrl.hbs b/src/templates/core/functions/getUrl.hbs index 7c309ca2..4624533d 100644 --- a/src/templates/core/functions/getUrl.hbs +++ b/src/templates/core/functions/getUrl.hbs @@ -1,9 +1,18 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { - const path = config.ENCODE_PATH ? config.ENCODE_PATH(options.path) : options.path; - const url = `${config.BASE}${path}`; - if (options.query) { - return `${url}${getQueryString(options.query)}`; - } + const encoder = config.ENCODE_PATH || encodeURI; - return url; + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; }; diff --git a/src/templates/exportService.hbs b/src/templates/exportService.hbs index 13becbfa..d0f8aa5c 100644 --- a/src/templates/exportService.hbs +++ b/src/templates/exportService.hbs @@ -6,12 +6,22 @@ import type { {{{this}}} } from '../models/{{{this}}}'; {{/each}} {{/if}} import type { CancelablePromise } from '../core/CancelablePromise'; -import { request as __request } from '../core/request'; -{{#if @root.useVersion}} +{{#if @root.exportClient}} +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; +{{else}} import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; {{/if}} export class {{{name}}}{{{@root.postfix}}} { + {{#if @root.exportClient}} + + private readonly httpRequest: BaseHttpRequest; + + constructor(httpRequest: BaseHttpRequest) { + this.httpRequest = httpRequest; + } + {{/if}} {{#each operations}} /** @@ -36,10 +46,23 @@ export class {{{name}}}{{{@root.postfix}}} { {{/each}} * @throws ApiError */ + {{#if @root.exportClient}} + public {{{name}}}({{>parameters}}): CancelablePromise<{{>result}}> { + return this.httpRequest.request({ + {{/if}} + {{#unless @root.exportClient}} public static {{{name}}}({{>parameters}}): CancelablePromise<{{>result}}> { return __request(OpenAPI, { + {{/unless}} method: '{{{method}}}', - path: `{{{path}}}`, + url: '{{{path}}}', + {{#if parametersPath}} + path: { + {{#each parametersPath}} + '{{{prop}}}': {{{name}}}, + {{/each}} + }, + {{/if}} {{#if parametersCookie}} cookies: { {{#each parametersCookie}} diff --git a/src/utils/getOpenApiSpec.ts b/src/utils/getOpenApiSpec.ts index 9b52ccd2..148b1469 100644 --- a/src/utils/getOpenApiSpec.ts +++ b/src/utils/getOpenApiSpec.ts @@ -2,7 +2,7 @@ import RefParser from 'json-schema-ref-parser'; /** * Load and parse te open api spec. If the file extension is ".yml" or ".yaml" - * we will try to parse the file as a YAML spec, otherwise we will fallback + * we will try to parse the file as a YAML spec, otherwise we will fall back * on parsing the file as JSON. * @param location: Path or url */ diff --git a/src/utils/postProcessModel.ts b/src/utils/postProcessModel.ts index 3c8e3f01..195a94e4 100644 --- a/src/utils/postProcessModel.ts +++ b/src/utils/postProcessModel.ts @@ -4,8 +4,8 @@ import { postProcessModelEnums } from './postProcessModelEnums'; import { postProcessModelImports } from './postProcessModelImports'; /** - * Post process the model. - * This will cleanup any double imports or enum values. + * Post processes the model. + * This will clean up any double imports or enum values. * @param model */ export const postProcessModel = (model: Model): Model => { diff --git a/src/utils/writeClient.ts b/src/utils/writeClient.ts index e77828db..41a28a7c 100644 --- a/src/utils/writeClient.ts +++ b/src/utils/writeClient.ts @@ -22,15 +22,15 @@ import { writeClientServices } from './writeClientServices'; * @param httpClient The selected httpClient (fetch, xhr, node or axios) * @param useOptions Use options or arguments functions * @param useUnionTypes Use union types instead of enums - * @param exportCore: Generate core client classes - * @param exportServices: Generate services - * @param exportModels: Generate models - * @param exportSchemas: Generate schemas - * @param exportSchemas: Generate schemas - * @param indent: Indentation options (4, 2 or tab) - * @param postfix: Service name postfix - * @param clientName: Custom client class name - * @param request: Path to custom request file + * @param exportCore Generate core client classes + * @param exportServices Generate services + * @param exportModels Generate models + * @param exportSchemas Generate schemas + * @param exportSchemas Generate schemas + * @param indent Indentation options (4, 2 or tab) + * @param postfix Service name postfix + * @param clientName Custom client class name + * @param request Path to custom request file */ export const writeClient = async ( client: Client, @@ -75,7 +75,8 @@ export const writeClient = async ( useUnionTypes, useOptions, indent, - postfix + postfix, + clientName ); } diff --git a/src/utils/writeClientClass.ts b/src/utils/writeClientClass.ts index be0702c8..549a5c5b 100644 --- a/src/utils/writeClientClass.ts +++ b/src/utils/writeClientClass.ts @@ -20,8 +20,8 @@ import { sortServicesByName } from './sortServicesByName'; * @param outputPath Directory to write the generated files to * @param httpClient The selected httpClient (fetch, xhr, node or axios) * @param clientName Custom client class name - * @param indent: Indentation options (4, 2 or tab) - * @param postfix: Service name postfix + * @param indent Indentation options (4, 2 or tab) + * @param postfix Service name postfix */ export const writeClientClass = async ( client: Client, diff --git a/src/utils/writeClientCore.ts b/src/utils/writeClientCore.ts index 3be78d9e..6d35849d 100644 --- a/src/utils/writeClientCore.ts +++ b/src/utils/writeClientCore.ts @@ -15,8 +15,9 @@ import type { Templates } from './registerHandlebarTemplates'; * @param templates The loaded handlebar templates * @param outputPath Directory to write the generated files to * @param httpClient The selected httpClient (fetch, xhr, node or axios) - * @param indent: Indentation options (4, 2 or tab) - * @param request: Path to custom request file + * @param indent Indentation options (4, 2 or tab) + * @param clientName Custom client class name + * @param request Path to custom request file */ export const writeClientCore = async ( client: Client, diff --git a/src/utils/writeClientIndex.ts b/src/utils/writeClientIndex.ts index eb13cbb1..d72d12d2 100644 --- a/src/utils/writeClientIndex.ts +++ b/src/utils/writeClientIndex.ts @@ -14,11 +14,11 @@ import { sortServicesByName } from './sortServicesByName'; * @param templates The loaded handlebar templates * @param outputPath Directory to write the generated files to * @param useUnionTypes Use union types instead of enums - * @param exportCore: Generate core - * @param exportServices: Generate services - * @param exportModels: Generate models - * @param exportSchemas: Generate schemas - * @param postfix: Service name postfix + * @param exportCore Generate core + * @param exportServices Generate services + * @param exportModels Generate models + * @param exportSchemas Generate schemas + * @param postfix Service name postfix */ export const writeClientIndex = async ( client: Client, diff --git a/src/utils/writeClientModels.ts b/src/utils/writeClientModels.ts index 9ecf7568..997569b9 100644 --- a/src/utils/writeClientModels.ts +++ b/src/utils/writeClientModels.ts @@ -15,7 +15,7 @@ import type { Templates } from './registerHandlebarTemplates'; * @param outputPath Directory to write the generated files to * @param httpClient The selected httpClient (fetch, xhr, node or axios) * @param useUnionTypes Use union types instead of enums - * @param indent: Indentation options (4, 2 or tab) + * @param indent Indentation options (4, 2 or tab) */ export const writeClientModels = async ( models: Model[], diff --git a/src/utils/writeClientSchemas.ts b/src/utils/writeClientSchemas.ts index 0e51e6fb..e1c885f6 100644 --- a/src/utils/writeClientSchemas.ts +++ b/src/utils/writeClientSchemas.ts @@ -15,7 +15,7 @@ import type { Templates } from './registerHandlebarTemplates'; * @param outputPath Directory to write the generated files to * @param httpClient The selected httpClient (fetch, xhr, node or axios) * @param useUnionTypes Use union types instead of enums - * @param indent: Indentation options (4, 2 or tab) + * @param indent Indentation options (4, 2 or tab) */ export const writeClientSchemas = async ( models: Model[], diff --git a/src/utils/writeClientServices.ts b/src/utils/writeClientServices.ts index 633fe3af..2f95341d 100644 --- a/src/utils/writeClientServices.ts +++ b/src/utils/writeClientServices.ts @@ -6,10 +6,9 @@ import type { Indent } from '../Indent'; import { writeFile } from './fileSystem'; import { formatCode as f } from './formatCode'; import { formatIndentation as i } from './formatIndentation'; +import { isDefined } from './isDefined'; import type { Templates } from './registerHandlebarTemplates'; -const VERSION_TEMPLATE_STRING = 'OpenAPI.VERSION'; - /** * Generate Services using the Handlebar template and write to disk. * @param services Array of Services to write @@ -18,8 +17,9 @@ const VERSION_TEMPLATE_STRING = 'OpenAPI.VERSION'; * @param httpClient The selected httpClient (fetch, xhr, node or axios) * @param useUnionTypes Use union types instead of enums * @param useOptions Use options or arguments functions - * @param indent: Indentation options (4, 2 or tab) - * @param postfix: Service name postfix + * @param indent Indentation options (4, 2 or tab) + * @param postfix Service name postfix + * @param clientName Custom client class name */ export const writeClientServices = async ( services: Service[], @@ -29,18 +29,18 @@ export const writeClientServices = async ( useUnionTypes: boolean, useOptions: boolean, indent: Indent, - postfix: string + postfix: string, + clientName?: string ): Promise => { for (const service of services) { const file = resolve(outputPath, `${service.name}${postfix}.ts`); - const useVersion = service.operations.some(operation => operation.path.includes(VERSION_TEMPLATE_STRING)); const templateResult = templates.exports.service({ ...service, httpClient, useUnionTypes, - useVersion, useOptions, postfix, + exportClient: isDefined(clientName), }); await writeFile(file, i(f(templateResult), indent)); } diff --git a/test/custom/request.ts b/test/custom/request.ts index 522f85cf..8252ea39 100644 --- a/test/custom/request.ts +++ b/test/custom/request.ts @@ -4,7 +4,7 @@ import type { OpenAPIConfig } from './OpenAPI'; export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { return new CancelablePromise((resolve, reject, onCancel) => { - const url = `${config.BASE}${options.path}`; + const url = `${config.BASE}${options.path}`.replace('{api-version}', config.VERSION); try { // Do your request... diff --git a/test/index.js b/test/index.js index d945a191..bcb3b9f5 100644 --- a/test/index.js +++ b/test/index.js @@ -7,7 +7,7 @@ const generate = async (input, output) => { await OpenAPI.generate({ input, output, - httpClient: OpenAPI.HttpClient.NODE, + httpClient: OpenAPI.HttpClient.FETCH, useOptions: false, useUnionTypes: false, exportCore: true, diff --git a/test/spec/v2.json b/test/spec/v2.json index 8171551f..2b3a314b 100644 --- a/test/spec/v2.json +++ b/test/spec/v2.json @@ -89,7 +89,7 @@ "required": true }, { - "description": "This is the parameter that is send as request body", + "description": "This is the parameter that is sent as request body", "name": "parameterBody", "in": "body", "type": "string", @@ -168,7 +168,7 @@ "required": true }, { - "description": "This is the parameter that is send as request body", + "description": "This is the parameter that is sent as request body", "name": "PARAMETER-BODY", "in": "body", "type": "string", @@ -574,7 +574,7 @@ "operationId": "CollectionFormat", "parameters": [ { - "description": "This is an array parameter that is send as csv format (comma-separated values)", + "description": "This is an array parameter that is sent as csv format (comma-separated values)", "name": "parameterArrayCSV", "in": "query", "required": true, @@ -585,7 +585,7 @@ "collectionFormat": "csv" }, { - "description": "This is an array parameter that is send as ssv format (space-separated values)", + "description": "This is an array parameter that is sent as ssv format (space-separated values)", "name": "parameterArraySSV", "in": "query", "required": true, @@ -596,7 +596,7 @@ "collectionFormat": "ssv" }, { - "description": "This is an array parameter that is send as tsv format (tab-separated values)", + "description": "This is an array parameter that is sent as tsv format (tab-separated values)", "name": "parameterArrayTSV", "in": "query", "required": true, @@ -607,7 +607,7 @@ "collectionFormat": "tsv" }, { - "description": "This is an array parameter that is send as pipes format (pipe-separated values)", + "description": "This is an array parameter that is sent as pipes format (pipe-separated values)", "name": "parameterArrayPipes", "in": "query", "required": true, @@ -618,7 +618,7 @@ "collectionFormat": "pipes" }, { - "description": "This is an array parameter that is send as multi format (multiple parameter instances)", + "description": "This is an array parameter that is sent as multi format (multiple parameter instances)", "name": "parameterArrayMulti", "in": "query", "required": true, diff --git a/test/spec/v3.json b/test/spec/v3.json index dcfd011e..f1872aff 100644 --- a/test/spec/v3.json +++ b/test/spec/v3.json @@ -814,7 +814,7 @@ "operationId": "CollectionFormat", "parameters": [ { - "description": "This is an array parameter that is send as csv format (comma-separated values)", + "description": "This is an array parameter that is sent as csv format (comma-separated values)", "name": "parameterArrayCSV", "in": "query", "required": true, @@ -828,7 +828,7 @@ "collectionFormat": "csv" }, { - "description": "This is an array parameter that is send as ssv format (space-separated values)", + "description": "This is an array parameter that is sent as ssv format (space-separated values)", "name": "parameterArraySSV", "in": "query", "required": true, @@ -842,7 +842,7 @@ "collectionFormat": "ssv" }, { - "description": "This is an array parameter that is send as tsv format (tab-separated values)", + "description": "This is an array parameter that is sent as tsv format (tab-separated values)", "name": "parameterArrayTSV", "in": "query", "required": true, @@ -856,7 +856,7 @@ "collectionFormat": "tsv" }, { - "description": "This is an array parameter that is send as pipes format (pipe-separated values)", + "description": "This is an array parameter that is sent as pipes format (pipe-separated values)", "name": "parameterArrayPipes", "in": "query", "required": true, @@ -870,7 +870,7 @@ "collectionFormat": "pipes" }, { - "description": "This is an array parameter that is send as multi format (multiple parameter instances)", + "description": "This is an array parameter that is sent as multi format (multiple parameter instances)", "name": "parameterArrayMulti", "in": "query", "required": true,