From f998e610d94047f317a6d7a14ec1457d44109fd4 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sat, 16 May 2020 23:27:45 +0200
Subject: [PATCH 1/9] Include map for `AnyType` in `typescript`

---
 .../codegen/languages/AbstractTypeScriptClientCodegen.java       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
index a9394802f0b..6938695757e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
@@ -164,6 +164,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
         typeMapping.put("UUID", "string");
         typeMapping.put("URI", "string");
         typeMapping.put("Error", "Error");
+        typeMapping.put("AnyType", "any");
 
         cliOptions.add(new CliOption(CodegenConstants.ENUM_NAME_SUFFIX, CodegenConstants.ENUM_NAME_SUFFIX_DESC).defaultValue(this.enumSuffix));
         cliOptions.add(new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC).defaultValue(this.enumPropertyNaming.name()));
-- 
GitLab


From 1e313c7320115603871caa08fa7eec8175d6e160 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sat, 16 May 2020 23:30:01 +0200
Subject: [PATCH 2/9] Exclude `any` from the list of types extracted from
 `anyOf`, `allOf`, `oneOf`

Exclude if there are other meaningful types
---
 .../AbstractTypeScriptClientCodegen.java      | 44 ++++++++++---------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
index 6938695757e..10281b5dfdf 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
@@ -809,35 +809,34 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
 
     @Override
     public String toAnyOfName(List<String> names, ComposedSchema composedSchema) {
-        List<String> types = composedSchema.getAnyOf().stream().map(schema -> {
-            String schemaType = getSchemaType(schema);
-            if (ModelUtils.isArraySchema(schema)) {
-                ArraySchema ap = (ArraySchema) schema;
-                Schema inner = ap.getItems();
-                schemaType = schemaType + "<" + getSchemaType(inner) + ">";
-            }
-            return schemaType;
-        }).distinct().collect(Collectors.toList());
+        List<String> types = getTypesFromSchemas(composedSchema.getAnyOf());
+
         return String.join(" | ", types);
     }
 
     @Override
     public String toOneOfName(List<String> names, ComposedSchema composedSchema) {
-        List<String> types = composedSchema.getOneOf().stream().map(schema -> {
-            String schemaType = getSchemaType(schema);
-            if (ModelUtils.isArraySchema(schema)) {
-                ArraySchema ap = (ArraySchema) schema;
-                Schema inner = ap.getItems();
-                schemaType = schemaType + "<" + getSchemaType(inner) + ">";
-            }
-            return schemaType;
-        }).distinct().collect(Collectors.toList());
+        List<String> types = getTypesFromSchemas(composedSchema.getOneOf());
+
         return String.join(" | ", types);
     }
 
     @Override
     public String toAllOfName(List<String> names, ComposedSchema composedSchema) {
-        List<String> types = composedSchema.getAllOf().stream().map(schema -> {
+        List<String> types = getTypesFromSchemas(composedSchema.getAllOf());
+
+        return String.join(" & ", types);
+    }
+
+    /**
+     * Extracts the list of type names from a list of schemas.
+     * Excludes `AnyType` if there are other valid types extracted.
+     *
+     * @param schema list of schemas
+     * @return list of types
+     */
+    protected List<String> getTypesFromSchemas(List<Schema> schemas) {
+        List<String> types = schemas.stream().map(schema -> {
             String schemaType = getSchemaType(schema);
             if (ModelUtils.isArraySchema(schema)) {
                 ArraySchema ap = (ArraySchema) schema;
@@ -846,6 +845,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
             }
             return schemaType;
         }).distinct().collect(Collectors.toList());
-        return String.join(" & ", types);
+
+        if (types.size() > 1 && types.contains("any")) {
+            types.remove("any");
+        }
+
+        return types;
     }
 }
-- 
GitLab


From aaae08158178443e97af9926fd7b19f4b6c2f004 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sat, 16 May 2020 23:37:24 +0200
Subject: [PATCH 3/9] Include new scripts and `yaml` to test the new case

---
 bin/typescript-axios-petstore-all.sh          |  1 +
 ...axios-petstore-allOf-without-properties.sh | 32 +++++++++
 bin/windows/typescript-axios-petstore-all.bat |  1 +
 ...xios-petstore-allOf-without-properties.bat | 14 ++++
 .../3_0/allOf-without-properties.yaml         | 69 +++++++++++++++++++
 5 files changed, 117 insertions(+)
 create mode 100755 bin/typescript-axios-petstore-allOf-without-properties.sh
 create mode 100644 bin/windows/typescript-axios-petstore-allOf-without-properties.bat
 create mode 100644 modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml

diff --git a/bin/typescript-axios-petstore-all.sh b/bin/typescript-axios-petstore-all.sh
index e3dfe396226..b7c9979ede5 100755
--- a/bin/typescript-axios-petstore-all.sh
+++ b/bin/typescript-axios-petstore-all.sh
@@ -6,4 +6,5 @@
 ./bin/typescript-axios-petstore-with-complex-headers.sh
 ./bin/typescript-axios-petstore-with-single-request-parameters.sh
 ./bin/typescript-axios-petstore-interfaces.sh
+./bin/typescript-axios-petstore-allOf-without-properties.sh
 ./bin/typescript-axios-petstore.sh
diff --git a/bin/typescript-axios-petstore-allOf-without-properties.sh b/bin/typescript-axios-petstore-allOf-without-properties.sh
new file mode 100755
index 00000000000..a0c6c62517b
--- /dev/null
+++ b/bin/typescript-axios-petstore-allOf-without-properties.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+SCRIPT="$0"
+echo "# START SCRIPT: $SCRIPT"
+
+while [ -h "$SCRIPT" ] ; do
+  ls=`ls -ld "$SCRIPT"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+    SCRIPT="$link"
+  else
+    SCRIPT=`dirname "$SCRIPT"`/"$link"
+  fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+  APP_DIR=`dirname "$SCRIPT"`/..
+  APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+  mvn -B clean package
+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/3_0/allOf-without-properties.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/allOf-without-properties $@"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/typescript-axios-petstore-all.bat b/bin/windows/typescript-axios-petstore-all.bat
index c3b82892732..648826238ec 100644
--- a/bin/windows/typescript-axios-petstore-all.bat
+++ b/bin/windows/typescript-axios-petstore-all.bat
@@ -6,4 +6,5 @@ call bin\windows\typescript-axios-petstore-with-complex-headers.bat
 call bin\windows\typescript-axios-petstore-with-single-request-parameters.bat
 call bin\windows\typescript-axios-petstore-with-npm-version.bat
 call bin\windows\typescript-axios-petstore-interfaces.bat
+call bin\windows\typescript-axios-petstore-allOf-without-properties.bat
 call bin\windows\typescript-axios-petstore-with-npm-version-and-separate-models-and-api.bat
\ No newline at end of file
diff --git a/bin/windows/typescript-axios-petstore-allOf-without-properties.bat b/bin/windows/typescript-axios-petstore-allOf-without-properties.bat
new file mode 100644
index 00000000000..9f08f3c96d7
--- /dev/null
+++ b/bin/windows/typescript-axios-petstore-allOf-without-properties.bat
@@ -0,0 +1,14 @@
+@ECHO OFF
+
+set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
+
+If Not Exist %executable% (
+  mvn clean package
+)
+
+REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
+
+echo
+set ags=generate -i modules\openapi-generator\src\test\resources\3_0\allOf-without-properties.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\allOf-without-properties
+
+java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml b/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml
new file mode 100644
index 00000000000..df21f940e25
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml
@@ -0,0 +1,69 @@
+
+
+openapi: 3.0.1
+info:
+  version: 1.0.0
+  title: Example
+  license:
+    name: MIT
+servers:
+  - url: http://api.example.xyz/v1
+paths:
+  /person/display/{personId}:
+    get:
+      parameters:
+        - name: personId
+          in: path
+          required: true
+          description: The id of the person to retrieve
+          schema:
+            type: string
+      operationId: list
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Person"
+components:
+  schemas:
+    Person:
+      type: object
+      discriminator:
+        propertyName: $_type
+        mapping:
+          a: '#/components/schemas/Adult'
+          c: Child
+      properties:
+        $_type:
+          type: string
+        lastName:
+          type: string
+        firstName:
+          type: string
+    Adult:
+      description: A representation of an adult
+      allOf:
+      - $ref: '#/components/schemas/Person'
+      - type: object
+        properties:
+          children:
+            type: array
+            items:
+              $ref: "#/components/schemas/Child"
+          firstChild:
+            allOf:
+              - $ref: '#/components/schemas/Child'
+              # This field doesn't contain properties or ref, so it's not
+              # possible to determine type, thus it will be `AnyType`
+              - description: First child
+    Child:
+      description: A representation of a child
+      allOf:
+      - type: object
+        properties:
+          age:
+            type: integer
+            format: int32
+      - $ref: '#/components/schemas/Person'
-- 
GitLab


From 1694b9e44546b492340fa1c38564e191c62c5514 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sat, 16 May 2020 23:37:42 +0200
Subject: [PATCH 4/9] Execute the new sample for `typescript-axios`

---
 .../allOf-without-properties/.gitignore       |   4 +
 .../allOf-without-properties/.npmignore       |   1 +
 .../.openapi-generator-ignore                 |  23 ++
 .../.openapi-generator/VERSION                |   1 +
 .../builds/allOf-without-properties/api.ts    | 215 ++++++++++++++++++
 .../builds/allOf-without-properties/base.ts   |  70 ++++++
 .../allOf-without-properties/configuration.ts |  75 ++++++
 .../allOf-without-properties/git_push.sh      |  58 +++++
 .../builds/allOf-without-properties/index.ts  |  16 ++
 9 files changed, 463 insertions(+)
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh
 create mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts

diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore
new file mode 100644
index 00000000000..205d8013f46
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore
@@ -0,0 +1,4 @@
+wwwroot/*.js
+node_modules
+typings
+dist
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore
new file mode 100644
index 00000000000..999d88df693
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore
@@ -0,0 +1 @@
+# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore
@@ -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
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION
new file mode 100644
index 00000000000..d99e7162d01
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION
@@ -0,0 +1 @@
+5.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
new file mode 100644
index 00000000000..82b4440e2bd
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
@@ -0,0 +1,215 @@
+// tslint:disable
+/**
+ * Example
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import * as globalImportUrl from 'url';
+import { Configuration } from './configuration';
+import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
+// Some imports not used depending on template conditions
+// @ts-ignore
+import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
+
+/**
+ * A representation of an adult
+ * @export
+ * @interface Adult
+ */
+export interface Adult extends Person {
+    /**
+     * 
+     * @type {Array<Child>}
+     * @memberof Adult
+     */
+    children?: Array<Child>;
+    /**
+     * 
+     * @type {Child}
+     * @memberof Adult
+     */
+    firstChild?: Child;
+}
+/**
+ * 
+ * @export
+ * @interface AdultAllOf
+ */
+export interface AdultAllOf {
+    /**
+     * 
+     * @type {Array<Child>}
+     * @memberof AdultAllOf
+     */
+    children?: Array<Child>;
+    /**
+     * 
+     * @type {Child}
+     * @memberof AdultAllOf
+     */
+    firstChild?: Child;
+}
+/**
+ * A representation of a child
+ * @export
+ * @interface Child
+ */
+export interface Child extends Person {
+    /**
+     * 
+     * @type {number}
+     * @memberof Child
+     */
+    age?: number;
+}
+/**
+ * 
+ * @export
+ * @interface ChildAllOf
+ */
+export interface ChildAllOf {
+    /**
+     * 
+     * @type {number}
+     * @memberof ChildAllOf
+     */
+    age?: number;
+}
+/**
+ * 
+ * @export
+ * @interface Person
+ */
+export interface Person {
+    /**
+     * 
+     * @type {string}
+     * @memberof Person
+     */
+    $_type?: string;
+    /**
+     * 
+     * @type {string}
+     * @memberof Person
+     */
+    lastName?: string;
+    /**
+     * 
+     * @type {string}
+     * @memberof Person
+     */
+    firstName?: string;
+}
+
+/**
+ * DefaultApi - axios parameter creator
+ * @export
+ */
+export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @param {string} personId The id of the person to retrieve
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        list: async (personId: string, options: any = {}): Promise<RequestArgs> => {
+            // verify required parameter 'personId' is not null or undefined
+            if (personId === null || personId === undefined) {
+                throw new RequiredError('personId','Required parameter personId was null or undefined when calling list.');
+            }
+            const localVarPath = `/person/display/{personId}`
+                .replace(`{${"personId"}}`, encodeURIComponent(String(personId)));
+            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+
+    
+            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
+            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
+            delete localVarUrlObj.search;
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+
+            return {
+                url: globalImportUrl.format(localVarUrlObj),
+                options: localVarRequestOptions,
+            };
+        },
+    }
+};
+
+/**
+ * DefaultApi - functional programming interface
+ * @export
+ */
+export const DefaultApiFp = function(configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @param {string} personId The id of the person to retrieve
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async list(personId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Person>> {
+            const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).list(personId, options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+    }
+};
+
+/**
+ * DefaultApi - factory interface
+ * @export
+ */
+export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
+    return {
+        /**
+         * 
+         * @param {string} personId The id of the person to retrieve
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        list(personId: string, options?: any): AxiosPromise<Person> {
+            return DefaultApiFp(configuration).list(personId, options).then((request) => request(axios, basePath));
+        },
+    };
+};
+
+/**
+ * DefaultApi - object-oriented interface
+ * @export
+ * @class DefaultApi
+ * @extends {BaseAPI}
+ */
+export class DefaultApi extends BaseAPI {
+    /**
+     * 
+     * @param {string} personId The id of the person to retrieve
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof DefaultApi
+     */
+    public list(personId: string, options?: any) {
+        return DefaultApiFp(this.configuration).list(personId, options).then((request) => request(this.axios, this.basePath));
+    }
+}
+
+
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts
new file mode 100644
index 00000000000..46e25c2e6de
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts
@@ -0,0 +1,70 @@
+// tslint:disable
+/**
+ * Example
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import { Configuration } from "./configuration";
+// Some imports not used depending on template conditions
+// @ts-ignore
+import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
+
+export const BASE_PATH = "http://api.example.xyz/v1".replace(/\/+$/, "");
+
+/**
+ *
+ * @export
+ */
+export const COLLECTION_FORMATS = {
+    csv: ",",
+    ssv: " ",
+    tsv: "\t",
+    pipes: "|",
+};
+
+/**
+ *
+ * @export
+ * @interface RequestArgs
+ */
+export interface RequestArgs {
+    url: string;
+    options: any;
+}
+
+/**
+ *
+ * @export
+ * @class BaseAPI
+ */
+export class BaseAPI {
+    protected configuration: Configuration | undefined;
+
+    constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
+        if (configuration) {
+            this.configuration = configuration;
+            this.basePath = configuration.basePath || this.basePath;
+        }
+    }
+};
+
+/**
+ *
+ * @export
+ * @class RequiredError
+ * @extends {Error}
+ */
+export class RequiredError extends Error {
+    name: "RequiredError" = "RequiredError";
+    constructor(public field: string, msg?: string) {
+        super(msg);
+    }
+}
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts
new file mode 100644
index 00000000000..96f755e21cd
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts
@@ -0,0 +1,75 @@
+// tslint:disable
+/**
+ * Example
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+export interface ConfigurationParameters {
+    apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
+    username?: string;
+    password?: string;
+    accessToken?: string | ((name?: string, scopes?: string[]) => string);
+    basePath?: string;
+    baseOptions?: any;
+}
+
+export class Configuration {
+    /**
+     * parameter for apiKey security
+     * @param name security name
+     * @memberof Configuration
+     */
+    apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
+    /**
+     * parameter for basic security
+     * 
+     * @type {string}
+     * @memberof Configuration
+     */
+    username?: string;
+    /**
+     * parameter for basic security
+     * 
+     * @type {string}
+     * @memberof Configuration
+     */
+    password?: string;
+    /**
+     * parameter for oauth2 security
+     * @param name security name
+     * @param scopes oauth2 scope
+     * @memberof Configuration
+     */
+    accessToken?: string | ((name?: string, scopes?: string[]) => string);
+    /**
+     * override base path
+     * 
+     * @type {string}
+     * @memberof Configuration
+     */
+    basePath?: string;
+    /**
+     * base options for axios calls
+     *
+     * @type {any}
+     * @memberof Configuration
+     */
+    baseOptions?: any;
+
+    constructor(param: ConfigurationParameters = {}) {
+        this.apiKey = param.apiKey;
+        this.username = param.username;
+        this.password = param.password;
+        this.accessToken = param.accessToken;
+        this.basePath = param.basePath;
+        this.baseOptions = param.baseOptions;
+    }
+}
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh
new file mode 100644
index 00000000000..ced3be2b0c7
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+    git_host="github.com"
+    echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+    git_user_id="GIT_USER_ID"
+    echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+    git_repo_id="GIT_REPO_ID"
+    echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+    release_note="Minor update"
+    echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+    if [ "$GIT_TOKEN" = "" ]; then
+        echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+        git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+    else
+        git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
+    fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts
new file mode 100644
index 00000000000..435b97b80db
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts
@@ -0,0 +1,16 @@
+// tslint:disable
+/**
+ * Example
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+export * from "./api";
+export * from "./configuration";
-- 
GitLab


From a24bf826396f084230ff8eafe26b38139d12a300 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sun, 17 May 2020 13:08:31 +0200
Subject: [PATCH 5/9] Filter out only `AnyType` instead of all `any` types

---
 .../languages/AbstractTypeScriptClientCodegen.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
index 10281b5dfdf..95767640988 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
@@ -832,11 +832,15 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
      * Extracts the list of type names from a list of schemas.
      * Excludes `AnyType` if there are other valid types extracted.
      *
-     * @param schema list of schemas
+     * @param schemas list of schemas
      * @return list of types
      */
     protected List<String> getTypesFromSchemas(List<Schema> schemas) {
-        List<String> types = schemas.stream().map(schema -> {
+        List<Schema> filteredSchemas = schemas.size() > 1
+            ? schemas.stream().filter(schema -> super.getSchemaType(schema) != "AnyType").collect(Collectors.toList())
+            : schemas;
+
+        return filteredSchemas.stream().map(schema -> {
             String schemaType = getSchemaType(schema);
             if (ModelUtils.isArraySchema(schema)) {
                 ArraySchema ap = (ArraySchema) schema;
@@ -845,11 +849,5 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
             }
             return schemaType;
         }).distinct().collect(Collectors.toList());
-
-        if (types.size() > 1 && types.contains("any")) {
-            types.remove("any");
-        }
-
-        return types;
     }
 }
-- 
GitLab


From 53f099f45247c2d9fc130bb08a81dc0f465346a5 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Sun, 17 May 2020 13:09:21 +0200
Subject: [PATCH 6/9] Renamed and modified samples

- Included more examples using `oneOf, `allOf`, `anyOf`
- Includede examples when types that are translated to `any` are involved (`file`)
---
 bin/typescript-axios-petstore-all.sh          |   2 +-
 ...script-axios-petstore-composed-schemas.sh} |   2 +-
 bin/windows/typescript-axios-petstore-all.bat |   2 +-
 ...cript-axios-petstore-composed-schemas.bat} |   2 +-
 .../3_0/allOf-without-properties.yaml         |  69 ---
 .../test/resources/3_0/composed-schemas.yaml  | 107 +++++
 .../builds/allOf-without-properties/api.ts    | 215 ---------
 .../.gitignore                                |   0
 .../.npmignore                                |   0
 .../.openapi-generator-ignore                 |   0
 .../.openapi-generator/VERSION                |   0
 .../builds/composed-schemas/api.ts            | 420 ++++++++++++++++++
 .../base.ts                                   |   0
 .../configuration.ts                          |   0
 .../git_push.sh                               |   0
 .../index.ts                                  |   0
 16 files changed, 531 insertions(+), 288 deletions(-)
 rename bin/{typescript-axios-petstore-allOf-without-properties.sh => typescript-axios-petstore-composed-schemas.sh} (85%)
 rename bin/windows/{typescript-axios-petstore-allOf-without-properties.bat => typescript-axios-petstore-composed-schemas.bat} (69%)
 delete mode 100644 modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml
 create mode 100644 modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml
 delete mode 100644 samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/.gitignore (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/.npmignore (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/.openapi-generator-ignore (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/.openapi-generator/VERSION (100%)
 create mode 100644 samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/base.ts (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/configuration.ts (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/git_push.sh (100%)
 rename samples/client/petstore/typescript-axios/builds/{allOf-without-properties => composed-schemas}/index.ts (100%)

diff --git a/bin/typescript-axios-petstore-all.sh b/bin/typescript-axios-petstore-all.sh
index b7c9979ede5..c66b3eba307 100755
--- a/bin/typescript-axios-petstore-all.sh
+++ b/bin/typescript-axios-petstore-all.sh
@@ -6,5 +6,5 @@
 ./bin/typescript-axios-petstore-with-complex-headers.sh
 ./bin/typescript-axios-petstore-with-single-request-parameters.sh
 ./bin/typescript-axios-petstore-interfaces.sh
-./bin/typescript-axios-petstore-allOf-without-properties.sh
+./bin/typescript-axios-petstore-composed-schemas.sh
 ./bin/typescript-axios-petstore.sh
diff --git a/bin/typescript-axios-petstore-allOf-without-properties.sh b/bin/typescript-axios-petstore-composed-schemas.sh
similarity index 85%
rename from bin/typescript-axios-petstore-allOf-without-properties.sh
rename to bin/typescript-axios-petstore-composed-schemas.sh
index a0c6c62517b..8ed378b6f34 100755
--- a/bin/typescript-axios-petstore-allOf-without-properties.sh
+++ b/bin/typescript-axios-petstore-composed-schemas.sh
@@ -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/3_0/allOf-without-properties.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/allOf-without-properties $@"
+ags="generate -i modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/composed-schemas $@"
 
 java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/typescript-axios-petstore-all.bat b/bin/windows/typescript-axios-petstore-all.bat
index 648826238ec..8e9a25ddaf1 100644
--- a/bin/windows/typescript-axios-petstore-all.bat
+++ b/bin/windows/typescript-axios-petstore-all.bat
@@ -6,5 +6,5 @@ call bin\windows\typescript-axios-petstore-with-complex-headers.bat
 call bin\windows\typescript-axios-petstore-with-single-request-parameters.bat
 call bin\windows\typescript-axios-petstore-with-npm-version.bat
 call bin\windows\typescript-axios-petstore-interfaces.bat
-call bin\windows\typescript-axios-petstore-allOf-without-properties.bat
+call bin\windows\typescript-axios-petstore-composed-schemas.bat
 call bin\windows\typescript-axios-petstore-with-npm-version-and-separate-models-and-api.bat
\ No newline at end of file
diff --git a/bin/windows/typescript-axios-petstore-allOf-without-properties.bat b/bin/windows/typescript-axios-petstore-composed-schemas.bat
similarity index 69%
rename from bin/windows/typescript-axios-petstore-allOf-without-properties.bat
rename to bin/windows/typescript-axios-petstore-composed-schemas.bat
index 9f08f3c96d7..ae70255c20b 100644
--- a/bin/windows/typescript-axios-petstore-allOf-without-properties.bat
+++ b/bin/windows/typescript-axios-petstore-composed-schemas.bat
@@ -9,6 +9,6 @@ If Not Exist %executable% (
 REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
 
 echo
-set ags=generate -i modules\openapi-generator\src\test\resources\3_0\allOf-without-properties.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\allOf-without-properties
+set ags=generate -i modules\openapi-generator\src\test\resources\3_0\composed-schemas.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\composed-schemas
 
 java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml b/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml
deleted file mode 100644
index df21f940e25..00000000000
--- a/modules/openapi-generator/src/test/resources/3_0/allOf-without-properties.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-openapi: 3.0.1
-info:
-  version: 1.0.0
-  title: Example
-  license:
-    name: MIT
-servers:
-  - url: http://api.example.xyz/v1
-paths:
-  /person/display/{personId}:
-    get:
-      parameters:
-        - name: personId
-          in: path
-          required: true
-          description: The id of the person to retrieve
-          schema:
-            type: string
-      operationId: list
-      responses:
-        '200':
-          description: OK
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/Person"
-components:
-  schemas:
-    Person:
-      type: object
-      discriminator:
-        propertyName: $_type
-        mapping:
-          a: '#/components/schemas/Adult'
-          c: Child
-      properties:
-        $_type:
-          type: string
-        lastName:
-          type: string
-        firstName:
-          type: string
-    Adult:
-      description: A representation of an adult
-      allOf:
-      - $ref: '#/components/schemas/Person'
-      - type: object
-        properties:
-          children:
-            type: array
-            items:
-              $ref: "#/components/schemas/Child"
-          firstChild:
-            allOf:
-              - $ref: '#/components/schemas/Child'
-              # This field doesn't contain properties or ref, so it's not
-              # possible to determine type, thus it will be `AnyType`
-              - description: First child
-    Child:
-      description: A representation of a child
-      allOf:
-      - type: object
-        properties:
-          age:
-            type: integer
-            format: int32
-      - $ref: '#/components/schemas/Person'
diff --git a/modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml b/modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml
new file mode 100644
index 00000000000..08e73f1d2ee
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml
@@ -0,0 +1,107 @@
+
+
+openapi: 3.0.1
+info:
+  version: 1.0.0
+  title: Example
+  license:
+    name: MIT
+servers:
+  - url: http://api.example.xyz/v1
+paths:
+  /pets:
+    patch:
+      requestBody:
+        content:
+          application/json:
+            schema:
+              oneOf:
+                - $ref: '#/components/schemas/Cat'
+                - $ref: '#/components/schemas/Dog'
+                # This field will not match to any type.
+                - description: Any kind of pet
+              discriminator:
+                propertyName: pet_type
+      responses:
+        '200':
+          description: Updated
+
+  /pets-filtered:
+    patch:
+      requestBody:
+        content:
+          application/json:
+            schema:
+              anyOf:
+                - $ref: '#/components/schemas/PetByAge'
+                - $ref: '#/components/schemas/PetByType'
+                # This field will not match to any type.
+                - description: Any kind of filter
+      responses:
+        '200':
+          description: Updated
+
+  /file:
+    post:
+      requestBody:
+        content:
+          application/json:
+            schema:
+              type: object
+              properties:
+                file:
+                  allOf:
+                    - type: file
+                    # This field will not match to any type.
+                    - description: The file to upload
+      responses:
+        '200':
+          description: File uploaded
+
+components:
+  schemas:
+    Pet:
+      type: object
+      required:
+        - pet_type
+    Dog:
+      allOf:
+        # This field will not match to any type.
+        - description: Dog information
+        - $ref: '#/components/schemas/Pet'
+        - type: object
+          properties:
+            bark:
+              type: boolean
+            breed:
+              type: string
+              enum: [Dingo, Husky, Retriever, Shepherd]
+    Cat:
+      allOf:
+        - $ref: '#/components/schemas/Pet'
+        - type: object
+          properties:
+            hunts:
+              type: boolean
+            age:
+              type: integer
+    PetByAge:
+      type: object
+      properties:
+        age:
+          type: integer
+        nickname:
+          type: string
+      required:
+        - age
+
+    PetByType:
+      type: object
+      properties:
+        pet_type:
+          type: string
+          enum: [Cat, Dog]
+        hunts:
+          type: boolean
+      required:
+        - pet_type
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts b/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
deleted file mode 100644
index 82b4440e2bd..00000000000
--- a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/api.ts
+++ /dev/null
@@ -1,215 +0,0 @@
-// tslint:disable
-/**
- * Example
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
- *
- * The version of the OpenAPI document: 1.0.0
- * 
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import * as globalImportUrl from 'url';
-import { Configuration } from './configuration';
-import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
-// Some imports not used depending on template conditions
-// @ts-ignore
-import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
-
-/**
- * A representation of an adult
- * @export
- * @interface Adult
- */
-export interface Adult extends Person {
-    /**
-     * 
-     * @type {Array<Child>}
-     * @memberof Adult
-     */
-    children?: Array<Child>;
-    /**
-     * 
-     * @type {Child}
-     * @memberof Adult
-     */
-    firstChild?: Child;
-}
-/**
- * 
- * @export
- * @interface AdultAllOf
- */
-export interface AdultAllOf {
-    /**
-     * 
-     * @type {Array<Child>}
-     * @memberof AdultAllOf
-     */
-    children?: Array<Child>;
-    /**
-     * 
-     * @type {Child}
-     * @memberof AdultAllOf
-     */
-    firstChild?: Child;
-}
-/**
- * A representation of a child
- * @export
- * @interface Child
- */
-export interface Child extends Person {
-    /**
-     * 
-     * @type {number}
-     * @memberof Child
-     */
-    age?: number;
-}
-/**
- * 
- * @export
- * @interface ChildAllOf
- */
-export interface ChildAllOf {
-    /**
-     * 
-     * @type {number}
-     * @memberof ChildAllOf
-     */
-    age?: number;
-}
-/**
- * 
- * @export
- * @interface Person
- */
-export interface Person {
-    /**
-     * 
-     * @type {string}
-     * @memberof Person
-     */
-    $_type?: string;
-    /**
-     * 
-     * @type {string}
-     * @memberof Person
-     */
-    lastName?: string;
-    /**
-     * 
-     * @type {string}
-     * @memberof Person
-     */
-    firstName?: string;
-}
-
-/**
- * DefaultApi - axios parameter creator
- * @export
- */
-export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
-    return {
-        /**
-         * 
-         * @param {string} personId The id of the person to retrieve
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        list: async (personId: string, options: any = {}): Promise<RequestArgs> => {
-            // verify required parameter 'personId' is not null or undefined
-            if (personId === null || personId === undefined) {
-                throw new RequiredError('personId','Required parameter personId was null or undefined when calling list.');
-            }
-            const localVarPath = `/person/display/{personId}`
-                .replace(`{${"personId"}}`, encodeURIComponent(String(personId)));
-            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
-            let baseOptions;
-            if (configuration) {
-                baseOptions = configuration.baseOptions;
-            }
-            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
-            const localVarHeaderParameter = {} as any;
-            const localVarQueryParameter = {} as any;
-
-
-    
-            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
-            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
-            delete localVarUrlObj.search;
-            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
-            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
-
-            return {
-                url: globalImportUrl.format(localVarUrlObj),
-                options: localVarRequestOptions,
-            };
-        },
-    }
-};
-
-/**
- * DefaultApi - functional programming interface
- * @export
- */
-export const DefaultApiFp = function(configuration?: Configuration) {
-    return {
-        /**
-         * 
-         * @param {string} personId The id of the person to retrieve
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        async list(personId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Person>> {
-            const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).list(personId, options);
-            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
-                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
-                return axios.request(axiosRequestArgs);
-            };
-        },
-    }
-};
-
-/**
- * DefaultApi - factory interface
- * @export
- */
-export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
-    return {
-        /**
-         * 
-         * @param {string} personId The id of the person to retrieve
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        list(personId: string, options?: any): AxiosPromise<Person> {
-            return DefaultApiFp(configuration).list(personId, options).then((request) => request(axios, basePath));
-        },
-    };
-};
-
-/**
- * DefaultApi - object-oriented interface
- * @export
- * @class DefaultApi
- * @extends {BaseAPI}
- */
-export class DefaultApi extends BaseAPI {
-    /**
-     * 
-     * @param {string} personId The id of the person to retrieve
-     * @param {*} [options] Override http request option.
-     * @throws {RequiredError}
-     * @memberof DefaultApi
-     */
-    public list(personId: string, options?: any) {
-        return DefaultApiFp(this.configuration).list(personId, options).then((request) => request(this.axios, this.basePath));
-    }
-}
-
-
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore b/samples/client/petstore/typescript-axios/builds/composed-schemas/.gitignore
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/.gitignore
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/.gitignore
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore b/samples/client/petstore/typescript-axios/builds/composed-schemas/.npmignore
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/.npmignore
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/.npmignore
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator-ignore
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator-ignore
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator-ignore
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/VERSION
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/.openapi-generator/VERSION
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/VERSION
diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts
new file mode 100644
index 00000000000..9bfc1ba1f17
--- /dev/null
+++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts
@@ -0,0 +1,420 @@
+// tslint:disable
+/**
+ * Example
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+import * as globalImportUrl from 'url';
+import { Configuration } from './configuration';
+import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
+// Some imports not used depending on template conditions
+// @ts-ignore
+import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
+
+/**
+ * 
+ * @export
+ * @interface Cat
+ */
+export interface Cat {
+    /**
+     * 
+     * @type {boolean}
+     * @memberof Cat
+     */
+    hunts?: boolean;
+    /**
+     * 
+     * @type {number}
+     * @memberof Cat
+     */
+    age?: number;
+}
+/**
+ * 
+ * @export
+ * @interface CatAllOf
+ */
+export interface CatAllOf {
+    /**
+     * 
+     * @type {boolean}
+     * @memberof CatAllOf
+     */
+    hunts?: boolean;
+    /**
+     * 
+     * @type {number}
+     * @memberof CatAllOf
+     */
+    age?: number;
+}
+/**
+ * 
+ * @export
+ * @interface Dog
+ */
+export interface Dog {
+    /**
+     * 
+     * @type {boolean}
+     * @memberof Dog
+     */
+    bark?: boolean;
+    /**
+     * 
+     * @type {string}
+     * @memberof Dog
+     */
+    breed?: DogBreedEnum;
+}
+
+/**
+    * @export
+    * @enum {string}
+    */
+export enum DogBreedEnum {
+    Dingo = 'Dingo',
+    Husky = 'Husky',
+    Retriever = 'Retriever',
+    Shepherd = 'Shepherd'
+}
+
+/**
+ * 
+ * @export
+ * @interface DogAllOf
+ */
+export interface DogAllOf {
+    /**
+     * 
+     * @type {boolean}
+     * @memberof DogAllOf
+     */
+    bark?: boolean;
+    /**
+     * 
+     * @type {string}
+     * @memberof DogAllOf
+     */
+    breed?: DogAllOfBreedEnum;
+}
+
+/**
+    * @export
+    * @enum {string}
+    */
+export enum DogAllOfBreedEnum {
+    Dingo = 'Dingo',
+    Husky = 'Husky',
+    Retriever = 'Retriever',
+    Shepherd = 'Shepherd'
+}
+
+/**
+ * 
+ * @export
+ * @interface InlineObject
+ */
+export interface InlineObject {
+    /**
+     * 
+     * @type {any}
+     * @memberof InlineObject
+     */
+    file?: any;
+}
+/**
+ * 
+ * @export
+ * @interface PetByAge
+ */
+export interface PetByAge {
+    /**
+     * 
+     * @type {number}
+     * @memberof PetByAge
+     */
+    age: number;
+    /**
+     * 
+     * @type {string}
+     * @memberof PetByAge
+     */
+    nickname?: string;
+}
+/**
+ * 
+ * @export
+ * @interface PetByType
+ */
+export interface PetByType {
+    /**
+     * 
+     * @type {string}
+     * @memberof PetByType
+     */
+    pet_type: PetByTypePetTypeEnum;
+    /**
+     * 
+     * @type {boolean}
+     * @memberof PetByType
+     */
+    hunts?: boolean;
+}
+
+/**
+    * @export
+    * @enum {string}
+    */
+export enum PetByTypePetTypeEnum {
+    Cat = 'Cat',
+    Dog = 'Dog'
+}
+
+
+/**
+ * DefaultApi - axios parameter creator
+ * @export
+ */
+export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @param {InlineObject} [inlineObject] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        filePost: async (inlineObject?: InlineObject, options: any = {}): Promise<RequestArgs> => {
+            const localVarPath = `/file`;
+            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+
+    
+            localVarHeaderParameter['Content-Type'] = 'application/json';
+
+            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
+            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
+            delete localVarUrlObj.search;
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+            const needsSerialization = (typeof inlineObject !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
+            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(inlineObject !== undefined ? inlineObject : {}) : (inlineObject || "");
+
+            return {
+                url: globalImportUrl.format(localVarUrlObj),
+                options: localVarRequestOptions,
+            };
+        },
+        /**
+         * 
+         * @param {PetByAge | PetByType} [petByAgePetByType] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        petsFilteredPatch: async (petByAgePetByType?: PetByAge | PetByType, options: any = {}): Promise<RequestArgs> => {
+            const localVarPath = `/pets-filtered`;
+            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+
+    
+            localVarHeaderParameter['Content-Type'] = 'application/json';
+
+            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
+            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
+            delete localVarUrlObj.search;
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+            const needsSerialization = (typeof petByAgePetByType !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
+            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(petByAgePetByType !== undefined ? petByAgePetByType : {}) : (petByAgePetByType || "");
+
+            return {
+                url: globalImportUrl.format(localVarUrlObj),
+                options: localVarRequestOptions,
+            };
+        },
+        /**
+         * 
+         * @param {Cat | Dog} [catDog] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        petsPatch: async (catDog?: Cat | Dog, options: any = {}): Promise<RequestArgs> => {
+            const localVarPath = `/pets`;
+            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
+            let baseOptions;
+            if (configuration) {
+                baseOptions = configuration.baseOptions;
+            }
+            const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
+            const localVarHeaderParameter = {} as any;
+            const localVarQueryParameter = {} as any;
+
+
+    
+            localVarHeaderParameter['Content-Type'] = 'application/json';
+
+            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
+            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
+            delete localVarUrlObj.search;
+            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
+            const needsSerialization = (typeof catDog !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
+            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(catDog !== undefined ? catDog : {}) : (catDog || "");
+
+            return {
+                url: globalImportUrl.format(localVarUrlObj),
+                options: localVarRequestOptions,
+            };
+        },
+    }
+};
+
+/**
+ * DefaultApi - functional programming interface
+ * @export
+ */
+export const DefaultApiFp = function(configuration?: Configuration) {
+    return {
+        /**
+         * 
+         * @param {InlineObject} [inlineObject] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async filePost(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
+            const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).filePost(inlineObject, options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+        /**
+         * 
+         * @param {PetByAge | PetByType} [petByAgePetByType] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
+            const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsFilteredPatch(petByAgePetByType, options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+        /**
+         * 
+         * @param {Cat | Dog} [catDog] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        async petsPatch(catDog?: Cat | Dog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
+            const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsPatch(catDog, options);
+            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
+                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
+                return axios.request(axiosRequestArgs);
+            };
+        },
+    }
+};
+
+/**
+ * DefaultApi - factory interface
+ * @export
+ */
+export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
+    return {
+        /**
+         * 
+         * @param {InlineObject} [inlineObject] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        filePost(inlineObject?: InlineObject, options?: any): AxiosPromise<void> {
+            return DefaultApiFp(configuration).filePost(inlineObject, options).then((request) => request(axios, basePath));
+        },
+        /**
+         * 
+         * @param {PetByAge | PetByType} [petByAgePetByType] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): AxiosPromise<void> {
+            return DefaultApiFp(configuration).petsFilteredPatch(petByAgePetByType, options).then((request) => request(axios, basePath));
+        },
+        /**
+         * 
+         * @param {Cat | Dog} [catDog] 
+         * @param {*} [options] Override http request option.
+         * @throws {RequiredError}
+         */
+        petsPatch(catDog?: Cat | Dog, options?: any): AxiosPromise<void> {
+            return DefaultApiFp(configuration).petsPatch(catDog, options).then((request) => request(axios, basePath));
+        },
+    };
+};
+
+/**
+ * DefaultApi - object-oriented interface
+ * @export
+ * @class DefaultApi
+ * @extends {BaseAPI}
+ */
+export class DefaultApi extends BaseAPI {
+    /**
+     * 
+     * @param {InlineObject} [inlineObject] 
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof DefaultApi
+     */
+    public filePost(inlineObject?: InlineObject, options?: any) {
+        return DefaultApiFp(this.configuration).filePost(inlineObject, options).then((request) => request(this.axios, this.basePath));
+    }
+
+    /**
+     * 
+     * @param {PetByAge | PetByType} [petByAgePetByType] 
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof DefaultApi
+     */
+    public petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any) {
+        return DefaultApiFp(this.configuration).petsFilteredPatch(petByAgePetByType, options).then((request) => request(this.axios, this.basePath));
+    }
+
+    /**
+     * 
+     * @param {Cat | Dog} [catDog] 
+     * @param {*} [options] Override http request option.
+     * @throws {RequiredError}
+     * @memberof DefaultApi
+     */
+    public petsPatch(catDog?: Cat | Dog, options?: any) {
+        return DefaultApiFp(this.configuration).petsPatch(catDog, options).then((request) => request(this.axios, this.basePath));
+    }
+}
+
+
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/base.ts
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/base.ts
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/base.ts
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/configuration.ts
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh b/samples/client/petstore/typescript-axios/builds/composed-schemas/git_push.sh
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/git_push.sh
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/git_push.sh
diff --git a/samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/index.ts
similarity index 100%
rename from samples/client/petstore/typescript-axios/builds/allOf-without-properties/index.ts
rename to samples/client/petstore/typescript-axios/builds/composed-schemas/index.ts
-- 
GitLab


From 4795d97d94b98f9e05f20ceaf017d82e7f6ec27f Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Thu, 28 May 2020 23:57:39 +0200
Subject: [PATCH 7/9] Changes in mustache file

Set default value to empty object when the `requestParameter` doesn't have any required param
---
 .../src/main/resources/typescript-axios/apiInner.mustache       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
index ec637d7b44a..e1fecd41c99 100644
--- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
@@ -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}}
-- 
GitLab


From 85f00d2490dc1b7b150b3b8c8a282ad12749eed7 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Thu, 28 May 2020 23:58:25 +0200
Subject: [PATCH 8/9] New schema with operations without required params

---
 ...petstore-with-single-request-parameters.sh |   2 +-
 ...etstore-with-single-request-parameters.bat |   2 +-
 ...th-operations-without-required-params.yaml | 695 ++++++++++++++++++
 3 files changed, 697 insertions(+), 2 deletions(-)
 create mode 100644 modules/openapi-generator/src/test/resources/2_0/petstore-with-operations-without-required-params.yaml

diff --git a/bin/typescript-axios-petstore-with-single-request-parameters.sh b/bin/typescript-axios-petstore-with-single-request-parameters.sh
index 4f04a39e09d..25a7a60ce29 100755
--- a/bin/typescript-axios-petstore-with-single-request-parameters.sh
+++ b/bin/typescript-axios-petstore-with-single-request-parameters.sh
@@ -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
diff --git a/bin/windows/typescript-axios-petstore-with-single-request-parameters.bat b/bin/windows/typescript-axios-petstore-with-single-request-parameters.bat
index 108bed50f77..efe0284cb87 100755
--- a/bin/windows/typescript-axios-petstore-with-single-request-parameters.bat
+++ b/bin/windows/typescript-axios-petstore-with-single-request-parameters.bat
@@ -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%
diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-operations-without-required-params.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-operations-without-required-params.yaml
new file mode 100644
index 00000000000..23cc94c587c
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-operations-without-required-params.yaml
@@ -0,0 +1,695 @@
+swagger: '2.0'
+info:
+  description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.'
+  version: 1.0.0
+  title: OpenAPI Petstore
+  license:
+    name: Apache-2.0
+    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+host: petstore.swagger.io
+basePath: /v2
+tags:
+  - name: pet
+    description: Everything about your Pets
+  - name: store
+    description: Access to Petstore orders
+  - name: user
+    description: Operations about user
+schemes:
+  - http
+paths:
+  /pet:
+    post:
+      tags:
+        - pet
+      summary: Add a new pet to the store
+      description: ''
+      operationId: addPet
+      consumes:
+        - application/json
+        - application/xml
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: Pet object that needs to be added to the store
+          required: true
+          schema:
+            $ref: '#/definitions/Pet'
+      responses:
+        '405':
+          description: Invalid input
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+    put:
+      tags:
+        - pet
+      summary: Update an existing pet
+      description: ''
+      operationId: updatePet
+      consumes:
+        - application/json
+        - application/xml
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: Pet object that needs to be added to the store
+          required: true
+          schema:
+            $ref: '#/definitions/Pet'
+      responses:
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Pet not found
+        '405':
+          description: Validation exception
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+  /pet/findByStatus:
+    get:
+      tags:
+        - pet
+      summary: Finds Pets by status
+      description: Multiple status values can be provided with comma separated strings
+      operationId: findPetsByStatus
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: status
+          in: query
+          description: Status values that need to be considered for filter
+          required: true
+          type: array
+          items:
+            type: string
+            enum:
+              - available
+              - pending
+              - sold
+            default: available
+          collectionFormat: csv
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/Pet'
+        '400':
+          description: Invalid status value
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+  /pet/findByTags:
+    get:
+      tags:
+        - pet
+      summary: Finds Pets by tags
+      description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.'
+      operationId: findPetsByTags
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: tags
+          in: query
+          description: Tags to filter by
+          required: true
+          type: array
+          items:
+            type: string
+          collectionFormat: csv
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/Pet'
+        '400':
+          description: Invalid tag value
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+      deprecated: true
+  '/pet/{petId}':
+    get:
+      tags:
+        - pet
+      summary: Find pet by ID
+      description: Returns a single pet
+      operationId: getPetById
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: petId
+          in: path
+          description: ID of pet to return
+          required: true
+          type: integer
+          format: int64
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/Pet'
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Pet not found
+      security:
+        - api_key: []
+    post:
+      tags:
+        - pet
+      summary: Updates a pet in the store with form data
+      description: ''
+      operationId: updatePetWithForm
+      consumes:
+        - application/x-www-form-urlencoded
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: petId
+          in: path
+          description: ID of pet that needs to be updated
+          required: true
+          type: integer
+          format: int64
+        - name: name
+          in: formData
+          description: Updated name of the pet
+          required: false
+          type: string
+        - name: status
+          in: formData
+          description: Updated status of the pet
+          required: false
+          type: string
+      responses:
+        '405':
+          description: Invalid input
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+    delete:
+      tags:
+        - pet
+      summary: Deletes a pet
+      description: ''
+      operationId: deletePet
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: api_key
+          in: header
+          required: false
+          type: string
+        - name: petId
+          in: path
+          description: Pet id to delete
+          required: true
+          type: integer
+          format: int64
+      responses:
+        '400':
+          description: Invalid pet value
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+  '/pet/{petId}/uploadImage':
+    post:
+      tags:
+        - pet
+      summary: uploads an image
+      description: ''
+      operationId: uploadFile
+      consumes:
+        - multipart/form-data
+      produces:
+        - application/json
+      parameters:
+        - name: petId
+          in: path
+          description: ID of pet to update
+          required: true
+          type: integer
+          format: int64
+        - name: additionalMetadata
+          in: formData
+          description: Additional data to pass to server
+          required: false
+          type: string
+        - name: file
+          in: formData
+          description: file to upload
+          required: false
+          type: file
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/ApiResponse'
+      security:
+        - petstore_auth:
+            - 'write:pets'
+            - 'read:pets'
+  /store/inventory:
+    get:
+      tags:
+        - store
+      summary: Returns pet inventories by status
+      description: Returns a map of status codes to quantities
+      operationId: getInventory
+      produces:
+        - application/json
+      parameters: []
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            type: object
+            additionalProperties:
+              type: integer
+              format: int32
+      security:
+        - api_key: []
+  /store/order:
+    post:
+      tags:
+        - store
+      summary: Place an order for a pet
+      description: ''
+      operationId: placeOrder
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: order placed for purchasing the pet
+          required: false
+          schema:
+            $ref: '#/definitions/Order'
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/Order'
+        '400':
+          description: Invalid Order
+  '/store/order/{orderId}':
+    get:
+      tags:
+        - store
+      summary: Find purchase order by ID
+      description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions'
+      operationId: getOrderById
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: orderId
+          in: path
+          description: ID of pet that needs to be fetched
+          required: true
+          type: integer
+          maximum: 5
+          minimum: 1
+          format: int64
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/Order'
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Order not found
+    delete:
+      tags:
+        - store
+      summary: Delete purchase order by ID
+      description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+      operationId: deleteOrder
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: orderId
+          in: path
+          description: ID of the order that needs to be deleted
+          required: true
+          type: string
+      responses:
+        '400':
+          description: Invalid ID supplied
+        '404':
+          description: Order not found
+  /user:
+    post:
+      tags:
+        - user
+      summary: Create user
+      description: This can only be done by the logged in user.
+      operationId: createUser
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: Created user object
+          required: true
+          schema:
+            $ref: '#/definitions/User'
+      responses:
+        default:
+          description: successful operation
+  /user/createWithArray:
+    post:
+      tags:
+        - user
+      summary: Creates list of users with given input array
+      description: ''
+      operationId: createUsersWithArrayInput
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: List of user object
+          required: true
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/User'
+      responses:
+        default:
+          description: successful operation
+  /user/createWithList:
+    post:
+      tags:
+        - user
+      summary: Creates list of users with given input array
+      description: ''
+      operationId: createUsersWithListInput
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - in: body
+          name: body
+          description: List of user object
+          required: true
+          schema:
+            type: array
+            items:
+              $ref: '#/definitions/User'
+      responses:
+        default:
+          description: successful operation
+  /user/login:
+    get:
+      tags:
+        - user
+      summary: Logs user into the system
+      description: ''
+      operationId: loginUser
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: username
+          in: query
+          description: The user name for login
+          required: true
+          type: string
+        - name: password
+          in: query
+          description: The password for login in clear text
+          required: true
+          type: string
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            type: string
+          headers:
+            X-Rate-Limit:
+              type: integer
+              format: int32
+              description: calls per hour allowed by the user
+            X-Expires-After:
+              type: string
+              format: date-time
+              description: date in UTC when toekn expires
+        '400':
+          description: Invalid username/password supplied
+  /user/logout:
+    get:
+      tags:
+        - user
+      summary: Logs out current logged in user session
+      description: ''
+      operationId: logoutUser
+      produces:
+        - application/xml
+        - application/json
+      parameters: []
+      responses:
+        default:
+          description: successful operation
+  '/user/{username}':
+    get:
+      tags:
+        - user
+      summary: Get user by user name
+      description: ''
+      operationId: getUserByName
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: username
+          in: path
+          description: 'The name that needs to be fetched. Use user1 for testing.'
+          required: true
+          type: string
+      responses:
+        '200':
+          description: successful operation
+          schema:
+            $ref: '#/definitions/User'
+        '400':
+          description: Invalid username supplied
+        '404':
+          description: User not found
+    put:
+      tags:
+        - user
+      summary: Updated user
+      description: This can only be done by the logged in user.
+      operationId: updateUser
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: username
+          in: path
+          description: name that need to be deleted
+          required: true
+          type: string
+        - in: body
+          name: body
+          description: Updated user object
+          required: true
+          schema:
+            $ref: '#/definitions/User'
+      responses:
+        '400':
+          description: Invalid user supplied
+        '404':
+          description: User not found
+    delete:
+      tags:
+        - user
+      summary: Delete user
+      description: This can only be done by the logged in user.
+      operationId: deleteUser
+      produces:
+        - application/xml
+        - application/json
+      parameters:
+        - name: username
+          in: path
+          description: The name that needs to be deleted
+          required: true
+          type: string
+      responses:
+        '400':
+          description: Invalid username supplied
+        '404':
+          description: User not found
+securityDefinitions:
+  petstore_auth:
+    type: oauth2
+    authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+    flow: implicit
+    scopes:
+      'write:pets': modify pets in your account
+      'read:pets': read your pets
+  api_key:
+    type: apiKey
+    name: api_key
+    in: header
+definitions:
+  Order:
+    title: Pet Order
+    description: An order for a pets from the pet store
+    type: object
+    properties:
+      id:
+        type: integer
+        format: int64
+      petId:
+        type: integer
+        format: int64
+      quantity:
+        type: integer
+        format: int32
+      shipDate:
+        type: string
+        format: date-time
+      status:
+        type: string
+        description: Order Status
+        enum:
+          - placed
+          - approved
+          - delivered
+      complete:
+        type: boolean
+        default: false
+    xml:
+      name: Order
+  Category:
+    title: Pet category
+    description: A category for a pet
+    type: object
+    properties:
+      id:
+        type: integer
+        format: int64
+      name:
+        type: string
+    xml:
+      name: Category
+  User:
+    title: a User
+    description: A User who is purchasing from the pet store
+    type: object
+    properties:
+      id:
+        type: integer
+        format: int64
+      username:
+        type: string
+      firstName:
+        type: string
+      lastName:
+        type: string
+      email:
+        type: string
+      password:
+        type: string
+      phone:
+        type: string
+      userStatus:
+        type: integer
+        format: int32
+        description: User Status
+    xml:
+      name: User
+  Tag:
+    title: Pet Tag
+    description: A tag for a pet
+    type: object
+    properties:
+      id:
+        type: integer
+        format: int64
+      name:
+        type: string
+    xml:
+      name: Tag
+  Pet:
+    title: a Pet
+    description: A pet for sale in the pet store
+    type: object
+    required:
+      - name
+      - photoUrls
+    properties:
+      id:
+        type: integer
+        format: int64
+      category:
+        $ref: '#/definitions/Category'
+      name:
+        type: string
+        example: doggie
+      photoUrls:
+        type: array
+        xml:
+          name: photoUrl
+          wrapped: true
+        items:
+          type: string
+      tags:
+        type: array
+        xml:
+          name: tag
+          wrapped: true
+        items:
+          $ref: '#/definitions/Tag'
+      status:
+        type: string
+        description: pet status in the store
+        enum:
+          - available
+          - pending
+          - sold
+    xml:
+      name: Pet
+  ApiResponse:
+    title: An uploaded response
+    description: Describes the result of uploading an image resource
+    type: object
+    properties:
+      code:
+        type: integer
+        format: int32
+      type:
+        type: string
+      message:
+        type: string
-- 
GitLab


From 2088d583c24e9b8389ba27e5542e634666851b46 Mon Sep 17 00:00:00 2001
From: Jose Camara <jose.camara@coosto.com>
Date: Thu, 28 May 2020 23:58:36 +0200
Subject: [PATCH 9/9] Generate the sample

---
 .../with-single-request-parameters/api.ts     | 20 ++++++++-----------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts
index e5f45026d56..0f28039687c 100644
--- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts
+++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts
@@ -1250,15 +1250,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
         /**
          * 
          * @summary Place an order for a pet
-         * @param {Order} body order placed for purchasing the pet
+         * @param {Order} [body] order placed for purchasing the pet
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        placeOrder: async (body: Order, options: any = {}): Promise<RequestArgs> => {
-            // verify required parameter 'body' is not null or undefined
-            if (body === null || body === undefined) {
-                throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
-            }
+        placeOrder: async (body?: Order, options: any = {}): Promise<RequestArgs> => {
             const localVarPath = `/store/order`;
             const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
             let baseOptions;
@@ -1339,11 +1335,11 @@ export const StoreApiFp = function(configuration?: Configuration) {
         /**
          * 
          * @summary Place an order for a pet
-         * @param {Order} body order placed for purchasing the pet
+         * @param {Order} [body] order placed for purchasing the pet
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
+        async placeOrder(body?: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
             const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
             return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                 const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
@@ -1391,11 +1387,11 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
         /**
          * 
          * @summary Place an order for a pet
-         * @param {Order} body order placed for purchasing the pet
+         * @param {Order} [body] order placed for purchasing the pet
          * @param {*} [options] Override http request option.
          * @throws {RequiredError}
          */
-        placeOrder(body: Order, options?: any): AxiosPromise<Order> {
+        placeOrder(body?: Order, options?: any): AxiosPromise<Order> {
             return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath));
         },
     };
@@ -1440,7 +1436,7 @@ export interface StoreApiPlaceOrderRequest {
      * @type {Order}
      * @memberof StoreApiPlaceOrder
      */
-    readonly body: Order
+    readonly body?: Order
 }
 
 /**
@@ -1493,7 +1489,7 @@ export class StoreApi extends BaseAPI {
      * @throws {RequiredError}
      * @memberof StoreApi
      */
-    public placeOrder(requestParameters: StoreApiPlaceOrderRequest, options?: any) {
+    public placeOrder(requestParameters: StoreApiPlaceOrderRequest = {}, options?: any) {
         return StoreApiFp(this.configuration).placeOrder(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
     }
 }
-- 
GitLab