Unverified Commit 7bf792a3 authored by sforst's avatar sforst Committed by GitHub
Browse files

[typescript-axios] handle uniqueItems in query and header parameters (#8965)


* [typescript-axios] handle uniqueItems in query and header parameters

add endpoint /fake/test-unique-paramters to petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml for demonstration

* update samples

* [typescript-axios] update samples

Co-authored-by: default avatarWilliam Cheng <wing328hk@gmail.com>
parent 57e44e17
master 4brunu-feature/update-ci 7.0.x MathiasDierickx-add-missing-configureawaits-for-csharp-netcore SanjayMarreddi-fix_cpp_rest_sdk aharonha-issue-13393 c_trigger_alert cherrypick-13815 circleci-enhance cleanup-output-folder csharp-doc-improve dependabot/npm_and_yarn/samples/client/petstore/typescript-angular-v12-provided-in-root/webpack-and-angular-devkit/build-angular-5.76.1 devhl-labs-14552 devhl-labs-14553 elm_ci fix-6.4.0-release fix-bitrise fix-release2 fix-website-update github/fork/0xNF/fix_dart_uint8list github/fork/77web/patch-1 github/fork/Bdaya-Dev/dart-dio/optional-http-library github/fork/BitCaesar/fix_issue_9523 github/fork/BjornJaspers/support-model-property-naming-in-kotlin github/fork/Blackclaws/aspnetcore-endpoints github/fork/C0deH0use/fix/kotlin-multiplatform-fix-serialization github/fork/DeaneOC/enumUnknownDefaultCase-invalid-response-spring github/fork/DeaneOC/enumUnknownDefaultCase_not_deserialized github/fork/DreierF/expose_generate_metadata github/fork/FallenRiteMonk/patch-1 github/fork/FieteO/conditional-enum-jsoncreator-import github/fork/FieteO/conditional-jsonnullable-import github/fork/FieteO/multipart-requestpart-test github/fork/Gama11/java-native-remove-trailing-slashes github/fork/GavinWu1991/fix-7118 github/fork/GregDThomas/rest-template-explode-correctly github/fork/GuillaumeSmaha/fix_14577_3.1_responses_array github/fork/Ikelio/master github/fork/JasonTashtego/fix-issue-10836 github/fork/JoeCqupt/py-support-importmappings github/fork/JonasSchubert/fix/csharp-netcore-enum-list-serialization github/fork/Joshix-1/dollar-replacement github/fork/Joshix-1/python-date-default github/fork/Joshix-1/single-quote-escaping github/fork/Kraust/go-server-placing-models-in-separate-dir github/fork/KrzysztofLabus-RDX/feature/csharp-polymorphism github/fork/LostMekka/bugfix/#7083-ts-fetch-wrong-json-stringify github/fork/LostMekka/bugfix/PR-template-wrong-for-windows-users github/fork/LubomirS/feat/12726 github/fork/LukasWoodtli/cpp-boost-beast-client github/fork/MarkusBansky/add_feature_2972 github/fork/MartinDelille/fix-files github/fork/MartinDelille/qt-ctest github/fork/MartinDelille/test-qt-action github/fork/MassonGuillaume/fix/typesctip/angular/basePath-type github/fork/Mintas/bugfix/user-defined-templates-gradle github/fork/Mintas/feature/srping-custom-constrains-validation github/fork/NickUfer/go-fix-missing-utils-add-required-supportfiles-feature github/fork/Nikolai-SE/master github/fork/Nuglif/kotlin_kotlinxserialization_polymorphism github/fork/OJFord/fix-overwritten-impl github/fork/OptoCloud/master github/fork/Orachigami/feature/ASF-13569/straight-ahead-solution github/fork/ParadiseFallen/master github/fork/PirvuCatalin/bug/java-default-apireponse-code github/fork/Reinhard-PTV/array-of-doubles-param-csharp github/fork/Reinhard-PTV/master github/fork/RubberChickenParadise/11001 github/fork/SanjayMarreddi/fix_cpp_rest_sdk github/fork/SanjayMarreddi/json_support github/fork/SergiiKusii/kusii/property_with_composed_schema github/fork/Setfive/typescript-override-modifier github/fork/SimonErm/fix/discriminator-serialization github/fork/Stevelriemenbill/master github/fork/ToppScorer/bugfix/13425 github/fork/ToppScorer/bugfix/8822 github/fork/UnsolvedCypher/6.0.x github/fork/VladimirSvoboda/java_client_custom_repository github/fork/Zomzog/zomzog/13350_path_query_enum github/fork/Zomzog/zomzog/13395_additionalProperties_kotlin github/fork/Zomzog/zomzog/13677_generate_supporting_tests github/fork/Zomzog/zomzog/13830_generate_models github/fork/aarseneau-idexx/fix_13961 github/fork/aeneasr/fix-rust-13257 github/fork/agilob/update-jdk github/fork/aharonha/aharonha-issue-13393 github/fork/ahsanfz/fix_issue9444 github/fork/alejogun/fix-py-generator-file-param-mapping github/fork/alexsuperdev/spring_fix_5381 github/fork/alitams/master github/fork/allen-ball/master github/fork/amineau/python/readme-typo-fix github/fork/ammmze/golang-anyof-complex github/fork/anatoliy-balakirev/bugfix/14432-valid github/fork/andreaTP/no-dup-on-tags github/fork/ashatch/14404-java-arrays-processing-fix github/fork/auke-/micronaut-abstract-sealed github/fork/auke-/subtype-visitor github/fork/avandecreme/r_numbers_fix github/fork/b-com/feat/JavaJaxrsResteasy_Make_it_possible_to_disable_generation_of_swagger_annotations github/fork/bahag-chandrana/dart-dio-freezed github/fork/beeman/beeman/kotlin-headers github/fork/ben-sab/go-server-placing-models-in-separate-dir github/fork/benfonty/fix-9976-escaped-quotes-in-example github/fork/benfonty/fix_issue1466_spring github/fork/berlincho/issue10598 github/fork/bernie-schelberg-mywave/issue12412 github/fork/bernie-schelberg-mywave/issue13150-2 github/fork/bernie-schelberg-mywave/remove-json-type-name-java-1 github/fork/bernie-schelberg-mywave/remove-json-type-name-jersey2 github/fork/bernie-schelberg-mywave/remove-json-type-name-jersey3 github/fork/bernie-schelberg-mywave/remove-json-type-name-okhttp-gson github/fork/bernie-schelberg-mywave/remove-json-type-name-spring github/fork/bernie-schelberg-mywave/remove-unused-import github/fork/brabo-hi/patch-1 github/fork/cachescrubber/feature/wrapped_tyoes_and_default_values github/fork/cachescrubber/regen_model_tests github/fork/cachescrubber/spring_remove_springfox github/fork/cachescrubber/spring_vendor_extension_x_oneof_interface github/fork/cevheri/master github/fork/chrispaynter/add-implicit-headers-to-ts-axios github/fork/code1x1/bugfix/BUG-javascript-ApiClient-Fix-request-responseType-10833 github/fork/code1x1/feature/#10826 github/fork/ctron/feature/fix_enum_display_1 github/fork/cyangle/generate_form_as_model github/fork/daberni/jsonnullable github/fork/devhl-labs/inherit-api2 github/fork/dimber-cais/feature/gradle-classpath-templates github/fork/dmivankov/fix_custom_java_types github/fork/dweinstein/patch-3 github/fork/eafer/c_api_fixes github/fork/eafer/c_api_fixes_1_v2 github/fork/eak24/javaparser_ast_client github/fork/enriquebarba97/java-idl-dependencies github/fork/erichaagdev/master github/fork/evanjmg/patch-1 github/fork/exaV/master github/fork/galeries-lafayette/feature/kotlin-spring_responseentity github/fork/galeries-lafayette/fix/kotlin-inheritance github/fork/gbmarc1/validation_type_object_bug github/fork/gitterrost4/java-play-framework-model-builder github/fork/gokul-krishnamoorthy/fix_issue10438 github/fork/gokul-krishnamoorthy/fix_issue9523 github/fork/gokul-krishnamoorthy/fix_issue9654 github/fork/goldflam-gmbh/fix_issue_8315 github/fork/gturri/fix_14971 github/fork/harlequin-tech/MOX-6029-prep github/fork/hidden-primary-net/fix/14921 github/fork/iWantUss/bagfix-14119 github/fork/jaecktec/fix-7880 github/fork/jameswynn/issue1466 github/fork/jayandran-Sampath/feat13578_1 github/fork/jbreton/fix-12514 github/fork/jdimeo/master github/fork/jeffmikels/master github/fork/jenspopp/patch-1 github/fork/jianjungki/go-style github/fork/jianjungki/openapi3.1 github/fork/jirikuncar/typescript-array-examples github/fork/jmrieger/issue-6223-fix-duplicate-accesstoken-methods github/fork/johnlinp/fix-discriminator-enum-property-name github/fork/jsantalo/master github/fork/jsoref/spelling github/fork/jtmuller5/master github/fork/jtreminio/config-options github/fork/jtreminio/namespace-param-fixes github/fork/justinjxzhang/az-func-snake-case-base-path github/fork/jverhoelen/typescript-fetch-expose-apimethod-path github/fork/jyutzler/10350-dollar github/fork/kananindzya/feature-handle-chunked-response-v530 github/fork/karzang/issue_12556 github/fork/kellrott/issue/11173 github/fork/kentis/feature/add_deserializer_to_kotlin_model_classes github/fork/kevchentw/fix-10848 github/fork/klalit/master github/fork/knazarenko-ptc/go-allof-fix-fin github/fork/knazarenko-ptc/go-fix-field-naming-conflicts github/fork/kpldvnpne/patch-2 github/fork/krjakbrjak/VNI-fastapi github/fork/kronostechnologies/fix-nullable-field github/fork/kthoms/issues/11696 github/fork/kuhnroyal/dart-dio/identifiers github/fork/kvn-stgl/feat/moshi-serialization-polymorphic github/fork/l3ender/oneof-java-enums github/fork/leo-sale/fix-unnecessary-models github/fork/listopad7/14837-header-based-operation-versioning github/fork/liulu1998/master github/fork/lwj5/embed github/fork/ma-myair/pallzoltan/fix-swift5gen github/fork/mabhijith95a10/bugfix/9332 github/fork/maciejcymanski132/template-update github/fork/madupuis/fix/Enum_if_type_not_string github/fork/marcusirgens/func-opts-go github/fork/mariotoffia/bug/invalid-var-fields github/fork/martin-bucinskas/feature/one-of-spring github/fork/martinvisser/master github/fork/matheustf/patch-1 github/fork/mcwhitak/12303-gradle-file-properties github/fork/mfmarche/fix_9684 github/fork/mickaelmagniez/fix-rust-reqwest-explode github/fork/mickroll/patch-2 github/fork/mkusaka/auto-update-if-master-branch github/fork/morosawamikihito/kotlin-spring-interface-implementation github/fork/mpapale/go-server-optional-params github/fork/mppperez/master github/fork/msosnicki/add-flake github/fork/mvera/jacksonAnnotations github/fork/nabdali/patch-1 github/fork/neclimdul/remove-form-encode-model-filters github/fork/nmerigaud/fix_any_of_ts_imports github/fork/nshaaban-cPacket/basic-rust-anyof-support github/fork/oaklandcorp/java-oai-annotation-cliOption github/fork/olexiyk/6.0.x-php-http-client-meta-packages github/fork/orange-buffalo/interceptors-metadata github/fork/orrin-naylor-instacart/orrin/remove-barrel-import-dependncy github/fork/ovirta/typescript-fetch-6008-apis-mustache github/fork/panargirakis/generate-api-getters-in-apiclient github/fork/parvit/broken-go-imports github/fork/patou/patch-1 github/fork/paulbalomiri/elixir-bugfix github/fork/pcafstockf/5.4.x github/fork/pkadej/feature/oneof_via_additional_properties github/fork/prajon84/csharp-netcore/add-paramless-constr-model github/fork/prajon84/csharp-netcore/fix-modelOneOf github/fork/pravussum/add-java-usetags-support github/fork/rainmanhhh/patch-1 github/fork/rainmanhhh/patch-2 github/fork/randeepbydesign/java-typemapping-defaults github/fork/ranhalprin/master github/fork/redixin/exception-request-info github/fork/rgranadosd/fix_issue_9981 github/fork/rsinukov/rsinukov/ktor-server-update-2.1.1 github/fork/s-jepsen/enable-useOneOfInterfaces-for-some-java-clients github/fork/salimzdn/fix_csharp-netcore_snake_case_constructors_generation github/fork/sarumont/fix_ts_imports github/fork/saschpe/gradle-modernize github/fork/sdoeringNew/issue-8961 github/fork/seanich/seanich/string-transform-perf-improvements github/fork/segevfiner/typescript-axios-v1 github/fork/service84-io/fix_issue_12576 github/fork/sharkwouter/go-gin-library github/fork/shmakovalexey/check-unique-names-in-enums github/fork/sigand/KOTLIN-optionals-with-default github/fork/sigand/jackson-deserialization-enums github/fork/simPod/enum github/fork/smargoli2/steichman-patch-1 github/fork/snebjorn/bugfix/13200-duplicate-export github/fork/stephanpelikan/bugfix/issue_12490 github/fork/strager/go-toupper github/fork/stropho/ts-axios-reuse-fp-instances github/fork/sudokzt/chore/serialization-library github/fork/sverrevalskraa/feature/typescript_fetch_request_body_set github/fork/szekelyisz/dart_path_s11n_fix github/fork/tiffmaelite/fix/align_use-HttpBearerAuth_import-HttpBearerAuth github/fork/tkalmar/master github/fork/tloubrieu-jpl/master github/fork/tmeneau/fix-sanitize-kotlin-model-name github/fork/tmkha21/fix-typescript-axios-reserved-words github/fork/tobi-laa/issue1693_JavaSpring github/fork/tobiashochguertel/master github/fork/tomplus/feat/python-nextgen-object github/fork/tributech-solutions/fix-typecript-special-chars github/fork/trreeves/feature/plantuml-property-fix github/fork/tysonkane/python-github-action github/fork/tzeH/single-inheritance-alias-13784 github/fork/umbopepato/fix-tsfetch-runtime-import github/fork/valery1707/java-spring-validate-headers github/fork/valmoz/okhttp-oltu-scribejava-replacement-2 github/fork/vlsergey/master github/fork/vpishuk/typescript-axios-anyof github/fork/warrenisarobot/dart-dio-update github/fork/wbt-solutions/oneof-dart-dynamic github/fork/willgit-sl/add-json-tag-to-oneOf github/fork/wtrocki/fix-enum github/fork/x7c1/issue-3189-accept-binary-string github/fork/ybelenko/11038_php_lumen github/fork/ybelenko/php_slim4_post_script github/fork/ybelenko/phpslim4_token_auth github/fork/yjh0502/rust-enum-repr github/fork/ymoran00/master github/fork/yonatankarp/fix_retrofit_generator_with_jackson github/fork/yugabyte/feature/mehul-joshi/generator-typescript-react-query github/fork/zoltanwork/BUG-13718-Kotlin-wrong_handling_of_empty_response go-workflow inline-schema-improve3 jaxrs-jersey3 nested-oneof-python-nextgen npe-add-import oauth-refresh-token-r okhttp-gson-next-gen-better-error php-nextgen swift-actions t0mk-fix_validation_of_list_of_enums2 ts-koa2-server typescript-documentation undo_14684 v6.4.0 v6.3.0 v6.2.1 v6.2.0 v6.1.0 v6.0.1 v6.0.0 v6.0.0-beta v5.4.0 v5.3.1 v5.3.0 v5.2.1 v5.2.0 v5.1.1
2 merge requests!9225[BUG] Website: Generators navigation sidebar is misplaced for some generators #9157,!9227[BUG] Website: Generators navigation sidebar is misplaced for some generators
Showing with 5340 additions and 0 deletions
+5340 -0
generatorName: typescript-axios
outputDir: samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
......@@ -86,10 +86,20 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{#isArray}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{#uniqueItems}}
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
{{/uniqueItems}}
{{^uniqueItems}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/uniqueItems}}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
{{#uniqueItems}}
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
{{/uniqueItems}}
{{^uniqueItems}}
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
{{/uniqueItems}}
{{/isCollectionFormatMulti}}
}
{{/isArray}}
......@@ -117,7 +127,12 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
{{#headerParams}}
{{#isArray}}
if ({{paramName}}) {
{{#uniqueItems}}
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
{{/uniqueItems}}
{{^uniqueItems}}
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
{{/uniqueItems}}
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
}
{{/isArray}}
......
......@@ -1044,6 +1044,39 @@ paths:
responses:
"200":
description: Success
/fake/test-unique-paramters:
put:
tags:
- fake
description: To test unique items in header and query parameters
operationId: testUniqueItemsHeaderAndQueryParameterCollectionFormat
parameters:
- name: queryUnique
in: query
required: true
schema:
type: array
uniqueItems: true
items:
type: string
- name: headerUnique
in: header
required: true
schema:
type: array
uniqueItems: true
items:
type: string
responses:
"200":
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
uniqueItems: true
'/fake/{petId}/uploadImageWithRequiredFile':
post:
tags:
......
wwwroot/*.js
node_modules
typings
dist
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
\ No newline at end of file
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
.gitignore
.npmignore
api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
5.1.1-SNAPSHOT
\ No newline at end of file
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io:80/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
import { RequiredError, RequestArgs } from "./base";
import { AxiosInstance } from 'axios';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request(axiosRequestArgs);
};
}
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment