Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ][typescript-axios] useSingleRequestParameter should mark parameter optional if all properties are optional #6477

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-single-request-parameters --additional-properties useSingleRequestParameter=true $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-operations-without-required-params.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-single-request-parameters --additional-properties useSingleRequestParameter=true $@"

java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ If Not Exist %executable% (
)

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\with-single-request-parameters --additional-properties useSingleRequestParameter=true
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-operations-without-required-params.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\with-single-request-parameters --additional-properties useSingleRequestParameter=true

java %JAVA_OPTS% -jar %executable% %ags%
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class {{classname}} extends BaseAPI {
* @memberof {{classname}}
*/
{{#useSingleRequestParameter}}
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: any) {
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: any) {
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath));
}
{{/useSingleRequestParameter}}
Expand Down
Loading