Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
generatorName: typescript-axios
outputDir: samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,20 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{#isArray}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{#uniqueItems}}
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
{{/uniqueItems}}
{{^uniqueItems}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/uniqueItems}}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
{{#uniqueItems}}
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
{{/uniqueItems}}
{{^uniqueItems}}
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
{{/uniqueItems}}
{{/isCollectionFormatMulti}}
}
{{/isArray}}
Expand Down Expand Up @@ -117,7 +127,12 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{#headerParams}}
{{#isArray}}
if ({{paramName}}) {
{{#uniqueItems}}
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure about the comparison here <any>"{{{dataType}}}" !== "Set<string>" as I'm not sure what the comparison in the Array case is supposed to do. If someone can verify that this is correct or let me know what the correct version is supposed to be, I would be grateful 😃

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks correct, I think the idea is to serialize the items of a non-string array/set

{{/uniqueItems}}
{{^uniqueItems}}
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
{{/uniqueItems}}
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
}
{{/isArray}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,39 @@ paths:
responses:
"200":
description: Success
/fake/test-unique-paramters:
put:
tags:
- fake
description: To test unique items in header and query parameters
operationId: testUniqueItemsHeaderAndQueryParameterCollectionFormat
parameters:
- name: queryUnique
in: query
required: true
schema:
type: array
uniqueItems: true
items:
type: string
- name: headerUnique
in: header
required: true
schema:
type: array
uniqueItems: true
items:
type: string
responses:
"200":
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
uniqueItems: true
'/fake/{petId}/uploadImageWithRequiredFile':
post:
tags:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gitignore
.npmignore
api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1.1-SNAPSHOT
Loading