From 19501b4262db956799f533f5771c29edad18d558 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 28 Nov 2023 19:42:01 -0800 Subject: [PATCH] Removes ts files --- .../csharp/general/enum-support-spec.json | 125 -- .../csharp/general/enum-support.ignore | 9 - .../csharp/general/enum-support.sh | 14 - .../client/required-attributes-spec.json | 340 ------ .../scala/client/required-attributes.sh | 15 - .../additional-properties-expected/.gitignore | 4 - .../additional-properties-expected/README.md | 226 ---- .../api.module.ts | 31 - .../additional-properties-expected/api/api.ts | 3 - .../api/user.service.ts | 222 ---- .../configuration.ts | 166 --- .../additional-properties-expected/encoder.ts | 20 - .../git_push.sh | 57 - .../additional-properties-expected/index.ts | 6 - .../model/models.ts | 1 - .../model/user.ts | 24 - .../ng-package.json | 6 - .../package.json | 34 - .../additional-properties-expected/param.ts | 69 -- .../tsconfig.json | 28 - .../variables.ts | 9 - .../additional-properties-spec.json | 106 -- .../array-and-object-expected/.gitignore | 4 - .../array-and-object-expected/README.md | 226 ---- .../array-and-object-expected/api.module.ts | 31 - .../array-and-object-expected/api/api.ts | 3 - .../api/project.service.ts | 519 --------- .../configuration.ts | 166 --- .../array-and-object-expected/encoder.ts | 20 - .../array-and-object-expected/git_push.sh | 57 - .../array-and-object-expected/index.ts | 6 - .../array-and-object-expected/model/models.ts | 3 - .../model/projectEntity.ts | 34 - .../model/projectEntityLocation.ts | 18 - .../model/projectList.ts | 18 - .../array-and-object-expected/ng-package.json | 6 - .../array-and-object-expected/package.json | 34 - .../array-and-object-expected/param.ts | 69 -- .../array-and-object-expected/tsconfig.json | 28 - .../array-and-object-expected/variables.ts | 9 - .../typescript/array-and-object-spec.json | 570 --------- .../custom-path-params-expected/.gitignore | 4 - .../custom-path-params-expected/README.md | 226 ---- .../custom-path-params-expected/api.module.ts | 31 - .../custom-path-params-expected/api/api.ts | 3 - .../api/matrixParams.service.ts | 306 ----- .../configuration.ts | 166 --- .../custom-path-params-expected/encoder.ts | 20 - .../custom-path-params-expected/git_push.sh | 57 - .../custom-path-params-expected/index.ts | 6 - .../model/complexParams.ts | 18 - .../model/models.ts | 1 - .../ng-package.json | 6 - .../custom-path-params-expected/package.json | 34 - .../custom-path-params-expected/param.ts | 69 -- .../custom-path-params-expected/tsconfig.json | 28 - .../custom-path-params-expected/variables.ts | 9 - .../typescript/custom-path-params-spec.json | 129 --- .../typescript/node-es5-expected/.gitignore | 3 - .../.openapi-generator-ignore | 23 - .../typescript/node-es5-expected/LICENSE | 201 ---- .../typescript/node-es5-expected/api.ts | 637 ----------- .../typescript/node-es5-expected/git_push.sh | 52 - .../typescript/node-es5-expected/package.json | 23 - .../node-es5-expected/tsconfig.json | 19 - .../typescript/node-es5-expected/typings.json | 10 - .../typescript/node-es5-spec.json | 414 ------- .../objectsWithEnums-expected/.gitignore | 3 - .../.openapi-generator-ignore | 23 - .../.openapi-generator/VERSION | 1 - .../objectsWithEnums-expected/api.ts | 3 - .../objectsWithEnums-expected/api/apis.ts | 3 - .../api/defaultApi.ts | 171 --- .../objectsWithEnums-expected/git_push.sh | 52 - .../model/externalEnum.ts | 17 - .../objectsWithEnums-expected/model/models.ts | 191 ---- .../model/objectWithEnums.ts | 43 - .../objectsWithEnums-expected/package.json | 26 - .../objectsWithEnums-expected/tsconfig.json | 20 - .../typescript/objectsWithEnums-spec.json | 91 -- .../typescript/petstore-expected/.gitignore | 4 - .../typescript/petstore-expected/README.md | 226 ---- .../petstore-expected/api.module.ts | 33 - .../typescript/petstore-expected/api/api.ts | 7 - .../petstore-expected/api/pet.service.ts | 724 ------------ .../petstore-expected/api/store.service.ts | 342 ------ .../petstore-expected/api/user.service.ts | 608 ---------- .../petstore-expected/configuration.ts | 186 --- .../typescript/petstore-expected/encoder.ts | 20 - .../typescript/petstore-expected/git_push.sh | 57 - .../typescript/petstore-expected/index.ts | 6 - .../petstore-expected/model/apiResponse.ts | 19 - .../petstore-expected/model/category.ts | 18 - .../petstore-expected/model/models.ts | 6 - .../petstore-expected/model/order.ts | 34 - .../typescript/petstore-expected/model/pet.ts | 36 - .../typescript/petstore-expected/model/tag.ts | 18 - .../petstore-expected/model/user.ts | 27 - .../petstore-expected/ng-package.json | 6 - .../typescript/petstore-expected/package.json | 34 - .../typescript/petstore-expected/param.ts | 69 -- .../petstore-expected/tsconfig.json | 28 - .../typescript/petstore-expected/variables.ts | 9 - .../typescript/petstore-spec.json | 1014 ----------------- 104 files changed, 10006 deletions(-) delete mode 100644 src/test/resources/integrationtests/csharp/general/enum-support-spec.json delete mode 100644 src/test/resources/integrationtests/csharp/general/enum-support.ignore delete mode 100755 src/test/resources/integrationtests/csharp/general/enum-support.sh delete mode 100644 src/test/resources/integrationtests/scala/client/required-attributes-spec.json delete mode 100755 src/test/resources/integrationtests/scala/client/required-attributes.sh delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/README.md delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/api.module.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/api/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/api/user.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/configuration.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/encoder.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/index.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/model/models.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/model/user.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/ng-package.json delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/param.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-expected/variables.ts delete mode 100644 src/test/resources/integrationtests/typescript/additional-properties-spec.json delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/README.md delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/api.module.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/api/project.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/configuration.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/encoder.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntity.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntityLocation.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectList.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/ng-package.json delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/param.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-expected/variables.ts delete mode 100644 src/test/resources/integrationtests/typescript/array-and-object-spec.json delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/README.md delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/api.module.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/api/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/api/matrixParams.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/configuration.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/encoder.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/index.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/model/complexParams.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/model/models.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/ng-package.json delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/param.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-expected/variables.ts delete mode 100644 src/test/resources/integrationtests/typescript/custom-path-params-spec.json delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/.openapi-generator-ignore delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/LICENSE delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-expected/typings.json delete mode 100644 src/test/resources/integrationtests/typescript/node-es5-spec.json delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator-ignore delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator/VERSION delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/apis.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/defaultApi.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/externalEnum.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/objectWithEnums.ts delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/objectsWithEnums-spec.json delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/.gitignore delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/README.md delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/api.module.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/api/api.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/api/pet.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/api/store.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/api/user.service.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/encoder.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/git_push.sh delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/index.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/apiResponse.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/category.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/models.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/order.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/pet.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/tag.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/model/user.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/ng-package.json delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/package.json delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/param.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/tsconfig.json delete mode 100644 src/test/resources/integrationtests/typescript/petstore-expected/variables.ts delete mode 100644 src/test/resources/integrationtests/typescript/petstore-spec.json diff --git a/src/test/resources/integrationtests/csharp/general/enum-support-spec.json b/src/test/resources/integrationtests/csharp/general/enum-support-spec.json deleted file mode 100644 index 99f0dba3974..00000000000 --- a/src/test/resources/integrationtests/csharp/general/enum-support-spec.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1", - "title": "My title" - }, - "host": "localhost:10010", - "basePath": "/", - "schemes": [ - "http", - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/": { - "get": { - "operationId": "getRoot", - "summary": "Root operation", - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "200 OK Response" - } - } - } - } - }, - "definitions": { - "WeekDays": { - "type": "string", - "enum": [ - "sun", - "mon", - "tue", - "wed", - "thu", - "fri", - "sat" - ] - }, - "My_Class_With_Optional_Enum": { - "properties": { - "quarantine": { - "type": "boolean" - }, - "grayware": { - "type": "boolean" - }, - "days": { - "$ref": "#/definitions/WeekDays" - } - } - }, - - "My_Class_With_Invalid_Required_Enum_Usage_On_Ref": { - "description": "Invalid use of required on $ref enum, per Swagger 2.0 spec: Any members other than '$ref' in a JSON Reference object SHALL be ignored. See My_Class_With_Required_Inline_Enum for appropriate usage.", - "properties": { - "first": { - "type": "boolean" - }, - "days": { - "$ref": "#/definitions/WeekDays", - "required": true - }, - "second": { - "type": "int" - } - } - }, - - "My_Class_With_Optional_Inline_Enum": { - "properties": { - "quarantine": { - "type": "boolean" - }, - "grayware": { - "type": "boolean" - }, - "days": { - "type": "string", - "enum": [ - "sun", - "mon", - "tue", - "wed", - "thu", - "fri", - "sat" - ] - } - } - }, - - "My_Class_With_Required_Inline_Enum": { - "required": [ "days" ], - "properties": { - "quarantine": { - "type": "boolean" - }, - "grayware": { - "type": "boolean" - }, - "days": { - "type": "string", - "enum": [ - "sun", - "mon", - "tue", - "wed", - "thu", - "fri", - "sat" - ] - } - } - } - } -} diff --git a/src/test/resources/integrationtests/csharp/general/enum-support.ignore b/src/test/resources/integrationtests/csharp/general/enum-support.ignore deleted file mode 100644 index 48a88a03835..00000000000 --- a/src/test/resources/integrationtests/csharp/general/enum-support.ignore +++ /dev/null @@ -1,9 +0,0 @@ -!**/IO.Swagger/Model/*.cs -**/Api/ -**/Client/ -**/Properties -**/IO.Swagger.Test/ -**/* -*/* -.swagger-codegen/ -*/.* diff --git a/src/test/resources/integrationtests/csharp/general/enum-support.sh b/src/test/resources/integrationtests/csharp/general/enum-support.sh deleted file mode 100755 index d275c603fdc..00000000000 --- a/src/test/resources/integrationtests/csharp/general/enum-support.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -declare opts="-DdebugModels -Dproject -Dmodels -DmodelTests=false -DmodelDocs=false $JAVA_OPTS" -declare curdir=$(cd $(dirname "${BASH_SOURCE}") && pwd) - -# NOTE: This is sensitive to the location of this script. -declare clijar=${SWAGGER_CODEGEN_CLI_JAR:-$(cd $curdir && cd ../../../../../../../swagger-codegen-cli/target/ && echo $PWD)/swagger-codegen-cli.jar} - -exec \java ${opts} -jar ${clijar} generate \ - -i enum-support-spec.json -g csharp \ - --additional-properties targetFramework=v4.5 \ - -o enum-support-expected; diff --git a/src/test/resources/integrationtests/scala/client/required-attributes-spec.json b/src/test/resources/integrationtests/scala/client/required-attributes-spec.json deleted file mode 100644 index db23005df4a..00000000000 --- a/src/test/resources/integrationtests/scala/client/required-attributes-spec.json +++ /dev/null @@ -1,340 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1", - "title": "Scala Client API Integration Test" - }, - "host": "localhost:8080", - "basePath": "/", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/people": { - "get": { - "tags": [ - "People" - ], - "operationId": "getPeople", - "summary": "People listing", - "produces": [ - "application/json" - ], - "parameters": [ - { - "type": "integer", - "format": "int64", - "description": "Limit results to people of a certain age.", - "name": "age", - "required": false, - "in": "query" - } - ], - "responses": { - "200": { - "description": "200 OK Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Person" - } - } - } - } - }, - "post": { - "tags": [ - "People" - ], - "operationId": "savePeople", - "summary": "People batch save", - "produces": [ - "application/json" - ], - "parameters": [ - { - "description": "Batch input of people to save", - "name": "body", - "required": true, - "in": "body", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Person" - } - } - }, - { - "type": "integer", - "format": "int32", - "description": "Explicitly sets the batch size", - "name": "size", - "required": false, - "in": "query", - "minimum": "10", - "maximum": "250", - "default": "25" - } - ], - "responses": { - "200": { - "description": "200 OK Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Person" - } - } - } - } - } - }, - "/people/{personId}": { - "get": { - "tags": [ - "People" - ], - "summary": "get people by id", - "description": "Retrieves a single person record by personId", - "operationId": "getPersonById", - "consumes": [ - "application/json" - ], - "responses": { - "200": { - "description": "The person requested", - "schema": { - "$ref": "#/definitions/Person" - } - }, - "404": { - "description": "No person with the provided id was found" - }, - "400": { - "description": "Invalid person id" - } - }, - "parameters": [ - { - "type": "integer", - "format": "int64", - "description": "The person's ID.", - "name": "personId", - "required": true, - "in": "path" - } - ] - } - }, - "/hobbies": { - "get": { - "tags": [ - "Hobbies" - ], - "summary": "Get hobbies", - "description": "Query hobbies with some additional optional meaningless parameters", - "operationId": "getHobbies", - "consumes": [ - "application/json" - ], - "responses": { - "200": { - "description": "The list of hobbies", - "schema": { - "type": "array", - "$ref": "#/definitions/Hobby" - } - }, - "404": { - "description": "No hobbies." - }, - "400": { - "description": "There was an issue with your request." - } - }, - "parameters": [ - { - "type": "string", - "description": "a string", - "name": "s", - "required": false, - "in": "query", - "default": "some string" - }, - { - "type": "string", - "description": "a string, testing keyword escaping", - "name": "class", - "required": false, - "in": "query", - "default": "some string" - }, - { - "type": "integer", - "format": "int32", - "description": "an integer", - "name": "i", - "required": false, - "in": "query", - "default": 1 - }, - { - "type": "integer", - "format": "int64", - "description": "a long", - "name": "l", - "required": false, - "in": "query", - "default": 2 - }, - { - "type": "boolean", - "description": "a bool", - "name": "bool", - "required": false, - "in": "query", - "default": true - }, - { - "type": "number", - "format": "float", - "description": "a float", - "name": "f", - "required": false, - "in": "query", - "default": 0.1 - }, - { - "type": "number", - "format": "double", - "description": "a double", - "name": "d", - "required": false, - "in": "query", - "default": 10.005 - }, - { - "type": "string", - "format": "date-time", - "description": "a date time", - "name": "datetime", - "required": false, - "in": "query", - "default": "2018-01-01T08:30:00Z-04:00" - }, - { - "type": "string", - "format": "date", - "description": "a date", - "name": "date", - "required": false, - "in": "query", - "default": "2018-01-01" - }, - { - "type": "string", - "format": "byte", - "description": "a base64 encoded string", - "name": "b", - "required": false, - "in": "query", - "default": "c3dhZ2dlciBjb2RlZ2Vu" - }, - { - "type": "string", - "format": "binary", - "description": "an octet string", - "name": "bin", - "required": false, - "in": "query", - "default": "DEADBEEF" - } - ] - } - } - }, - "definitions": { - "Person": { - "type": "object", - "required": ["id","firstName","lastName"], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "firstName": { - "type": "string", - "example": "text" - }, - "lastName": { - "type": "string", - "example": "text" - }, - "age": { - "type": "integer", - "format": "int32" - } - } - }, - "Hobby": { - "type": "object", - "required": [], - "properties": { - "id": { - "type": "integer", - "format": "int64", - "default": -1 - }, - "name": { - "type": "string", - "default": "Hobby Name" - }, - "count": { - "type": "integer", - "format": "int32", - "default": 1 - }, - "rate": { - "type": "number", - "format": "float", - "default": 10.0 - }, - "ratio": { - "type": "number", - "format": "double", - "default": 0.0005 - }, - "enabled": { - "type": "boolean", - "default": true - }, - "created": { - "type": "string", - "format": "date", - "default": "2018-01-01" - }, - "timestamp": { - "type": "string", - "format": "date-time", - "default": "2018-01-02T23:58:43.066-05:00" - }, - "bytes": { - "type": "string", - "format": "byte", - "default": "c3dhZ2dlciBjb2RlZ2Vu" - }, - "binary": { - "type": "string", - "example": "binary", - "default": "DEADBEEF" - } - } - } - } -} diff --git a/src/test/resources/integrationtests/scala/client/required-attributes.sh b/src/test/resources/integrationtests/scala/client/required-attributes.sh deleted file mode 100755 index 43fe0a87a6c..00000000000 --- a/src/test/resources/integrationtests/scala/client/required-attributes.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail - -declare prefix="required-attributes" - -declare opts="-DdebugModels -DdebugOperations -Dproject -Dmodels -Dapis -DapiTests=false -DapiDocs=false -DmodelTests=false -DmodelDocs=false $JAVA_OPTS" -declare curdir=$(cd $(dirname "${BASH_SOURCE}") && pwd) - -# NOTE: This is sensitive to the location of this script. -declare clijar=${SWAGGER_CODEGEN_CLI_JAR:-$(cd $curdir && cd ../../../../../../../swagger-codegen-cli/target/ && echo $PWD)/swagger-codegen-cli.jar} - -exec \java ${opts} -jar ${clijar} generate \ - -i ${prefix}-spec.json -g scala-httpclient-deprecated \ - -o ${prefix}-expected; diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/.gitignore b/src/test/resources/integrationtests/typescript/additional-properties-expected/.gitignore deleted file mode 100644 index 149b5765472..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/README.md b/src/test/resources/integrationtests/typescript/additional-properties-expected/README.md deleted file mode 100644 index d46ff5c06b9..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/README.md +++ /dev/null @@ -1,226 +0,0 @@ -## additionalPropertiesTest@1.0.2 - -### Building - -To install the required dependencies and to build the typescript sources run: -``` -npm install -npm run build -``` - -### publishing - -First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!) - -### consuming - -Navigate to the folder of your consuming project and run one of next commands. - -_published:_ - -``` -npm install additionalPropertiesTest@1.0.2 --save -``` - -_without publishing (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save -``` - -_It's important to take the tgz file, otherwise you'll get trouble with links on windows_ - -_using `npm link`:_ - -In PATH_TO_GENERATED_PACKAGE/dist: -``` -npm link -``` - -In your project: -``` -npm link additionalPropertiesTest -``` - -__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. -Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. -Published packages are not effected by this issue. - - -#### General usage - -In your Angular project: - - -``` -// without configuring providers -import { ApiModule } from 'additionalPropertiesTest'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers -import { ApiModule, Configuration, ConfigurationParameters } from 'additionalPropertiesTest'; - -export function apiConfigFactory (): Configuration { - const params: ConfigurationParameters = { - // set configuration parameters here. - } - return new Configuration(params); -} - -@NgModule({ - imports: [ ApiModule.forRoot(apiConfigFactory) ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers with an authentication service that manages your access tokens -import { ApiModule, Configuration } from 'additionalPropertiesTest'; - -@NgModule({ - imports: [ ApiModule ], - declarations: [ AppComponent ], - providers: [ - { - provide: Configuration, - useFactory: (authService: AuthService) => new Configuration( - { - basePath: environment.apiUrl, - accessToken: authService.getAccessToken.bind(authService) - } - ), - deps: [AuthService], - multi: false - } - ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -import { DefaultApi } from 'additionalPropertiesTest'; - -export class AppComponent { - constructor(private apiGateway: DefaultApi) { } -} -``` - -Note: The ApiModule is restricted to being instantiated once app wide. -This is to ensure that all services are treated as singletons. - -#### Using multiple OpenAPI files / APIs / ApiModules -In order to use multiple `ApiModules` generated from different OpenAPI files, -you can create an alias name when importing the modules -in order to avoid naming conflicts: -``` -import { ApiModule } from 'my-api-path'; -import { ApiModule as OtherApiModule } from 'my-other-api-path'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - OtherApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ] -}) -export class AppModule { - -} -``` - - -### Set service base path -If different than the generated base path, during app bootstrap, you can provide the base path to your service. - -``` -import { BASE_PATH } from 'additionalPropertiesTest'; - -bootstrap(AppComponent, [ - { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, -]); -``` -or - -``` -import { BASE_PATH } from 'additionalPropertiesTest'; - -@NgModule({ - imports: [], - declarations: [ AppComponent ], - providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - - -#### Using @angular/cli -First extend your `src/environments/*.ts` files by adding the corresponding base path: - -``` -export const environment = { - production: false, - API_BASE_PATH: 'http://127.0.0.1:8080' -}; -``` - -In the src/app/app.module.ts: -``` -import { BASE_PATH } from 'additionalPropertiesTest'; -import { environment } from '../environments/environment'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ ], - providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], - bootstrap: [ AppComponent ] -}) -export class AppModule { } -``` - -### Customizing path parameter encoding - -Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple' -and Dates for format 'date-time' are encoded correctly. - -Other styles (e.g. "matrix") are not that easy to encode -and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]). - -To implement your own parameter encoding (or call another library), -pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object -(see [General Usage](#general-usage) above). - -Example value for use in your Configuration-Provider: -```typescript -new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}) -``` - -[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations -[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values -[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/api.module.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/api.module.ts deleted file mode 100644 index 31f437b388c..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/api.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; - -import { UserService } from './api/user.service'; - -@NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [] -}) -export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - constructor( @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/api/api.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/api/api.ts deleted file mode 100644 index e5e59a3e181..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/api/api.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './user.service'; -import { UserService } from './user.service'; -export const APIS = [UserService]; diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/api/user.service.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/api/user.service.ts deleted file mode 100644 index f8e573e7c75..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/api/user.service.ts +++ /dev/null @@ -1,222 +0,0 @@ -/** - * OpenAPI Additional Properties - * This is a test spec - * - * 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. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { User } from '../model/user'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class UserService { - - protected basePath = 'http://additional-properties.swagger.io/v2'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * Add a new User to the store - * @param body User object that needs to be added to the store - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addUser(body?: { [key: string]: string; }, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public addUser(body?: { [key: string]: string; }, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public addUser(body?: { [key: string]: string; }, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public addUser(body?: { [key: string]: string; }, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Update an existing User - * @param body User object that needs to be added to the store - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateUser(body?: { [key: string]: string; }, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public updateUser(body?: { [key: string]: string; }, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updateUser(body?: { [key: string]: string; }, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updateUser(body?: { [key: string]: string; }, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/configuration.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/configuration.ts deleted file mode 100644 index d38a4c153f2..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/configuration.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; -import { Param } from './param'; - -export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: {[ key: string ]: string | (() => string | undefined)}; -} - -export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: {[ key: string ]: string | (() => string | undefined)}; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; - } - else { - this.encodeParam = param => this.defaultEncodeParam(param); - } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; - } - else { - this.credentials = {}; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; - } - - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; - } - - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } - - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' - ? value() - : value; - } - - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! - - const value = param.dataFormat === 'date-time' - ? (param.value as Date).toISOString() - : param.value; - - return encodeURIComponent(String(value)); - } -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/encoder.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/encoder.ts deleted file mode 100644 index 138c4d5cf2c..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/encoder.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; - -/** - * Custom HttpParameterCodec - * Workaround for https://github.com/angular/angular/issues/18261 - */ -export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/git_push.sh b/src/test/resources/integrationtests/typescript/additional-properties-expected/git_push.sh deleted file mode 100644 index 67b52e22d7f..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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-petstore-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="" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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/src/test/resources/integrationtests/typescript/additional-properties-expected/index.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/index.ts deleted file mode 100644 index 104dd3d21e3..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; -export * from './param'; diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/model/models.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/model/models.ts deleted file mode 100644 index e5abc856509..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/model/models.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './user'; diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/model/user.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/model/user.ts deleted file mode 100644 index a62b83bbe77..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/model/user.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * OpenAPI Additional Properties - * This is a test spec - * - * 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 User { - [key: string]: string | any; - - - id?: number; - /** - * User Status - */ - userStatus?: number; -} - diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/ng-package.json b/src/test/resources/integrationtests/typescript/additional-properties-expected/ng-package.json deleted file mode 100644 index 3b17900dc9c..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "index.ts" - } -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/package.json b/src/test/resources/integrationtests/typescript/additional-properties-expected/package.json deleted file mode 100644 index 31e050fb002..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "additionalPropertiesTest", - "version": "1.0.2", - "description": "OpenAPI client for additionalPropertiesTest", - "author": "OpenAPI-Generator Contributors", - "repository": { - "type": "git", - "url": "https:////.git" - }, - "keywords": [ - "openapi-client", - "openapi-generator" - ], - "license": "Unlicense", - "scripts": { - "build": "ng-packagr -p ng-package.json" - }, - "peerDependencies": { - "@angular/core": "^14.0.5", - "rxjs": "^7.5.5" - }, - "devDependencies": { - "@angular/common": "^14.0.5", - "@angular/compiler": "^14.0.5", - "@angular/compiler-cli": "^14.0.5", - "@angular/core": "^14.0.5", - "@angular/platform-browser": "^14.0.5", - "ng-packagr": "^14.0.2", - "reflect-metadata": "^0.1.3", - "rxjs": "^7.5.5", - "tsickle": "^0.46.3", - "typescript": ">=4.6.0 <=4.8.0", - "zone.js": "^0.11.5" - }} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/param.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/param.ts deleted file mode 100644 index 78a2d20a643..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/param.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Standard parameter styles defined by OpenAPI spec - */ -export type StandardParamStyle = - | 'matrix' - | 'label' - | 'form' - | 'simple' - | 'spaceDelimited' - | 'pipeDelimited' - | 'deepObject' - ; - -/** - * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. - */ -export type ParamStyle = StandardParamStyle | string; - -/** - * Standard parameter locations defined by OpenAPI spec - */ -export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; - -/** - * Standard types as defined in OpenAPI Specification: Data Types - */ -export type StandardDataType = - | "integer" - | "number" - | "boolean" - | "string" - | "object" - | "array" - ; - -/** - * Standard {@link DataType}s plus your own types/classes. - */ -export type DataType = StandardDataType | string; - -/** - * Standard formats as defined in OpenAPI Specification: Data Types - */ -export type StandardDataFormat = - | "int32" - | "int64" - | "float" - | "double" - | "byte" - | "binary" - | "date" - | "date-time" - | "password" - ; - -export type DataFormat = StandardDataFormat | string; - -/** - * The parameter to encode. - */ -export interface Param { - name: string; - value: unknown; - in: ParamLocation; - style: ParamStyle, - explode: boolean; - dataType: DataType; - dataFormat: DataFormat | undefined; -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/additional-properties-expected/tsconfig.json deleted file mode 100644 index c01ebe255d4..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "outDir": "./dist", - "noLib": false, - "declaration": true, - "lib": [ "es6", "dom" ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist" - ], - "filesGlob": [ - "./model/*.ts", - "./api/*.ts" - ] -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-expected/variables.ts b/src/test/resources/integrationtests/typescript/additional-properties-expected/variables.ts deleted file mode 100644 index 6fe58549f39..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-expected/variables.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InjectionToken } from '@angular/core'; - -export const BASE_PATH = new InjectionToken('basePath'); -export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} diff --git a/src/test/resources/integrationtests/typescript/additional-properties-spec.json b/src/test/resources/integrationtests/typescript/additional-properties-spec.json deleted file mode 100644 index 054dfb57c39..00000000000 --- a/src/test/resources/integrationtests/typescript/additional-properties-spec.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "This is a test spec", - "version": "1.0.0", - "title": "OpenAPI Additional Properties", - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "host": "additional-properties.swagger.io", - "basePath": "/v2", - "schemes": [ - "http" - ], - "paths": { - "/user": { - "post": { - "tags": [ - "user" - ], - "summary": "Add a new User to the store", - "description": "", - "operationId": "addUser", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "User object that needs to be added to the store", - "required": false, - "schema": { - "$ref": "#/definitions/User" - } - } - ], - "responses": { - "405": { - "description": "Invalid input" - } - } - }, - "put": { - "tags": [ - "user" - ], - "summary": "Update an existing User", - "description": "", - "operationId": "updateUser", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "User object that needs to be added to the store", - "required": false, - "schema": { - "$ref": "#/definitions/User" - } - } - ], - "responses": { - "405": { - "description": "Validation exception" - }, - "404": { - "description": "User not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - } - } - }, - "definitions": { - "User": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "userStatus": { - "type": "integer", - "format": "int32", - "description": "User Status" - } - }, - "additionalProperties": { - "type": "string" - } - } - } -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/.gitignore b/src/test/resources/integrationtests/typescript/array-and-object-expected/.gitignore deleted file mode 100644 index 149b5765472..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md b/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md deleted file mode 100644 index 9d5891ab4e1..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/README.md +++ /dev/null @@ -1,226 +0,0 @@ -## arrayAndAnyTest@1.0.2 - -### Building - -To install the required dependencies and to build the typescript sources run: -``` -npm install -npm run build -``` - -### publishing - -First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!) - -### consuming - -Navigate to the folder of your consuming project and run one of next commands. - -_published:_ - -``` -npm install arrayAndAnyTest@1.0.2 --save -``` - -_without publishing (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save -``` - -_It's important to take the tgz file, otherwise you'll get trouble with links on windows_ - -_using `npm link`:_ - -In PATH_TO_GENERATED_PACKAGE/dist: -``` -npm link -``` - -In your project: -``` -npm link arrayAndAnyTest -``` - -__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. -Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. -Published packages are not effected by this issue. - - -#### General usage - -In your Angular project: - - -``` -// without configuring providers -import { ApiModule } from 'arrayAndAnyTest'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers -import { ApiModule, Configuration, ConfigurationParameters } from 'arrayAndAnyTest'; - -export function apiConfigFactory (): Configuration { - const params: ConfigurationParameters = { - // set configuration parameters here. - } - return new Configuration(params); -} - -@NgModule({ - imports: [ ApiModule.forRoot(apiConfigFactory) ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers with an authentication service that manages your access tokens -import { ApiModule, Configuration } from 'arrayAndAnyTest'; - -@NgModule({ - imports: [ ApiModule ], - declarations: [ AppComponent ], - providers: [ - { - provide: Configuration, - useFactory: (authService: AuthService) => new Configuration( - { - basePath: environment.apiUrl, - accessToken: authService.getAccessToken.bind(authService) - } - ), - deps: [AuthService], - multi: false - } - ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -import { DefaultApi } from 'arrayAndAnyTest'; - -export class AppComponent { - constructor(private apiGateway: DefaultApi) { } -} -``` - -Note: The ApiModule is restricted to being instantiated once app wide. -This is to ensure that all services are treated as singletons. - -#### Using multiple OpenAPI files / APIs / ApiModules -In order to use multiple `ApiModules` generated from different OpenAPI files, -you can create an alias name when importing the modules -in order to avoid naming conflicts: -``` -import { ApiModule } from 'my-api-path'; -import { ApiModule as OtherApiModule } from 'my-other-api-path'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - OtherApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ] -}) -export class AppModule { - -} -``` - - -### Set service base path -If different than the generated base path, during app bootstrap, you can provide the base path to your service. - -``` -import { BASE_PATH } from 'arrayAndAnyTest'; - -bootstrap(AppComponent, [ - { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, -]); -``` -or - -``` -import { BASE_PATH } from 'arrayAndAnyTest'; - -@NgModule({ - imports: [], - declarations: [ AppComponent ], - providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - - -#### Using @angular/cli -First extend your `src/environments/*.ts` files by adding the corresponding base path: - -``` -export const environment = { - production: false, - API_BASE_PATH: 'http://127.0.0.1:8080' -}; -``` - -In the src/app/app.module.ts: -``` -import { BASE_PATH } from 'arrayAndAnyTest'; -import { environment } from '../environments/environment'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ ], - providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], - bootstrap: [ AppComponent ] -}) -export class AppModule { } -``` - -### Customizing path parameter encoding - -Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple' -and Dates for format 'date-time' are encoded correctly. - -Other styles (e.g. "matrix") are not that easy to encode -and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]). - -To implement your own parameter encoding (or call another library), -pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object -(see [General Usage](#general-usage) above). - -Example value for use in your Configuration-Provider: -```typescript -new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}) -``` - -[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations -[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values -[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/api.module.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/api.module.ts deleted file mode 100644 index 2db45acb24e..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/api.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; - -import { ProjectService } from './api/project.service'; - -@NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [] -}) -export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - constructor( @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts deleted file mode 100644 index 1ec7e5747eb..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/api/api.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './project.service'; -import { ProjectService } from './project.service'; -export const APIS = [ProjectService]; diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/api/project.service.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/api/project.service.ts deleted file mode 100644 index 2b0bc973bff..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/api/project.service.ts +++ /dev/null @@ -1,519 +0,0 @@ -/** - * Cupix API - * No description provided (generated by Openapi Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) - * - * The version of the OpenAPI document: 1.7.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { ProjectEntity } from '../model/projectEntity'; -// @ts-ignore -import { ProjectList } from '../model/projectList'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class ProjectService { - - protected basePath = '/v1'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * Create a Project - * Creates an empty Project - * @param name - * @param address - * @param longitude - * @param latitude - * @param meta - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public createProject(name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public createProject(name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public createProject(name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public createProject(name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/x-www-form-urlencoded' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (name !== undefined) { - localVarFormParams = localVarFormParams.append('name', name) as any || localVarFormParams; - } - if (address !== undefined) { - localVarFormParams = localVarFormParams.append('address', address) as any || localVarFormParams; - } - if (longitude !== undefined) { - localVarFormParams = localVarFormParams.append('longitude', longitude) as any || localVarFormParams; - } - if (latitude !== undefined) { - localVarFormParams = localVarFormParams.append('latitude', latitude) as any || localVarFormParams; - } - if (meta !== undefined) { - localVarFormParams = localVarFormParams.append('meta', meta) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/projects`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Delete a Project - * Returns a Project JSON object - * @param id Project id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteProjectById(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public deleteProjectById(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public deleteProjectById(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public deleteProjectById(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteProjectById.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/projects/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get a Project - * Returns a Project JSON object - * @param id Project id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getProjectById(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public getProjectById(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getProjectById(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getProjectById(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getProjectById.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/projects/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get project list - * Returns a Project JSON object - * @param page - * @param perPage - * @param kind - * @param q - * @param filter - * @param latitude Valid with kind as location - * @param longitude Valid with kind as location - * @param scope Valid with kind as location, and between 1~9 - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getProjectList(page?: number, perPage?: number, kind?: 'my_models' | 'published' | 'location', q?: string, filter?: string, latitude?: number, longitude?: number, scope?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public getProjectList(page?: number, perPage?: number, kind?: 'my_models' | 'published' | 'location', q?: string, filter?: string, latitude?: number, longitude?: number, scope?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getProjectList(page?: number, perPage?: number, kind?: 'my_models' | 'published' | 'location', q?: string, filter?: string, latitude?: number, longitude?: number, scope?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getProjectList(page?: number, perPage?: number, kind?: 'my_models' | 'published' | 'location', q?: string, filter?: string, latitude?: number, longitude?: number, scope?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (page !== undefined && page !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - } - if (perPage !== undefined && perPage !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - perPage, 'per_page'); - } - if (kind !== undefined && kind !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - kind, 'kind'); - } - if (q !== undefined && q !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - q, 'q'); - } - if (filter !== undefined && filter !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - filter, 'filter'); - } - if (latitude !== undefined && latitude !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - latitude, 'latitude'); - } - if (longitude !== undefined && longitude !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - longitude, 'longitude'); - } - if (scope !== undefined && scope !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - scope, 'scope'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/projects`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Update project - * @param id Project id - * @param name User ID - * @param address Address - * @param longitude - * @param latitude - * @param meta - * @param thumbnail Project thumbnail - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateProject(id: number, name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, thumbnail?: Blob, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public updateProject(id: number, name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, thumbnail?: Blob, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public updateProject(id: number, name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, thumbnail?: Blob, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public updateProject(id: number, name?: string, address?: string, longitude?: number, latitude?: number, meta?: string, thumbnail?: Blob, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateProject.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - localVarUseForm = canConsumeForm; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (name !== undefined) { - localVarFormParams = localVarFormParams.append('name', name) as any || localVarFormParams; - } - if (address !== undefined) { - localVarFormParams = localVarFormParams.append('address', address) as any || localVarFormParams; - } - if (longitude !== undefined) { - localVarFormParams = localVarFormParams.append('longitude', longitude) as any || localVarFormParams; - } - if (latitude !== undefined) { - localVarFormParams = localVarFormParams.append('latitude', latitude) as any || localVarFormParams; - } - if (meta !== undefined) { - localVarFormParams = localVarFormParams.append('meta', meta) as any || localVarFormParams; - } - if (thumbnail !== undefined) { - localVarFormParams = localVarFormParams.append('thumbnail', thumbnail) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/projects/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/configuration.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/configuration.ts deleted file mode 100644 index d38a4c153f2..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/configuration.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; -import { Param } from './param'; - -export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: {[ key: string ]: string | (() => string | undefined)}; -} - -export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: {[ key: string ]: string | (() => string | undefined)}; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; - } - else { - this.encodeParam = param => this.defaultEncodeParam(param); - } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; - } - else { - this.credentials = {}; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; - } - - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; - } - - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } - - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' - ? value() - : value; - } - - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! - - const value = param.dataFormat === 'date-time' - ? (param.value as Date).toISOString() - : param.value; - - return encodeURIComponent(String(value)); - } -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/encoder.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/encoder.ts deleted file mode 100644 index 138c4d5cf2c..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/encoder.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; - -/** - * Custom HttpParameterCodec - * Workaround for https://github.com/angular/angular/issues/18261 - */ -export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/git_push.sh b/src/test/resources/integrationtests/typescript/array-and-object-expected/git_push.sh deleted file mode 100644 index 67b52e22d7f..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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-petstore-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="" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts deleted file mode 100644 index 104dd3d21e3..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; -export * from './param'; diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts deleted file mode 100644 index e26fdb67136..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/models.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './projectEntity'; -export * from './projectEntityLocation'; -export * from './projectList'; diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntity.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntity.ts deleted file mode 100644 index 4c4e76e2e65..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntity.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Cupix API - * No description provided (generated by Openapi Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) - * - * The version of the OpenAPI document: 1.7.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 { ProjectEntityLocation } from './projectEntityLocation'; - - -export interface ProjectEntity { - id: number; - kind?: ProjectEntity.KindEnum; - thumbnail_url?: string; - name?: string; - state?: string; - meta?: object; - location?: ProjectEntityLocation; - created_at?: string; - updated_at?: string; - published_at?: string; -} -export namespace ProjectEntity { - export type KindEnum = 'project'; - export const KindEnum = { - Project: 'project' as KindEnum - }; -} - - diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntityLocation.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntityLocation.ts deleted file mode 100644 index c8510b61009..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectEntityLocation.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Cupix API - * No description provided (generated by Openapi Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) - * - * The version of the OpenAPI document: 1.7.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 ProjectEntityLocation { - lat?: number; - lon?: number; -} - diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectList.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectList.ts deleted file mode 100644 index 5ae19ce8674..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/model/projectList.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Cupix API - * No description provided (generated by Openapi Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) - * - * The version of the OpenAPI document: 1.7.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 { ProjectEntity } from './projectEntity'; - - -export interface ProjectList { - contents: Array; -} - diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/ng-package.json b/src/test/resources/integrationtests/typescript/array-and-object-expected/ng-package.json deleted file mode 100644 index 3b17900dc9c..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "index.ts" - } -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json b/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json deleted file mode 100644 index f813e8e5f7a..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "arrayAndAnyTest", - "version": "1.0.2", - "description": "OpenAPI client for arrayAndAnyTest", - "author": "OpenAPI-Generator Contributors", - "repository": { - "type": "git", - "url": "https:////.git" - }, - "keywords": [ - "openapi-client", - "openapi-generator" - ], - "license": "Unlicense", - "scripts": { - "build": "ng-packagr -p ng-package.json" - }, - "peerDependencies": { - "@angular/core": "^14.0.5", - "rxjs": "^7.5.5" - }, - "devDependencies": { - "@angular/common": "^14.0.5", - "@angular/compiler": "^14.0.5", - "@angular/compiler-cli": "^14.0.5", - "@angular/core": "^14.0.5", - "@angular/platform-browser": "^14.0.5", - "ng-packagr": "^14.0.2", - "reflect-metadata": "^0.1.3", - "rxjs": "^7.5.5", - "tsickle": "^0.46.3", - "typescript": ">=4.6.0 <=4.8.0", - "zone.js": "^0.11.5" - }} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/param.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/param.ts deleted file mode 100644 index 78a2d20a643..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/param.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Standard parameter styles defined by OpenAPI spec - */ -export type StandardParamStyle = - | 'matrix' - | 'label' - | 'form' - | 'simple' - | 'spaceDelimited' - | 'pipeDelimited' - | 'deepObject' - ; - -/** - * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. - */ -export type ParamStyle = StandardParamStyle | string; - -/** - * Standard parameter locations defined by OpenAPI spec - */ -export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; - -/** - * Standard types as defined in OpenAPI Specification: Data Types - */ -export type StandardDataType = - | "integer" - | "number" - | "boolean" - | "string" - | "object" - | "array" - ; - -/** - * Standard {@link DataType}s plus your own types/classes. - */ -export type DataType = StandardDataType | string; - -/** - * Standard formats as defined in OpenAPI Specification: Data Types - */ -export type StandardDataFormat = - | "int32" - | "int64" - | "float" - | "double" - | "byte" - | "binary" - | "date" - | "date-time" - | "password" - ; - -export type DataFormat = StandardDataFormat | string; - -/** - * The parameter to encode. - */ -export interface Param { - name: string; - value: unknown; - in: ParamLocation; - style: ParamStyle, - explode: boolean; - dataType: DataType; - dataFormat: DataFormat | undefined; -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json deleted file mode 100644 index c01ebe255d4..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "outDir": "./dist", - "noLib": false, - "declaration": true, - "lib": [ "es6", "dom" ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist" - ], - "filesGlob": [ - "./model/*.ts", - "./api/*.ts" - ] -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-expected/variables.ts b/src/test/resources/integrationtests/typescript/array-and-object-expected/variables.ts deleted file mode 100644 index 6fe58549f39..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-expected/variables.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InjectionToken } from '@angular/core'; - -export const BASE_PATH = new InjectionToken('basePath'); -export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} diff --git a/src/test/resources/integrationtests/typescript/array-and-object-spec.json b/src/test/resources/integrationtests/typescript/array-and-object-spec.json deleted file mode 100644 index 366cbb9cb39..00000000000 --- a/src/test/resources/integrationtests/typescript/array-and-object-spec.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "swagger": "2.0", - "info": - { - "version": "1.7.0", - "title": "Cupix API", - "contact": - { - "name": "inska.lee@cupix.com" - } - }, - "basePath": "/v1", - "consumes": - [ - "application/json" - ], - "produces": - [ - "application/json" - ], - "schemes": - [ - "https" - ], - "paths": - { - "/projects": - { - "post": - { - "tags": - [ - "Project" - ], - "summary": "Create a Project", - "operationId": "create_project", - "description": "Creates an empty Project", - "consumes": - [ - "application/x-www-form-urlencoded" - ], - "produces": - [ - "application/json" - ], - "parameters": - [ - - { - "name": "name", - "type": "string", - "in": "formData" - }, - - { - "name": "address", - "type": "string", - "in": "formData" - }, - - { - "name": "longitude", - "type": "number", - "format": "float", - "in": "formData" - }, - - { - "name": "latitude", - "type": "number", - "format": "float", - "in": "formData" - }, - - { - "name": "meta", - "type": "string", - "in": "formData" - } - ], - "responses": - { - "200": - { - "description": "Project information", - "schema": - { - "$ref": "#/definitions/ProjectEntity" - } - }, - "400": - { - "description": "Bad Request", - "schema": - { - "$ref": "#/definitions/Error" - } - }, - "401": - { - "description": "Unauthorized request" - }, - "403": - { - "description": "Forbidden" - }, - "404": - { - "description": "Project not found" - } - } - }, - "get": - { - "tags": - [ - "Project" - ], - "summary": "Get project list", - "operationId": "get_project_list", - "description": "Returns a Project JSON object", - "produces": - [ - "application/json" - ], - "security": - [ - - { - "key": - [ - - ] - }, - - { - "token": - [ - - ] - } - ], - "parameters": - [ - - { - "name": "page", - "type": "integer", - "format": "int32", - "in": "query" - }, - - { - "name": "per_page", - "type": "integer", - "format": "int32", - "in": "query" - }, - - { - "name": "kind", - "type": "string", - "in": "query", - "enum": - [ - "my_models", - "published", - "location" - ] - }, - - { - "name": "q", - "type": "string", - "in": "query" - }, - - { - "name": "filter", - "type": "string", - "in": "query" - }, - - { - "name": "latitude", - "in": "query", - "type": "number", - "format": "float", - "description": "Valid with kind as location" - }, - - { - "name": "longitude", - "in": "query", - "type": "number", - "format": "float", - "description": "Valid with kind as location" - }, - - { - "name": "scope", - "in": "query", - "type": "integer", - "description": "Valid with kind as location, and between 1~9" - } - ], - "responses": - { - "200": - { - "description": "Project list", - "schema": - { - "$ref": "#/definitions/ProjectList" - } - }, - "400": - { - "description": "Bad Request", - "schema": - { - "$ref": "#/definitions/Error" - } - }, - "401": - { - "description": "Unauthorized request" - }, - "403": - { - "description": "Forbidden" - }, - "404": - { - "description": "Project not found" - } - } - } - }, - "/projects/{id}": - { - "get": - { - "tags": - [ - "Project" - ], - "summary": "Get a Project", - "operationId": "get_project_by_id", - "description": "Returns a Project JSON object", - "produces": - [ - "application/json" - ], - "parameters": - [ - - { - "name": "id", - "in": "path", - "description": "Project id", - "required": true, - "type": "integer", - "format": "int32" - } - ], - "responses": - { - "200": - { - "description": "Project information", - "schema": - { - "$ref": "#/definitions/ProjectEntity" - } - }, - "400": - { - "description": "Bad Request", - "schema": - { - "$ref": "#/definitions/Error" - } - }, - "401": - { - "description": "Unauthorized request" - }, - "403": - { - "description": "Forbidden" - }, - "404": - { - "description": "Project not found" - } - } - }, - "put": - { - "tags": - [ - "Project" - ], - "summary": "Update project", - "operationId": "update_project", - "consumes": - [ - "multipart/form-data" - ], - "produces": - [ - "application/json" - ], - "parameters": - [ - - { - "name": "id", - "in": "path", - "description": "Project id", - "required": true, - "type": "integer", - "format": "int32" - }, - - { - "name": "name", - "in": "formData", - "description": "User ID", - "type": "string" - }, - - { - "name": "address", - "in": "formData", - "description": "Address", - "type": "string" - }, - - { - "name": "longitude", - "type": "number", - "format": "float", - "in": "formData" - }, - - { - "name": "latitude", - "type": "number", - "format": "float", - "in": "formData" - }, - - { - "name": "meta", - "type": "string", - "in": "formData" - }, - - { - "name": "thumbnail", - "in": "formData", - "description": "Project thumbnail", - "type": "file" - } - ], - "responses": - { - "200": - { - "description": "Project information", - "schema": - { - "$ref": "#/definitions/ProjectEntity" - } - }, - "400": - { - "description": "Bad Request", - "schema": - { - "$ref": "#/definitions/Error" - } - }, - "401": - { - "description": "Unauthorized request" - }, - "403": - { - "description": "Forbidden" - }, - "404": - { - "description": "Project not found" - } - } - }, - "delete": - { - "tags": - [ - "Project" - ], - "summary": "Delete a Project", - "operationId": "delete_project_by_id", - "description": "Returns a Project JSON object", - "produces": - [ - "application/json" - ], - "parameters": - [ - - { - "name": "id", - "in": "path", - "description": "Project id", - "required": true, - "type": "integer", - "format": "int32" - } - ], - "security": - [ - - { - "key": - [ - - ] - }, - - { - "token": - [ - - ] - } - ], - "responses": - { - "200": - { - "description": "Empty" - }, - "204": - { - "description": "Deleted" - }, - "400": - { - "description": "Bad Request", - "schema": - { - "$ref": "#/definitions/Error" - } - }, - "401": - { - "description": "Unauthorized request" - }, - "403": - { - "description": "Forbidden" - }, - "404": - { - "description": "Project not found" - } - } - } - } - }, - "definitions": - { - "ProjectList": - { - "type": "object", - "required": - [ - "contents" - ], - "properties": - { - "contents": - { - "type": "array", - "items": - { - "$ref": "#/definitions/ProjectEntity" - } - } - } - }, - "ProjectEntity": - { - "type": "object", - "required": - [ - "id" - ], - "properties": - { - "id": - { - "type": "integer", - "format": "int32" - }, - "kind": - { - "type": "string", - "enum": - [ - "project" - ] - }, - "thumbnail_url": - { - "type": "string" - }, - "name": - { - "type": "string" - }, - "state": - { - "type": "string" - }, - "meta": - { - "type": "object" - }, - "location": - { - "type": "object", - "properties": - { - "lat": - { - "type": "number", - "format": "float" - }, - "lon": - { - "type": "number", - "format": "float" - } - } - }, - "created_at": - { - "type": "string", - "format": "date-time" - }, - "updated_at": - { - "type": "string", - "format": "date-time" - }, - "published_at": - { - "type": "string", - "format": "date-time" - } - } - } - } -} \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/.gitignore b/src/test/resources/integrationtests/typescript/custom-path-params-expected/.gitignore deleted file mode 100644 index 149b5765472..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/README.md b/src/test/resources/integrationtests/typescript/custom-path-params-expected/README.md deleted file mode 100644 index 3dbfaf6cd40..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/README.md +++ /dev/null @@ -1,226 +0,0 @@ -## custom-path-params-integration-test@1.0.3 - -### Building - -To install the required dependencies and to build the typescript sources run: -``` -npm install -npm run build -``` - -### publishing - -First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!) - -### consuming - -Navigate to the folder of your consuming project and run one of next commands. - -_published:_ - -``` -npm install custom-path-params-integration-test@1.0.3 --save -``` - -_without publishing (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save -``` - -_It's important to take the tgz file, otherwise you'll get trouble with links on windows_ - -_using `npm link`:_ - -In PATH_TO_GENERATED_PACKAGE/dist: -``` -npm link -``` - -In your project: -``` -npm link custom-path-params-integration-test -``` - -__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. -Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. -Published packages are not effected by this issue. - - -#### General usage - -In your Angular project: - - -``` -// without configuring providers -import { ApiModule } from 'custom-path-params-integration-test'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers -import { ApiModule, Configuration, ConfigurationParameters } from 'custom-path-params-integration-test'; - -export function apiConfigFactory (): Configuration { - const params: ConfigurationParameters = { - // set configuration parameters here. - } - return new Configuration(params); -} - -@NgModule({ - imports: [ ApiModule.forRoot(apiConfigFactory) ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers with an authentication service that manages your access tokens -import { ApiModule, Configuration } from 'custom-path-params-integration-test'; - -@NgModule({ - imports: [ ApiModule ], - declarations: [ AppComponent ], - providers: [ - { - provide: Configuration, - useFactory: (authService: AuthService) => new Configuration( - { - basePath: environment.apiUrl, - accessToken: authService.getAccessToken.bind(authService) - } - ), - deps: [AuthService], - multi: false - } - ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -import { DefaultApi } from 'custom-path-params-integration-test'; - -export class AppComponent { - constructor(private apiGateway: DefaultApi) { } -} -``` - -Note: The ApiModule is restricted to being instantiated once app wide. -This is to ensure that all services are treated as singletons. - -#### Using multiple OpenAPI files / APIs / ApiModules -In order to use multiple `ApiModules` generated from different OpenAPI files, -you can create an alias name when importing the modules -in order to avoid naming conflicts: -``` -import { ApiModule } from 'my-api-path'; -import { ApiModule as OtherApiModule } from 'my-other-api-path'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - OtherApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ] -}) -export class AppModule { - -} -``` - - -### Set service base path -If different than the generated base path, during app bootstrap, you can provide the base path to your service. - -``` -import { BASE_PATH } from 'custom-path-params-integration-test'; - -bootstrap(AppComponent, [ - { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, -]); -``` -or - -``` -import { BASE_PATH } from 'custom-path-params-integration-test'; - -@NgModule({ - imports: [], - declarations: [ AppComponent ], - providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - - -#### Using @angular/cli -First extend your `src/environments/*.ts` files by adding the corresponding base path: - -``` -export const environment = { - production: false, - API_BASE_PATH: 'http://127.0.0.1:8080' -}; -``` - -In the src/app/app.module.ts: -``` -import { BASE_PATH } from 'custom-path-params-integration-test'; -import { environment } from '../environments/environment'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ ], - providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], - bootstrap: [ AppComponent ] -}) -export class AppModule { } -``` - -### Customizing path parameter encoding - -Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple' -and Dates for format 'date-time' are encoded correctly. - -Other styles (e.g. "matrix") are not that easy to encode -and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]). - -To implement your own parameter encoding (or call another library), -pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object -(see [General Usage](#general-usage) above). - -Example value for use in your Configuration-Provider: -```typescript -new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}) -``` - -[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations -[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values -[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.module.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.module.ts deleted file mode 100644 index 5dcf060157a..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; - -import { MatrixParamsService } from './api/matrixParams.service'; - -@NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [] -}) -export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - constructor( @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/api.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/api.ts deleted file mode 100644 index b6cf2e7c9cd..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/api.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './matrixParams.service'; -import { MatrixParamsService } from './matrixParams.service'; -export const APIS = [MatrixParamsService]; diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/matrixParams.service.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/matrixParams.service.ts deleted file mode 100644 index 42f3cbcbdd0..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/api/matrixParams.service.ts +++ /dev/null @@ -1,306 +0,0 @@ -/** - * Path Parameter Stuff - * This API shows the usage of various path parameter styles - * - * 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. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { ComplexParams } from '../model/complexParams'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class MatrixParamsService { - - protected basePath = 'http://localhost'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * @param matrixParamExploded - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public complexMatrixParamExploded(matrixParamExploded?: ComplexParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public complexMatrixParamExploded(matrixParamExploded?: ComplexParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public complexMatrixParamExploded(matrixParamExploded?: ComplexParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public complexMatrixParamExploded(matrixParamExploded?: ComplexParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/complexMatrixParamExploded${this.configuration.encodeParam({name: "matrixParamExploded", value: matrixParamExploded, in: "path", style: "matrix", explode: true, dataType: "ComplexParams", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @param matrixParamFlat - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public complexMatrixParamFlat(matrixParamFlat?: ComplexParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public complexMatrixParamFlat(matrixParamFlat?: ComplexParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public complexMatrixParamFlat(matrixParamFlat?: ComplexParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public complexMatrixParamFlat(matrixParamFlat?: ComplexParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/complexMatrixParamFlat${this.configuration.encodeParam({name: "matrixParamFlat", value: matrixParamFlat, in: "path", style: "matrix", explode: false, dataType: "ComplexParams", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @param plainParamFlat - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public plainMatrixParamFlat(plainParamFlat?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public plainMatrixParamFlat(plainParamFlat?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public plainMatrixParamFlat(plainParamFlat?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public plainMatrixParamFlat(plainParamFlat?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/plainMatrixParamFlat${this.configuration.encodeParam({name: "plainParamFlat", value: plainParamFlat, in: "path", style: "matrix", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @param dateTimeParamFlat - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public plainMatrixParamFlat_1(dateTimeParamFlat?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public plainMatrixParamFlat_1(dateTimeParamFlat?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public plainMatrixParamFlat_1(dateTimeParamFlat?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public plainMatrixParamFlat_1(dateTimeParamFlat?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/date-timeMatrixParamFlat${this.configuration.encodeParam({name: "dateTimeParamFlat", value: dateTimeParamFlat, in: "path", style: "matrix", explode: false, dataType: "string", dataFormat: "date-time"})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/configuration.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/configuration.ts deleted file mode 100644 index d38a4c153f2..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/configuration.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; -import { Param } from './param'; - -export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: {[ key: string ]: string | (() => string | undefined)}; -} - -export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: {[ key: string ]: string | (() => string | undefined)}; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; - } - else { - this.encodeParam = param => this.defaultEncodeParam(param); - } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; - } - else { - this.credentials = {}; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; - } - - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; - } - - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } - - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' - ? value() - : value; - } - - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! - - const value = param.dataFormat === 'date-time' - ? (param.value as Date).toISOString() - : param.value; - - return encodeURIComponent(String(value)); - } -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/encoder.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/encoder.ts deleted file mode 100644 index 138c4d5cf2c..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/encoder.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; - -/** - * Custom HttpParameterCodec - * Workaround for https://github.com/angular/angular/issues/18261 - */ -export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/git_push.sh b/src/test/resources/integrationtests/typescript/custom-path-params-expected/git_push.sh deleted file mode 100644 index 67b52e22d7f..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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-petstore-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="" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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/src/test/resources/integrationtests/typescript/custom-path-params-expected/index.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/index.ts deleted file mode 100644 index 104dd3d21e3..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; -export * from './param'; diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/complexParams.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/complexParams.ts deleted file mode 100644 index bed1db7a6ee..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/complexParams.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Path Parameter Stuff - * This API shows the usage of various path parameter styles - * - * 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 ComplexParams { - key?: string; - value?: number; -} - diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/models.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/models.ts deleted file mode 100644 index 329693285d0..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/model/models.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './complexParams'; diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/ng-package.json b/src/test/resources/integrationtests/typescript/custom-path-params-expected/ng-package.json deleted file mode 100644 index 3b17900dc9c..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "index.ts" - } -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/package.json b/src/test/resources/integrationtests/typescript/custom-path-params-expected/package.json deleted file mode 100644 index c68cbf4ebe2..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "custom-path-params-integration-test", - "version": "1.0.3", - "description": "OpenAPI client for custom-path-params-integration-test", - "author": "OpenAPI-Generator Contributors", - "repository": { - "type": "git", - "url": "https:////.git" - }, - "keywords": [ - "openapi-client", - "openapi-generator" - ], - "license": "Unlicense", - "scripts": { - "build": "ng-packagr -p ng-package.json" - }, - "peerDependencies": { - "@angular/core": "^14.0.5", - "rxjs": "^7.5.5" - }, - "devDependencies": { - "@angular/common": "^14.0.5", - "@angular/compiler": "^14.0.5", - "@angular/compiler-cli": "^14.0.5", - "@angular/core": "^14.0.5", - "@angular/platform-browser": "^14.0.5", - "ng-packagr": "^14.0.2", - "reflect-metadata": "^0.1.3", - "rxjs": "^7.5.5", - "tsickle": "^0.46.3", - "typescript": ">=4.6.0 <=4.8.0", - "zone.js": "^0.11.5" - }} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/param.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/param.ts deleted file mode 100644 index 78a2d20a643..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/param.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Standard parameter styles defined by OpenAPI spec - */ -export type StandardParamStyle = - | 'matrix' - | 'label' - | 'form' - | 'simple' - | 'spaceDelimited' - | 'pipeDelimited' - | 'deepObject' - ; - -/** - * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. - */ -export type ParamStyle = StandardParamStyle | string; - -/** - * Standard parameter locations defined by OpenAPI spec - */ -export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; - -/** - * Standard types as defined in OpenAPI Specification: Data Types - */ -export type StandardDataType = - | "integer" - | "number" - | "boolean" - | "string" - | "object" - | "array" - ; - -/** - * Standard {@link DataType}s plus your own types/classes. - */ -export type DataType = StandardDataType | string; - -/** - * Standard formats as defined in OpenAPI Specification: Data Types - */ -export type StandardDataFormat = - | "int32" - | "int64" - | "float" - | "double" - | "byte" - | "binary" - | "date" - | "date-time" - | "password" - ; - -export type DataFormat = StandardDataFormat | string; - -/** - * The parameter to encode. - */ -export interface Param { - name: string; - value: unknown; - in: ParamLocation; - style: ParamStyle, - explode: boolean; - dataType: DataType; - dataFormat: DataFormat | undefined; -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/custom-path-params-expected/tsconfig.json deleted file mode 100644 index c01ebe255d4..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "outDir": "./dist", - "noLib": false, - "declaration": true, - "lib": [ "es6", "dom" ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist" - ], - "filesGlob": [ - "./model/*.ts", - "./api/*.ts" - ] -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-expected/variables.ts b/src/test/resources/integrationtests/typescript/custom-path-params-expected/variables.ts deleted file mode 100644 index 6fe58549f39..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-expected/variables.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InjectionToken } from '@angular/core'; - -export const BASE_PATH = new InjectionToken('basePath'); -export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} diff --git a/src/test/resources/integrationtests/typescript/custom-path-params-spec.json b/src/test/resources/integrationtests/typescript/custom-path-params-spec.json deleted file mode 100644 index f758f4c3c39..00000000000 --- a/src/test/resources/integrationtests/typescript/custom-path-params-spec.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "Path Parameter Stuff", - "description": "This API shows the usage of various path parameter styles", - "version": "1.0.0" - }, - "paths": { - "/complexMatrixParamExploded{matrixParamExploded}": { - "parameters": [ - { - "name": "matrixParamExploded", - "in": "path", - "style": "matrix", - "explode": true, - "required": false, - "schema": { - "$ref": "#/components/schemas/ComplexParams" - } - } - ], - "put": { - "tags": [ - "MatrixParams" - ], - "operationId": "complexMatrixParamExploded", - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/complexMatrixParamFlat{matrixParamFlat}": { - "parameters": [ - { - "name": "matrixParamFlat", - "in": "path", - "style": "matrix", - "explode": false, - "required": false, - "schema": { - "$ref": "#/components/schemas/ComplexParams" - } - } - ], - "put": { - "tags": [ - "MatrixParams" - ], - "operationId": "complexMatrixParamFlat", - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/plainMatrixParamFlat{plainParamFlat}": { - "parameters": [ - { - "name": "plainParamFlat", - "in": "path", - "style": "matrix", - "explode": false, - "required": false, - "schema": { - "$ref": "#/components/schemas/PlainParam" - } - } - ], - "put": { - "tags": [ - "MatrixParams" - ], - "operationId": "plainMatrixParamFlat", - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/date-timeMatrixParamFlat{dateTimeParamFlat}": { - "parameters": [ - { - "name": "dateTimeParamFlat", - "in": "path", - "style": "matrix", - "explode": false, - "required": false, - "schema": { - "type": "string", - "format": "date-time" - } - } - ], - "put": { - "tags": [ - "MatrixParams" - ], - "operationId": "plainMatrixParamFlat", - "responses": { - "200": { - "description": "OK" - } - } - } - } - }, - "components": { - "schemas": { - "PlainParam": { - "type": "string" - }, - "ComplexParams": { - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "number", - "format": "int64" - } - } - } - } - } -} diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/.gitignore b/src/test/resources/integrationtests/typescript/node-es5-expected/.gitignore deleted file mode 100644 index 35e2fb2b02e..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -wwwroot/*.js -node_modules -typings diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/.openapi-generator-ignore b/src/test/resources/integrationtests/typescript/node-es5-expected/.openapi-generator-ignore deleted file mode 100644 index deed424f8a1..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# Swagger Codegen Ignore -# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen - -# 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 Swagger Codegen 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/src/test/resources/integrationtests/typescript/node-es5-expected/LICENSE b/src/test/resources/integrationtests/typescript/node-es5-expected/LICENSE deleted file mode 100644 index 3f4d322ebd7..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/api.ts b/src/test/resources/integrationtests/typescript/node-es5-expected/api.ts deleted file mode 100644 index 76bf4cba40a..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/api.ts +++ /dev/null @@ -1,637 +0,0 @@ -/** - * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import request = require('request'); -import http = require('http'); -import Promise = require('bluebird'); - -let defaultBasePath = 'http://petstore.swagger.io/v1'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ - -export class Category { - 'id': number; - 'name': string; -} - -export class Pet { - 'id': number; - 'category': Category; - 'name': string; -} - - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: request.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(requestOptions: request.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: request.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header") { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string; - - applyToRequest(requestOptions: request.Options): void { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } -} - -export class VoidAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(requestOptions: request.Options): void { - // Do nothing - } -} - -export enum PetApiApiKeys { -} - -export class PetApi { - protected basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - public setApiKey(key: PetApiApiKeys, value: string) { - this.authentications[PetApiApiKeys[key]].apiKey = value; - } - private extendObj(objA: T1, objB: T2) { - for(let key in objB){ - if(objB.hasOwnProperty(key)){ - objA[key] = objB[key]; - } - } - return objA; - } - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - */ - public addPet (body?: Pet) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: body, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - */ - public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - - headerParams['api_key'] = apiKey; - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'DELETE', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - public getPetById (petId: number) : Promise<{ response: http.IncomingMessage; body: Pet; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Pet; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - */ - public updatePet (body?: Pet) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'PUT', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: body, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - */ - public updatePetWithForm (petId: string, name?: string, status?: string) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - - let useFormData = false; - - if (name !== undefined) { - formParams['name'] = name; - } - - if (status !== undefined) { - formParams['status'] = status; - } - - let requestOptions: request.Options = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum StoreApiApiKeys { -} - -export class StoreApi { - protected basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - public setApiKey(key: StoreApiApiKeys, value: string) { - this.authentications[StoreApiApiKeys[key]].apiKey = value; - } - private extendObj(objA: T1, objB: T2) { - for(let key in objB){ - if(objB.hasOwnProperty(key)){ - objA[key] = objB[key]; - } - } - return objA; - } - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - */ - public deleteOrder (orderId: string) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'DELETE', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - */ - public getInventory () : Promise<{ response: http.IncomingMessage; body: { [key: string]: number; }; }> { - const localVarPath = this.basePath + '/store/inventory'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: { [key: string]: number; }; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - */ - public getOrderById (orderId: string) : Promise<{ response: http.IncomingMessage; body: Order; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Order; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - */ - public placeOrder (body?: Order) : Promise<{ response: http.IncomingMessage; body: Order; }> { - const localVarPath = this.basePath + '/store/order'; - let queryParameters: any = {}; - let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - let useFormData = false; - - let requestOptions: request.Options = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: body, - }; - - this.authentications.default.applyToRequest(requestOptions); - - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions).formData = formParams; - } else { - requestOptions.form = formParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Order; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/git_push.sh b/src/test/resources/integrationtests/typescript/node-es5-expected/git_push.sh deleted file mode 100644 index 484e8cc0033..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${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://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/package.json b/src/test/resources/integrationtests/typescript/node-es5-expected/package.json deleted file mode 100644 index e146042b7ed..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "node-es6-test", - "version": "1.0.3", - "description": "NodeJS client for node-es6-test", - "repository": "/", - "main": "api.js", - "scripts": { - "postinstall": "typings install", - "clean": "rm -Rf node_modules/ typings/ *.js", - "build": "tsc", - "test": "npm run build && node client.js" - }, - "author": "Swagger Codegen Contributors", - "license": "Apache-2.0", - "dependencies": { - "bluebird": "^3.3.5", - "request": "^2.72.0" - }, - "devDependencies": { - "typescript": "^4.0", - "typings": "^0.8.1" - } -} diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/node-es5-expected/tsconfig.json deleted file mode 100644 index 9a007e9f866..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "ES5", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "noLib": false, - "declaration": true - }, - "exclude": [ - "node_modules", - "typings/browser", - "typings/browser.d.ts" - ] -} - diff --git a/src/test/resources/integrationtests/typescript/node-es5-expected/typings.json b/src/test/resources/integrationtests/typescript/node-es5-expected/typings.json deleted file mode 100644 index 22fcebdc231..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-expected/typings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ambientDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160423143914" - }, - "dependencies": { - "bluebird": "registry:npm/bluebird#3.3.4+20160515010139", - "request": "registry:npm/request#2.69.0+20160304121250" - } -} \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/node-es5-spec.json b/src/test/resources/integrationtests/typescript/node-es5-spec.json deleted file mode 100644 index 12fde32b768..00000000000 --- a/src/test/resources/integrationtests/typescript/node-es5-spec.json +++ /dev/null @@ -1,414 +0,0 @@ -{ - "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": "/v1", - "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/json", - "application/xml" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": false, - "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/json", - "application/xml" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "Pet object that needs to be added to the store", - "required": false, - "schema": { - "$ref": "#/definitions/Pet" - } - } - ], - "responses": { - "405": { - "description": "Validation exception" - }, - "404": { - "description": "Pet not found" - }, - "400": { - "description": "Invalid ID supplied" - } - }, - "security": [ - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "pet" - ], - "summary": "Find pet by ID", - "description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", - "operationId": "getPetById", - "produces": [ - "application/json", - "application/xml" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "integer", - "format": "int64" - } - ], - "responses": { - "404": { - "description": "Pet not found" - }, - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Pet" - } - }, - "400": { - "description": "Invalid ID supplied" - } - }, - "security": [ - { - "api_key": [] - }, - { - "petstore_auth": [ - "write:pets", - "read:pets" - ] - } - ] - }, - "post": { - "tags": [ - "pet" - ], - "summary": "Updates a pet in the store with form data", - "description": "", - "operationId": "updatePetWithForm", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/json", - "application/xml" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be updated", - "required": true, - "type": "string" - }, - { - "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/json", - "application/xml" - ], - "parameters": [ - { - "name": "api_key", - "in": "header", - "description": "", - "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" - ] - } - ] - } - }, - "/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", - "application/xml" - ], - "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/json", - "application/xml" - ], - "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/json", - "application/xml" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "Order not found" - }, - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/Order" - } - }, - "400": { - "description": "Invalid ID supplied" - } - } - }, - "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/json", - "application/xml" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of the order that needs to be deleted", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "Order not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - } - } - }, - "definitions": { - "Category": { - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - } - }, - "Pet": { - "required": [ - "name", - "photoUrls" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "category": { - "$ref": "#/definitions/Category" - }, - "name": { - "type": "string", - "example": "doggie" - } - } - } - } -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.gitignore b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.gitignore deleted file mode 100644 index 35e2fb2b02e..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -wwwroot/*.js -node_modules -typings diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator-ignore b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator-ignore deleted file mode 100644 index d24a2da8ae5..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapi-json-schema-tools/openapi-json-schema-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/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator/VERSION b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator/VERSION deleted file mode 100644 index 717311e32e3..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -unset \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api.ts deleted file mode 100644 index 4b76122d807..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This is the entrypoint for the package -export * from './api/apis'; -export * from './model/models'; \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/apis.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/apis.ts deleted file mode 100644 index 8a6789d357b..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/apis.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './defaultApi'; -import { DefaultApi } from './defaultApi'; -export const APIS = [DefaultApi]; diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/defaultApi.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/defaultApi.ts deleted file mode 100644 index 5ede4e34891..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/api/defaultApi.ts +++ /dev/null @@ -1,171 +0,0 @@ -/** - * OpenAPI enums - * Tests generation of enums with open opi - * - * OpenAPI spec version: 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 localVarRequest = require('request'); -import http = require('http'); -import Promise = require('bluebird'); - -/* tslint:disable:no-unused-locals */ -import { ObjectWithEnums } from '../model/objectWithEnums'; - -import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; - -let defaultBasePath = 'http://enums.openapi3'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -export enum DefaultApiApiKeys { -} - -export class DefaultApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: DefaultApiApiKeys, value: string) { - (this.authentications as any)[DefaultApiApiKeys[key]].apiKey = value; - } - - /** - * - */ - public getObjectWithEnums (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { - const localVarPath = this.basePath + '/getobjectwithenums'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @param objectWithEnums - */ - public postObjectWithEnums (objectWithEnums: ObjectWithEnums, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/postobjectwithenums'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'objectWithEnums' is not null or undefined - if (objectWithEnums === null || objectWithEnums === undefined) { - throw new Error('Required parameter objectWithEnums was null or undefined when calling postObjectWithEnums.'); - } - - (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(objectWithEnums, "ObjectWithEnums") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/git_push.sh b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/git_push.sh deleted file mode 100644 index 90208376649..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/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-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${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://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/externalEnum.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/externalEnum.ts deleted file mode 100644 index 39d91b91632..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/externalEnum.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * OpenAPI enums - * Tests generation of enums with open opi - * - * OpenAPI spec version: 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 enum ExternalEnum { - Green = 'green', - Yellow = 'yellow' -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts deleted file mode 100644 index 896cb588758..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/models.ts +++ /dev/null @@ -1,191 +0,0 @@ -export * from './externalEnum'; -export * from './objectWithEnums'; - -import localVarRequest = require('request'); - -import { ExternalEnum } from './externalEnum'; -import { ObjectWithEnums } from './objectWithEnums'; - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -let enumsMap: {[index: string]: any} = { - "ExternalEnum": ExternalEnum, - "ObjectWithEnums.EnumInObjectEnum": ObjectWithEnums.EnumInObjectEnum, -} - -let typeMap: {[index: string]: any} = { - "ObjectWithEnums": ObjectWithEnums, -} - -export class ObjectSerializer { - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; - if(typeMap[discriminatorType]){ - return discriminatorType; // use the type given in the discriminator - } else { - return expectedType; // discriminator did not map to a type - } - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toISOString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string = ''; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/objectWithEnums.ts b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/objectWithEnums.ts deleted file mode 100644 index c6675fdafd2..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/model/objectWithEnums.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * OpenAPI enums - * Tests generation of enums with open opi - * - * OpenAPI spec version: 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 { ExternalEnum } from './externalEnum'; - -export class ObjectWithEnums { - 'enumInObject'?: ObjectWithEnums.EnumInObjectEnum; - 'externalEnum'?: ExternalEnum; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "enumInObject", - "baseName": "enumInObject", - "type": "ObjectWithEnums.EnumInObjectEnum" - }, - { - "name": "externalEnum", - "baseName": "externalEnum", - "type": "ExternalEnum" - } ]; - - static getAttributeTypeMap() { - return ObjectWithEnums.attributeTypeMap; - } -} - -export namespace ObjectWithEnums { - export enum EnumInObjectEnum { - Red = 'red', - Blue = 'blue' - } -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/package.json b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/package.json deleted file mode 100644 index b95f70f0d33..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "node-es6-test", - "version": "1.0.3", - "description": "NodeJS client for node-es6-test", - "repository": "/", - "main": "dist/api.js", - "types": "dist/api.d.ts", - "scripts": { - "clean": "rm -Rf node_modules/ *.js", - "build": "tsc", - "test": "npm run build && node dist/client.js" - }, - "author": "OpenAPI-Generator Contributors", - "license": "Unlicense", - "dependencies": { - "bluebird": "^3.5.0", - "request": "^2.81.0", - "@types/bluebird": "*", - "@types/request": "*", - "rewire": "^3.0.2" - }, - "devDependencies": { - "typescript": "^4.0", - "@types/node": "8.10.34" - } -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/tsconfig.json deleted file mode 100644 index ba2570a4bee..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-expected/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "ES5", - "strict": true, - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "noLib": false, - "declaration": true, - "lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"], - "outDir": "dist" - }, - "exclude": [ - "dist", - "node_modules" - ] -} diff --git a/src/test/resources/integrationtests/typescript/objectsWithEnums-spec.json b/src/test/resources/integrationtests/typescript/objectsWithEnums-spec.json deleted file mode 100644 index cf5b2ddd754..00000000000 --- a/src/test/resources/integrationtests/typescript/objectsWithEnums-spec.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "openapi" : "3.0.0", - "info" : { - "title" : "OpenAPI enums", - "description" : "Tests generation of enums with open opi", - "version" : "1.0.0" - }, - "servers" : [ { - "url" : "http://enums.openapi3" - } ], - "paths" : { - "/postobjectwithenums" : { - "post" : { - "operationId" : "postObjectWithEnums", - "requestBody" : { - "$ref" : "#/components/requestBodies/ObjectWithEnums" - }, - "responses" : { - "405" : { - "description" : "Invalid input" - } - } - } - }, - "/getobjectwithenums" : { - "get" : { - "operationId" : "getObjectWithEnums", - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/xml" : { - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ObjectWithEnums" - } - } - }, - "application/json" : { - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ObjectWithEnums" - } - } - } - } - } - } - } - } - }, - "components" : { - "schemas" : { - "ObjectWithEnums" : { - "type" : "object", - "properties" : { - "enumInObject" : { - "type" : "string", - "enum" : [ "red", "blue" ] - }, - "externalEnum" : { - "$ref" : "#/components/schemas/ExternalEnum" - } - } - }, - "ExternalEnum" : { - "type" : "string", - "enum" : [ "green", "yellow" ] - } - }, - "requestBodies" : { - "ObjectWithEnums" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ObjectWithEnums" - } - }, - "application/xml" : { - "schema" : { - "$ref" : "#/components/schemas/ObjectWithEnums" - } - } - }, - "required" : true - } - } - } -} \ No newline at end of file diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/.gitignore b/src/test/resources/integrationtests/typescript/petstore-expected/.gitignore deleted file mode 100644 index 149b5765472..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/README.md b/src/test/resources/integrationtests/typescript/petstore-expected/README.md deleted file mode 100644 index 5865977635e..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/README.md +++ /dev/null @@ -1,226 +0,0 @@ -## petstore-integration-test@1.0.3 - -### Building - -To install the required dependencies and to build the typescript sources run: -``` -npm install -npm run build -``` - -### publishing - -First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!) - -### consuming - -Navigate to the folder of your consuming project and run one of next commands. - -_published:_ - -``` -npm install petstore-integration-test@1.0.3 --save -``` - -_without publishing (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save -``` - -_It's important to take the tgz file, otherwise you'll get trouble with links on windows_ - -_using `npm link`:_ - -In PATH_TO_GENERATED_PACKAGE/dist: -``` -npm link -``` - -In your project: -``` -npm link petstore-integration-test -``` - -__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. -Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. -Published packages are not effected by this issue. - - -#### General usage - -In your Angular project: - - -``` -// without configuring providers -import { ApiModule } from 'petstore-integration-test'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers -import { ApiModule, Configuration, ConfigurationParameters } from 'petstore-integration-test'; - -export function apiConfigFactory (): Configuration { - const params: ConfigurationParameters = { - // set configuration parameters here. - } - return new Configuration(params); -} - -@NgModule({ - imports: [ ApiModule.forRoot(apiConfigFactory) ], - declarations: [ AppComponent ], - providers: [], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -// configuring providers with an authentication service that manages your access tokens -import { ApiModule, Configuration } from 'petstore-integration-test'; - -@NgModule({ - imports: [ ApiModule ], - declarations: [ AppComponent ], - providers: [ - { - provide: Configuration, - useFactory: (authService: AuthService) => new Configuration( - { - basePath: environment.apiUrl, - accessToken: authService.getAccessToken.bind(authService) - } - ), - deps: [AuthService], - multi: false - } - ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - -``` -import { DefaultApi } from 'petstore-integration-test'; - -export class AppComponent { - constructor(private apiGateway: DefaultApi) { } -} -``` - -Note: The ApiModule is restricted to being instantiated once app wide. -This is to ensure that all services are treated as singletons. - -#### Using multiple OpenAPI files / APIs / ApiModules -In order to use multiple `ApiModules` generated from different OpenAPI files, -you can create an alias name when importing the modules -in order to avoid naming conflicts: -``` -import { ApiModule } from 'my-api-path'; -import { ApiModule as OtherApiModule } from 'my-other-api-path'; -import { HttpClientModule } from '@angular/common/http'; - -@NgModule({ - imports: [ - ApiModule, - OtherApiModule, - // make sure to import the HttpClientModule in the AppModule only, - // see https://github.com/angular/angular/issues/20575 - HttpClientModule - ] -}) -export class AppModule { - -} -``` - - -### Set service base path -If different than the generated base path, during app bootstrap, you can provide the base path to your service. - -``` -import { BASE_PATH } from 'petstore-integration-test'; - -bootstrap(AppComponent, [ - { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, -]); -``` -or - -``` -import { BASE_PATH } from 'petstore-integration-test'; - -@NgModule({ - imports: [], - declarations: [ AppComponent ], - providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], - bootstrap: [ AppComponent ] -}) -export class AppModule {} -``` - - -#### Using @angular/cli -First extend your `src/environments/*.ts` files by adding the corresponding base path: - -``` -export const environment = { - production: false, - API_BASE_PATH: 'http://127.0.0.1:8080' -}; -``` - -In the src/app/app.module.ts: -``` -import { BASE_PATH } from 'petstore-integration-test'; -import { environment } from '../environments/environment'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ ], - providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }], - bootstrap: [ AppComponent ] -}) -export class AppModule { } -``` - -### Customizing path parameter encoding - -Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple' -and Dates for format 'date-time' are encoded correctly. - -Other styles (e.g. "matrix") are not that easy to encode -and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]). - -To implement your own parameter encoding (or call another library), -pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object -(see [General Usage](#general-usage) above). - -Example value for use in your Configuration-Provider: -```typescript -new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}) -``` - -[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations -[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values -[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/api.module.ts b/src/test/resources/integrationtests/typescript/petstore-expected/api.module.ts deleted file mode 100644 index 2afb8f64e92..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/api.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; - -import { PetService } from './api/pet.service'; -import { StoreService } from './api/store.service'; -import { UserService } from './api/user.service'; - -@NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [] -}) -export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - constructor( @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/api/api.ts b/src/test/resources/integrationtests/typescript/petstore-expected/api/api.ts deleted file mode 100644 index 8e44b64083d..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/api/api.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './pet.service'; -import { PetService } from './pet.service'; -export * from './store.service'; -import { StoreService } from './store.service'; -export * from './user.service'; -import { UserService } from './user.service'; -export const APIS = [PetService, StoreService, UserService]; diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/api/pet.service.ts b/src/test/resources/integrationtests/typescript/petstore-expected/api/pet.service.ts deleted file mode 100644 index 9613f31f3f1..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/api/pet.service.ts +++ /dev/null @@ -1,724 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { ApiResponse } from '../model/apiResponse'; -// @ts-ignore -import { Pet } from '../model/pet'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class PetService { - - protected basePath = 'http://petstore.swagger.io/v2'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * Add a new pet to the store - * @param body Pet object that needs to be added to the store - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addPet(body: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public addPet(body: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public addPet(body: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addPet.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json', - 'application/xml' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Deletes a pet - * @param petId Pet id to delete - * @param apiKey - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deletePet(petId: number, apiKey?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - - let localVarHeaders = this.defaultHeaders; - if (apiKey !== undefined && apiKey !== null) { - localVarHeaders = localVarHeaders.set('api_key', String(apiKey)); - } - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>>; - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>>; - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (status === null || status === undefined) { - throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); - } - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (status) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - [...status].join(COLLECTION_FORMATS['csv']), 'status'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public findPetsByTags(tags: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public findPetsByTags(tags: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>>; - public findPetsByTags(tags: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>>; - public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (tags === null || tags === undefined) { - throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); - } - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (tags) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - [...tags].join(COLLECTION_FORMATS['csv']), 'tags'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getPetById(petId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable; - public getPetById(petId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getPetById(petId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (api_key) required - localVarCredential = this.configuration.lookupCredential('api_key'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('api_key', localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Update an existing pet - * @param body Pet object that needs to be added to the store - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updatePet(body: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updatePet.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json', - 'application/xml' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Updates a pet in the store with form data - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/x-www-form-urlencoded' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (name !== undefined) { - localVarFormParams = localVarFormParams.append('name', name) as any || localVarFormParams; - } - if (status !== undefined) { - localVarFormParams = localVarFormParams.append('status', status) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (petstore_auth) required - localVarCredential = this.configuration.lookupCredential('petstore_auth'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - localVarUseForm = canConsumeForm; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (additionalMetadata !== undefined) { - localVarFormParams = localVarFormParams.append('additionalMetadata', additionalMetadata) as any || localVarFormParams; - } - if (file !== undefined) { - localVarFormParams = localVarFormParams.append('file', file) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/api/store.service.ts b/src/test/resources/integrationtests/typescript/petstore-expected/api/store.service.ts deleted file mode 100644 index 374f8f02e75..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/api/store.service.ts +++ /dev/null @@ -1,342 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { Order } from '../model/order'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class StoreService { - - protected basePath = 'http://petstore.swagger.io/v2'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteOrder(orderId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getInventory(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<{ [key: string]: number; }>; - public getInventory(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getInventory(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public getInventory(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarCredential: string | undefined; - // authentication (api_key) required - localVarCredential = this.configuration.lookupCredential('api_key'); - if (localVarCredential) { - localVarHeaders = localVarHeaders.set('api_key', localVarCredential); - } - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getOrderById(orderId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable; - public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Place an order for a pet - * @param body order placed for purchasing the pet - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public placeOrder(body: Order, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable; - public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling placeOrder.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/api/user.service.ts b/src/test/resources/integrationtests/typescript/petstore-expected/api/user.service.ts deleted file mode 100644 index a15f9bca62a..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/api/user.service.ts +++ /dev/null @@ -1,608 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { User } from '../model/user'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - - -@Injectable({ - providedIn: 'root' -}) -export class UserService { - - protected basePath = 'http://petstore.swagger.io/v2'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - public encoder: HttpParameterCodec; - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { - if (configuration) { - this.configuration = configuration; - } - if (typeof this.configuration.basePath !== 'string') { - if (Array.isArray(basePath) && basePath.length > 0) { - basePath = basePath[0]; - } - - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - - // @ts-ignore - private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { - if (typeof value === "object" && value instanceof Date === false) { - httpParams = this.addToHttpParamsRecursive(httpParams, value); - } else { - httpParams = this.addToHttpParamsRecursive(httpParams, value, key); - } - return httpParams; - } - - private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { - if (value == null) { - return httpParams; - } - - if (typeof value === "object") { - if (Array.isArray(value)) { - (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); - } else { - throw Error("key may not be null if value is Date"); - } - } else { - Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( - httpParams, value[k], key != null ? `${key}.${k}` : k)); - } - } else if (key != null) { - httpParams = httpParams.append(key, value); - } else { - throw Error("key may not be null if value is not object or array"); - } - return httpParams; - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public createUser(body: User, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public createUser(body: User, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUser(body: User, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUser(body: User, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling createUser.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Creates list of users with given input array - * @param body List of user object - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public createUsersWithArrayInput(body: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public createUsersWithArrayInput(body: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUsersWithArrayInput(body: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Creates list of users with given input array - * @param body List of user object - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public createUsersWithListInput(body: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public createUsersWithListInput(body: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUsersWithListInput(body: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteUser(username: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public deleteUser(username: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deleteUser(username: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling deleteUser.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getUserByName(username: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable; - public getUserByName(username: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getUserByName(username: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getUserByName.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public loginUser(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable; - public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable>; - public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable { - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling loginUser.'); - } - if (password === null || password === undefined) { - throw new Error('Required parameter password was null or undefined when calling loginUser.'); - } - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (username !== undefined && username !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - username, 'username'); - } - if (password !== undefined && password !== null) { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - password, 'password'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/xml', - 'application/json' - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Logs out current logged in user session - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public logoutUser(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public logoutUser(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public logoutUser(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public logoutUser(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateUser(username: string, body: User, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; - public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; - public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling updateUser.'); - } - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateUser.'); - } - - let localVarHeaders = this.defaultHeaders; - - let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (localVarHttpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); - } - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - let localVarHttpContext: HttpContext | undefined = options && options.context; - if (localVarHttpContext === undefined) { - localVarHttpContext = new HttpContext(); - } - - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: body, - responseType: responseType_, - withCredentials: this.configuration.withCredentials, - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts b/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts deleted file mode 100644 index 5ea92c82cb6..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; -import { Param } from './param'; - -export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: {[ key: string ]: string | (() => string | undefined)}; -} - -export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: {[ key: string ]: string | (() => string | undefined)}; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; - } - else { - this.encodeParam = param => this.defaultEncodeParam(param); - } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; - } - else { - this.credentials = {}; - } - - // init default api_key credential - if (!this.credentials['api_key']) { - this.credentials['api_key'] = () => { - if (this.apiKeys === null || this.apiKeys === undefined) { - return undefined; - } else { - return this.apiKeys['api_key'] || this.apiKeys['api_key']; - } - }; - } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; - } - - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; - } - - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } - - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' - ? value() - : value; - } - - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! - - const value = param.dataFormat === 'date-time' - ? (param.value as Date).toISOString() - : param.value; - - return encodeURIComponent(String(value)); - } -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/encoder.ts b/src/test/resources/integrationtests/typescript/petstore-expected/encoder.ts deleted file mode 100644 index 138c4d5cf2c..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/encoder.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { HttpParameterCodec } from '@angular/common/http'; - -/** - * Custom HttpParameterCodec - * Workaround for https://github.com/angular/angular/issues/18261 - */ -export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/git_push.sh b/src/test/resources/integrationtests/typescript/petstore-expected/git_push.sh deleted file mode 100644 index 67b52e22d7f..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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-petstore-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="" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - 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="" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="" - 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/src/test/resources/integrationtests/typescript/petstore-expected/index.ts b/src/test/resources/integrationtests/typescript/petstore-expected/index.ts deleted file mode 100644 index 104dd3d21e3..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; -export * from './param'; diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/apiResponse.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/apiResponse.ts deleted file mode 100644 index ca96abca935..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/apiResponse.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 ApiResponse { - code?: number; - type?: string; - message?: string; -} - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/category.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/category.ts deleted file mode 100644 index 4e435cae1db..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/category.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 Category { - id?: number; - name?: string; -} - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/models.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/models.ts deleted file mode 100644 index 8607c5dabd0..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/models.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './apiResponse'; -export * from './category'; -export * from './order'; -export * from './pet'; -export * from './tag'; -export * from './user'; diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/order.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/order.ts deleted file mode 100644 index a730d4c1757..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/order.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 Order { - id?: number; - petId?: number; - quantity?: number; - shipDate?: string; - /** - * Order Status - */ - status?: Order.StatusEnum; - complete?: boolean; -} -export namespace Order { - export type StatusEnum = 'placed' | 'approved' | 'delivered'; - export const StatusEnum = { - Placed: 'placed' as StatusEnum, - Approved: 'approved' as StatusEnum, - Delivered: 'delivered' as StatusEnum - }; -} - - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/pet.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/pet.ts deleted file mode 100644 index 284185ddd1f..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/pet.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 { Category } from './category'; -import { Tag } from './tag'; - - -export interface Pet { - id?: number; - category?: Category; - name: string; - photoUrls: Array; - tags?: Array; - /** - * pet status in the store - */ - status?: Pet.StatusEnum; -} -export namespace Pet { - export type StatusEnum = 'available' | 'pending' | 'sold'; - export const StatusEnum = { - Available: 'available' as StatusEnum, - Pending: 'pending' as StatusEnum, - Sold: 'sold' as StatusEnum - }; -} - - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/tag.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/tag.ts deleted file mode 100644 index 73dee10beb5..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/tag.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 Tag { - id?: number; - name?: string; -} - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/model/user.ts b/src/test/resources/integrationtests/typescript/petstore-expected/model/user.ts deleted file mode 100644 index b3c99357e79..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/model/user.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * 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 User { - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - */ - userStatus?: number; -} - diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/ng-package.json b/src/test/resources/integrationtests/typescript/petstore-expected/ng-package.json deleted file mode 100644 index 3b17900dc9c..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "index.ts" - } -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/package.json b/src/test/resources/integrationtests/typescript/petstore-expected/package.json deleted file mode 100644 index 685877325a2..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "petstore-integration-test", - "version": "1.0.3", - "description": "OpenAPI client for petstore-integration-test", - "author": "OpenAPI-Generator Contributors", - "repository": { - "type": "git", - "url": "https:////.git" - }, - "keywords": [ - "openapi-client", - "openapi-generator" - ], - "license": "Unlicense", - "scripts": { - "build": "ng-packagr -p ng-package.json" - }, - "peerDependencies": { - "@angular/core": "^14.0.5", - "rxjs": "^7.5.5" - }, - "devDependencies": { - "@angular/common": "^14.0.5", - "@angular/compiler": "^14.0.5", - "@angular/compiler-cli": "^14.0.5", - "@angular/core": "^14.0.5", - "@angular/platform-browser": "^14.0.5", - "ng-packagr": "^14.0.2", - "reflect-metadata": "^0.1.3", - "rxjs": "^7.5.5", - "tsickle": "^0.46.3", - "typescript": ">=4.6.0 <=4.8.0", - "zone.js": "^0.11.5" - }} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/param.ts b/src/test/resources/integrationtests/typescript/petstore-expected/param.ts deleted file mode 100644 index 78a2d20a643..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/param.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Standard parameter styles defined by OpenAPI spec - */ -export type StandardParamStyle = - | 'matrix' - | 'label' - | 'form' - | 'simple' - | 'spaceDelimited' - | 'pipeDelimited' - | 'deepObject' - ; - -/** - * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. - */ -export type ParamStyle = StandardParamStyle | string; - -/** - * Standard parameter locations defined by OpenAPI spec - */ -export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; - -/** - * Standard types as defined in OpenAPI Specification: Data Types - */ -export type StandardDataType = - | "integer" - | "number" - | "boolean" - | "string" - | "object" - | "array" - ; - -/** - * Standard {@link DataType}s plus your own types/classes. - */ -export type DataType = StandardDataType | string; - -/** - * Standard formats as defined in OpenAPI Specification: Data Types - */ -export type StandardDataFormat = - | "int32" - | "int64" - | "float" - | "double" - | "byte" - | "binary" - | "date" - | "date-time" - | "password" - ; - -export type DataFormat = StandardDataFormat | string; - -/** - * The parameter to encode. - */ -export interface Param { - name: string; - value: unknown; - in: ParamLocation; - style: ParamStyle, - explode: boolean; - dataType: DataType; - dataFormat: DataFormat | undefined; -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/tsconfig.json b/src/test/resources/integrationtests/typescript/petstore-expected/tsconfig.json deleted file mode 100644 index c01ebe255d4..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "outDir": "./dist", - "noLib": false, - "declaration": true, - "lib": [ "es6", "dom" ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist" - ], - "filesGlob": [ - "./model/*.ts", - "./api/*.ts" - ] -} diff --git a/src/test/resources/integrationtests/typescript/petstore-expected/variables.ts b/src/test/resources/integrationtests/typescript/petstore-expected/variables.ts deleted file mode 100644 index 6fe58549f39..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-expected/variables.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InjectionToken } from '@angular/core'; - -export const BASE_PATH = new InjectionToken('basePath'); -export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} diff --git a/src/test/resources/integrationtests/typescript/petstore-spec.json b/src/test/resources/integrationtests/typescript/petstore-spec.json deleted file mode 100644 index 2120a1a2f4e..00000000000 --- a/src/test/resources/integrationtests/typescript/petstore-spec.json +++ /dev/null @@ -1,1014 +0,0 @@ -{ - "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" - ] - } - ] - } - }, - "/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": true, - "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.0, - "minimum": 1.0, - "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", - "minimum": 1.0 - } - ], - "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 token 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": { - "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" - } - }, - "User": { - "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" - } - }, - "Category": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Category" - } - }, - "Tag": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - } - }, - "xml": { - "name": "Tag" - } - }, - "ApiResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "type": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "Pet": { - "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" - } - } - } -}