Compare commits

..

19 Commits

Author SHA1 Message Date
William Cheng
0e8a6ac11d test with JDK21 in github workflow 2025-10-16 19:34:46 +08:00
CG
323f978674 fix(kotlin-spring): the generated RequestHeader defaultValue for String parameters contains duplicated double quotes (#22123) 2025-10-16 18:34:33 +08:00
William Cheng
4fe1c4ac73 feat(typescript-fetch): add docs support (#22110)
* feat(typescript-fetch): add docs support

fixes #18276

* chore: regenerate

- generate-samples.sh
- export_docs_generators.sh

* chore: address PR feedback

* update samples

* update samples

* clean up unused files

---------

Co-authored-by: Aaron Heckmann <aaron@plane.so>
2025-10-16 18:21:41 +08:00
monksy
ecaf3ea48a Removed a duplicate binding for an address for rust-server (#22116)
* Removed a duplicate binding for an address for rust-server. The address binding happens higher up in the method.

* Updated samples.
2025-10-16 17:04:41 +08:00
jheyens
ce1e9e0866 Jersey2/3: Fixes a bug in OAuth token renewal, where the previous HTTP 401 code is reused even after the retry succeeds (#22134)
* Jersey2/3: Fix a bug where, when using OAuth, the HTTP 401 status code persisted even if the second request after renewing the Bearer access token succeeded

* Jersey2/3: Regenerate samples
2025-10-16 16:32:05 +08:00
Adnan
fc12a1b63a feat(rust-axum): make the Object value public (#22144)
* feat(rust-axum): make the Object value public

* feat(rust-axum): regenerate samples
2025-10-16 15:01:19 +08:00
William Cheng
bce0ea65fe CircleCI: clean up unused tests/setup (#22158)
* clean up circleci tests

* ignore .angular

* trigger build failure

* Revert "trigger build failure"

This reverts commit ee228266b1.
2025-10-16 14:50:41 +08:00
Linh Tran Tuan
117042aa44 [Rust-Axum] Fix wrong validation for non-model Body (#22155)
* Fix Issue 21143

* Update
2025-10-16 14:25:01 +08:00
William Cheng
c680f39ad7 Fix TypeScript Angular v20 tests with correct versions (#22156)
* fix ts angular v20 tetss with correct versions

* restore old version

* fix pom.xml
2025-10-16 14:14:11 +08:00
William Cheng
211f51702d Update package.json manually in angular v19 tests (#22151)
* update package.json manually in angular v19 tests

* fix angular v19 tests

* remove declarations
2025-10-15 21:25:01 +08:00
sermler
a4a24a8168 [typescript-fetch] Rework fix infinite recursion with self-referencing discriminator mappings (#22149)
* Prevent ConcurrentModificationException

* Update typescript-fetch samples

* Add fixture sample

* Update samples
2025-10-15 19:25:45 +08:00
William Cheng
cbb27163a0 Add samples to test jaxrs spec (withXml option enabled) (#22148)
* add samples to test jaxrs spec with xml option enabled

* add new files
2025-10-15 18:11:19 +08:00
William Cheng
fdbabee87e Add tests for typescript angular v17, v18, v20 (#22145)
* add tests for angular v17, v18, v20

* trigger build failure

* Revert "trigger build failure"

This reverts commit bab6448ed1.

* update samples
2025-10-15 18:08:52 +08:00
William Cheng
cdd120d976 update samples 2025-10-15 17:53:01 +08:00
maushomu
9d110fcb6b [Java][jaxrs-spec] withXml support (#22140)
* withXml support in pojo.mustache

* Create xmlPojoAnnotation.mustache

* withXml support in enumClass.mustache
2025-10-15 17:43:15 +08:00
Robert Marsal
57324efd48 fix: typescript docs not being put in a docs directory (#22124)
* fix: typescript docs not being put in a docs directory

* fix: platform agnostic path separator
2025-10-15 17:13:51 +08:00
William Cheng
21d29dacc2 Add tests for TypeScript Angular v19 (#22139)
* add tests for ts angular v19

* fix transfer cache
2025-10-15 16:36:03 +08:00
dependabot[bot]
c27f9c3ebc Bump actions/setup-java from 4 to 5 (#22137)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4 to 5.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 16:30:14 +08:00
William Cheng
486e0c5e61 Test TypeScript Angular v16 in Github workflow (#22138)
* test ts angular v16 in github workflow

* trigger build failure

* Revert "trigger build failure"

This reverts commit c7987599a9.
2025-10-15 14:51:40 +08:00
975 changed files with 128867 additions and 599 deletions

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 17]
java: [11, 17, 21]
os: [ubuntu-latest]
steps:
- name: Check out code

View File

@@ -21,7 +21,7 @@ jobs:
with:
go-version: "stable"
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -36,7 +36,7 @@ jobs:
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -37,7 +37,7 @@ jobs:
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -43,7 +43,7 @@ jobs:
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -39,7 +39,7 @@ jobs:
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- name: Use Node.js 20.x
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
cache: 'npm' # Or 'yarn'

View File

@@ -20,10 +20,7 @@ jobs:
- samples/server/petstore/jaxrs/jersey2-useTags
- samples/server/petstore/jaxrs-jersey
- samples/server/petstore/jaxrs-spec
- samples/server/petstore/jaxrs-spec-interface
- samples/server/petstore/jaxrs-spec-interface-response
- samples/server/petstore/jaxrs-jersey
- samples/server/petstore/jaxrs-spec
- samples/server/petstore/jaxrs-spec-withxml
- samples/server/petstore/jaxrs-spec-interface
- samples/server/petstore/jaxrs-spec-interface-response
- samples/server/petstore/jaxrs-datelib-j8

View File

@@ -40,7 +40,7 @@ jobs:
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -29,7 +29,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -28,7 +28,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Setup node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}

View File

@@ -9,11 +9,11 @@ on:
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
#- samples/client/petstore/typescript-angular-v14-provided-in-root/**
#- samples/client/petstore/typescript-angular-v15-provided-in-root/**
#- samples/client/petstore/typescript-angular-v16-provided-in-root/**
# comment out below as there's no pom.xml
#- samples/client/petstore/typescript-angular-v17-provided-in-root/**
#- samples/client/petstore/typescript-angular-v18-provided-in-root/**
#- samples/client/petstore/typescript-angular-v19-provided-in-root/**
- samples/client/petstore/typescript-angular-v16-provided-in-root/**
- samples/client/petstore/typescript-angular-v17-provided-in-root/**
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
- samples/openapi3/client/petstore/typescript/builds/default/**
# comment out due to build failure
#- samples/openapi3/client/petstore/typescript/tests/default/**
@@ -47,10 +47,11 @@ on:
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
#- samples/client/petstore/typescript-angular-v14-provided-in-root/**
#- samples/client/petstore/typescript-angular-v15-provided-in-root/**
#- samples/client/petstore/typescript-angular-v16-provided-in-root/**
#- samples/client/petstore/typescript-angular-v17-provided-in-root/**
#- samples/client/petstore/typescript-angular-v18-provided-in-root/**
#- samples/client/petstore/typescript-angular-v19-provided-in-root/**
- samples/client/petstore/typescript-angular-v16-provided-in-root/**
- samples/client/petstore/typescript-angular-v17-provided-in-root/**
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
- samples/openapi3/client/petstore/typescript/builds/default/**
#- samples/openapi3/client/petstore/typescript/tests/default/**
- samples/openapi3/client/petstore/typescript/builds/jquery/**
@@ -95,10 +96,11 @@ jobs:
#- samples/client/petstore/typescript-angular-v13-provided-in-root/
#- samples/client/petstore/typescript-angular-v14-provided-in-root/
#- samples/client/petstore/typescript-angular-v15-provided-in-root/
#- samples/client/petstore/typescript-angular-v16-provided-in-root/
#- samples/client/petstore/typescript-angular-v17-provided-in-root/
#- samples/client/petstore/typescript-angular-v18-provided-in-root/
#- samples/client/petstore/typescript-angular-v19-provided-in-root/
- samples/client/petstore/typescript-angular-v16-provided-in-root/
- samples/client/petstore/typescript-angular-v17-provided-in-root/
- samples/client/petstore/typescript-angular-v18-provided-in-root/
- samples/client/petstore/typescript-angular-v19-provided-in-root/
- samples/client/petstore/typescript-angular-v20-provided-in-root/
- samples/openapi3/client/petstore/typescript/builds/default/
#- samples/openapi3/client/petstore/typescript/tests/default/
- samples/openapi3/client/petstore/typescript/builds/jquery/
@@ -125,13 +127,13 @@ jobs:
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '17' # Specify your desired Java version
distribution: 'temurin' # Or 'adopt', 'oracle', etc.
cache: maven # Cache Maven dependencies for faster builds
- name: Use Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
cache: 'npm' # Or 'yarn'

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}

View File

@@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Use Node.js 20.x
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
cache: 'npm' # Or 'yarn'

View File

@@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}

View File

@@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v6
uses: actions/setup-node@v5
- name: Install dependencies
working-directory: ${{ matrix.sample }}
run: |

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
java: [11, 17]
java: [11, 17, 21]
steps:
- uses: actions/checkout@v5
- name: Set up JDK ${{ matrix.java }}

2
.gitignore vendored
View File

@@ -49,6 +49,8 @@ nb-configuration.xml
*.xml~
*.t~
**/.angular
/target
/generated-files
test-output/

View File

@@ -11,43 +11,15 @@ export NODE_ENV=test
if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX ..."
java -version
sudo apt-get -y install cpanminus
# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
echo "Testing perl"
(cd samples/client/petstore/perl && /bin/bash ./test.bash)
echo "Testing ruby"
(cd samples/client/petstore/ruby && mvn integration-test)
(cd samples/client/petstore/ruby-faraday && mvn integration-test)
(cd samples/client/petstore/ruby-httpx && mvn integration-test)
(cd samples/client/petstore/ruby-autoload && mvn integration-test)
echo "Testing rust"
(cd samples/server/petstore/rust-axum && mvn integration-test)
elif [ "$NODE_INDEX" = "2" ]; then
echo "Running node $NODE_INDEX to test Go"
# install haskell
#curl -sSLk https://get.haskellstack.org/ | sh
#stack upgrade
#stack --version
# install curl
#sudo apt-get -y build-dep libcurl4-gnutls-dev
#sudo apt-get -y install libcurl4-gnutls-dev
# Install golang version 1.18
go version
sudo mkdir /usr/local/go1.18
wget -c https://dl.google.com/go/go1.18.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.18
export PATH="/usr/local/go1.18/go/bin:$PATH"
go version
echo "Running node $NODE_INDEX to test cpp-restsdk"
# install cpprestsdk
sudo apt-get install libcpprest-dev
@@ -62,54 +34,15 @@ elif [ "$NODE_INDEX" = "3" ]; then
echo "Running node $NODE_INDEX ... "
## Install node@stable (for angular 6)
#set +e
#curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
#export NVM_DIR="/opt/circleci/.nvm"
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
##nvm install stable
## install v16 instead of the latest stable version
#nvm install 18
#nvm alias default 18
#node --version
## Each step uses the same `$BASH_ENV`, so need to modify it
#echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
#echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
#(cd samples/client/others/typescript-angular && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v12-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v13-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v14-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v15-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v16-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v17-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v18-provided-in-root && mvn integration-test)
#(cd samples/client/petstore/typescript-angular-v19-provided-in-root && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/default && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/tests/default && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/jquery && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/tests/jquery && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/object_params && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/tests/object_params && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/inversify && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/tests/inversify && mvn integration-test)
##(cd samples/openapi3/client/petstore/typescript/tests/deno && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/browser && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/tests/browser && mvn integration-test)
#(cd samples/openapi3/client/petstore/typescript/builds/nullable-enum && mvn integration-test)
#(cd samples/client/petstore/typescript-fetch/builds/default && mvn integration-test)
#(cd samples/client/petstore/typescript-fetch/builds/es6-target && mvn integration-test)
#(cd samples/client/petstore/typescript-fetch/builds/with-npm-version && mvn integration-test)
#(cd samples/client/petstore/typescript-fetch/tests/default && mvn integration-test)
#(cd samples/client/petstore/typescript-node/npm && mvn integration-test)
#(cd samples/client/petstore/typescript-rxjs/builds/with-npm-version && mvn integration-test)
#(cd samples/client/petstore/typescript-axios/builds/with-npm-version && mvn integration-test)
#(cd samples/client/petstore/typescript-axios/tests/default && mvn integration-test)
#(cd samples/client/petstore/typescript-axios/tests/with-complex-headers && mvn integration-test)
echo "Testing ruby"
(cd samples/client/petstore/ruby && mvn integration-test)
(cd samples/client/petstore/ruby-faraday && mvn integration-test)
(cd samples/client/petstore/ruby-httpx && mvn integration-test)
(cd samples/client/petstore/ruby-autoload && mvn integration-test)
else
echo "Running node $NODE_INDEX ..."
java -version
./mvnw clean install
fi

View File

@@ -0,0 +1,10 @@
generatorName: jaxrs-spec
outputDir: samples/server/petstore/jaxrs-spec-withxml/
inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec
additionalProperties:
artifactId: jaxrs-spec-withxml-petstore-server
serializableModel: "true"
hideGenerationTimestamp: "true"
generateBuilders: "true"
withXml: true

View File

@@ -0,0 +1,9 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 19.0.0
supportsES6: true
enumNameMappings:
delivered: SHIPPED

View File

@@ -0,0 +1,9 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 20.0.0
supportsES6: true
enumNameMappings:
delivered: SHIPPED

View File

@@ -0,0 +1,7 @@
generatorName: typescript-fetch
outputDir: samples/client/others/typescript-fetch/infinite-recursion-issue
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/infinite-recursion-issue.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
additionalProperties:
enumPropertyNaming: "original"
enumUnknownDefaultCase: true

View File

@@ -861,6 +861,24 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
}
if (op.bodyParam != null) {
final var dataType = op.bodyParam.dataType;
if (dataType.startsWith(vecType + "<String")) {
op.bodyParam.vendorExtensions.put("is-vec-string", true);
} else if (dataType.startsWith(vecType + "<models::")) {
op.bodyParam.vendorExtensions.put("is-vec-nested", true);
} else if (dataType.startsWith(mapType + "<String, String")) {
op.bodyParam.vendorExtensions.put("is-map-string", true);
} else if (dataType.startsWith(mapType + "<String, models::")) {
op.bodyParam.vendorExtensions.put("is-map-nested", true);
} else if (dataType.startsWith(mapType + "<String")) {
op.bodyParam.vendorExtensions.put("is-map", true);
} else if (dataType.startsWith("models::")) {
op.bodyParam.isModel = true;
} else if (dataType.equals("String")) {
op.bodyParam.isString = true;
op.bodyParam.vendorExtensions.put("is-string", true);
}
if (consumesJson) {
op.bodyParam.vendorExtensions.put("x-consumes-json", true);
} else if (consumesFormUrlEncoded) {

View File

@@ -100,6 +100,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
private final DateTimeFormatter iso8601Date = DateTimeFormatter.ISO_DATE;
private final DateTimeFormatter iso8601DateTime = DateTimeFormatter.ISO_DATE_TIME;
protected String apiDocPath = "docs/";
public TypeScriptClientCodegen() {
super();
@@ -400,6 +402,11 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
return objs;
}
@Override
public String apiDocFileFolder() {
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
}
private List<Map<String, String>> toTsImports(CodegenModel cm, Set<String> imports) {
List<Map<String, String>> tsImports = new ArrayList<>();
for (String im : imports) {
@@ -432,6 +439,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
apiPackage = this.apiPackage + ".apis";
testPackage = this.testPackage + ".tests";
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.putIfAbsent(FRAMEWORK_SWITCH, FRAMEWORKS[0]);
supportingFiles.add(new SupportingFile("index.mustache", "index.ts"));

View File

@@ -73,6 +73,8 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
protected boolean withoutRuntimeChecks = false;
protected boolean stringEnums = false;
protected String fileNaming = PASCAL_CASE;
protected String apiDocPath = "docs";
protected String modelDocPath = "docs";
// "Saga and Record" mode.
public static final String SAGAS_AND_RECORDS = "sagasAndRecords";
@@ -107,10 +109,12 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
// at the moment
importMapping.clear();
outputFolder = "generated-code/typescript-fetch";
outputFolder = "generated-code" + File.separator + "typescript-fetch";
embeddedTemplateDir = templateDir = "typescript-fetch";
this.apiTemplateFiles.put("apis.mustache", ".ts");
this.apiDocTemplateFiles.put("api_doc.mustache", ".md");
this.modelDocTemplateFiles.put("model_doc.mustache", ".md");
this.addExtraReservedWords();
@@ -138,6 +142,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
return convertUsingFileNamingConvention(super.toModelFilename(name));
}
@Override
public String toModelDocFilename(String name) {
return toModelName(name);
}
/**
* Converts the original name according to the current <code>fileNaming</code> strategy.
*
@@ -242,6 +251,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.apiPackage = sourceDir + "apis";
this.modelPackage = sourceDir + "models";
// make api and model doc path available in mustache template
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
supportingFiles.add(new SupportingFile("index.mustache", sourceDir, "index.ts"));
supportingFiles.add(new SupportingFile("runtime.mustache", sourceDir, "runtime.ts"));
@@ -316,6 +329,16 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
convertPropertyToBooleanAndWriteBack(VALIDATION_ATTRIBUTES, this::setGenerateValidationAttributes);
}
@Override
public String apiDocFileFolder() {
return (outputFolder + File.separator + apiDocPath);
}
@Override
public String modelDocFileFolder() {
return (outputFolder + File.separator + modelDocPath);
}
@Override
public String toEnumDefaultValue(String value, String datatype) {
if (this.getSagasAndRecords()) {
@@ -1605,11 +1628,13 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
if (this.discriminator != null) {
Set<CodegenDiscriminator.MappedModel> mappedModels = this.discriminator.getMappedModels();
for(CodegenDiscriminator.MappedModel mappedModel : mappedModels) {
if(mappedModel.getModelName().equals(cm.classname)){
this.discriminator.getMappedModels().remove(mappedModel);
this.selfReferencingDiscriminatorMapping=mappedModel;
if(mappedModel.getModelName().equals(cm.classname)) {
this.selfReferencingDiscriminatorMapping = mappedModel;
}
}
if(this.selfReferencingDiscriminatorMapping != null) {
this.discriminator.getMappedModels().remove(this.selfReferencingDiscriminatorMapping);
}
}
}

View File

@@ -1299,11 +1299,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
{{#hasOAuthMethods}}
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (authNames != null && response.getStatusInfo().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1317,8 +1315,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
}
}
{{/hasOAuthMethods}}
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (statusCode == Status.NO_CONTENT.getStatusCode()) {

View File

@@ -1299,11 +1299,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
{{#hasOAuthMethods}}
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (authNames != null && response.getStatusInfo().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1319,6 +1317,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
{{/hasOAuthMethods}}
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (statusCode == Status.NO_CONTENT.getStatusCode()) {

View File

@@ -1,7 +1,11 @@
{{#withXml}}
@XmlType(name="{{datatypeWithEnum}}")
@XmlEnum({{dataType}}.class)
{{/withXml}}
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
{{#allowableValues}}
{{#enumVars}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
{{#enumVars}}{{#withXml}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}){{/withXml}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
{{/allowableValues}}

View File

@@ -7,13 +7,23 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonTypeName;
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.XmlElement;
import {{javaxPackage}}.xml.bind.annotation.XmlRootElement;
import {{javaxPackage}}.xml.bind.annotation.XmlAccessType;
import {{javaxPackage}}.xml.bind.annotation.XmlAccessorType;
import {{javaxPackage}}.xml.bind.annotation.XmlType;
import {{javaxPackage}}.xml.bind.annotation.XmlEnum;
import {{javaxPackage}}.xml.bind.annotation.XmlEnumValue;
{{/withXml}}
{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{#description}}/**
* {{.}}
**/{{/description}}
{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#title}}title="{{{.}}}", {{/title}}{{#description}}description="{{{.}}}"{{/description}}{{^description}}description=""{{/description}}){{/useMicroProfileOpenAPIAnnotations}}
@JsonTypeName("{{name}}")
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
@@ -92,6 +102,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
return this;
}
{{#withXml}}
@XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
{{/withXml}}
{{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}}{{#useSwaggerAnnotations}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}"){{/useMicroProfileOpenAPIAnnotations}}

View File

@@ -0,0 +1,8 @@
{{#withXml}}
@XmlAccessorType(XmlAccessType.FIELD)
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
{ {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}}
}){{/hasVars}}
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
{{/withXml}}

View File

@@ -1 +1 @@
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = {{^isString}}"{{{.}}}"{{/isString}}{{#isString}}{{#isEnum}}"{{{.}}}"{{/isEnum}}{{^isEnum}}{{{.}}}{{/isEnum}}{{/isString}}{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}}

View File

@@ -7,6 +7,13 @@ use validator::Validate;
use crate::header;
use crate::{models, types::*};
#[allow(dead_code)]
fn from_validation_error(e: validator::ValidationError) -> validator::ValidationErrors {
let mut errs = validator::ValidationErrors::new();
errs.add("na", e);
errs
}
#[allow(dead_code)]
pub fn check_xss_string(v: &str) -> std::result::Result<(), validator::ValidationError> {
if ammonia::is_html(v) {
@@ -465,7 +472,7 @@ pub fn check_xss_map<T>(v: &std::collections::HashMap<String, T>) -> std::result
#[serde(default)]
{{/required}}
pub {{{paramName}}}: {{{dataType}}},
{{/isArray}}
{{/isArray}}
{{^isArray}}
{{#required}}
pub {{{paramName}}}: {{#isNullable}}Nullable<{{/isNullable}}{{{dataType}}}{{#isNullable}}>{{/isNullable}},
@@ -580,10 +587,36 @@ impl std::str::FromStr for {{{classname}}} {
#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
{{/isMap}}
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct {{{classname}}}({{{dataType}}});
pub struct {{{classname}}}(pub {{{dataType}}});
impl validator::Validate for {{{classname}}} {
fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
{{^isNullable}}
{{#vendorExtensions.is-nested}}
let _ = self.0.validate()?;
{{/vendorExtensions.is-nested}}
{{#vendorExtensions.is-string}}
let _ = check_xss_string(&self.0).map_err(from_validation_error)?;
{{/vendorExtensions.is-string}}
{{#vendorExtensions.is-vec-nested}}
for v in self.0.iter() {
let _ = v.validate()?;
}
{{/vendorExtensions.is-vec-nested}}
{{#vendorExtensions.is-vec-string}}
let _ = check_xss_vec_string(&self.0).map_err(from_validation_error)?;
{{/vendorExtensions.is-vec-string}}
{{#vendorExtensions.is-map-nested}}
let _ = check_xss_map_nested(&self.0).map_err(from_validation_error)?;
{{/vendorExtensions.is-map-nested}}
{{#vendorExtensions.is-map}}
let _ = check_xss_map(&self.0).map_err(from_validation_error)?;
{{/vendorExtensions.is-map}}
{{#vendorExtensions.is-map-string}}
let _ = check_xss_map_string(&self.0).map_err(from_validation_error)?;
{{/vendorExtensions.is-map-string}}
{{/isNullable}}
std::result::Result::Ok(())
}
}
@@ -656,7 +689,7 @@ impl ::std::str::FromStr for {{{classname}}} {
{{! vec}}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct {{{classname}}}(Vec<{{{arrayModelType}}}>);
pub struct {{{classname}}}(pub Vec<{{{arrayModelType}}}>);
impl validator::Validate for {{{classname}}} {
fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {

View File

@@ -11,3 +11,6 @@ use crate::{header, types::*};
#[allow(unused_imports)]
use crate::{apis, models};
#[allow(unused_imports)]
use crate::{models::check_xss_string, models::check_xss_vec_string, models::check_xss_map_string, models::check_xss_map_nested, models::check_xss_map};

View File

@@ -5,67 +5,108 @@
#[derive(validator::Validate)]
#[allow(dead_code)]
struct {{{operationIdCamelCase}}}BodyValidator<'a> {
{{#hasValidation}}
#[validate(
{{#maxLength}}
{{#minLength}}
length(min = {{minLength}}, max = {{maxLength}}),
{{/minLength}}
{{^minLength}}
length(max = {{maxLength}}),
{{/minLength}}
{{/maxLength}}
{{^maxLength}}
{{#minLength}}
length(min = {{minLength}}),
{{/minLength}}
{{/maxLength}}
{{#pattern}}
{{#isString}}
regex(path = *RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}),
{{/isString}}
{{^isString}}
custom(function = "validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.lowercase}}"),
{{/isString}}
{{/pattern}}
{{#maximum}}
{{#minimum}}
range(min = {{minimum}}, max = {{maximum}}),
{{/minimum}}
{{^minimum}}
range(max = {{maximum}}),
{{/minimum}}
{{/maximum}}
{{#minimum}}
{{^maximum}}
range(min = {{minimum}}),
{{/maximum}}
{{/minimum}}
{{#maxItems}}
{{#minItems}}
length(min = {{minItems}}, max = {{maxItems}}),
{{/minItems}}
{{^minItems}}
length(max = {{maxItems}}),
{{/minItems}}
{{/maxItems}}
{{^maxItems}}
{{#minItems}}
length(min = {{minItems}}),
{{/minItems}}
{{/maxItems}}
)]
{{/hasValidation}}
{{^x-consumes-plain-text}}
{{^hasValidation}}
{{^isMap}}
#[validate(nested)]
{{/isMap}}
{{#isModel}}
#[validate(nested)]
{{/isModel}}
{{^isModel}}
{{#hasValidation}}
#[validate(
{{#maxLength}}
{{#minLength}}
length(min = {{minLength}}, max = {{maxLength}}),
{{/minLength}}
{{^minLength}}
length(max = {{maxLength}}),
{{/minLength}}
{{/maxLength}}
{{^maxLength}}
{{#minLength}}
length(min = {{minLength}}),
{{/minLength}}
{{/maxLength}}
{{#pattern}}
{{#isString}}
regex(path = *RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}),
{{/isString}}
{{^isString}}
custom(function = "validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.lowercase}}"),
{{/isString}}
{{/pattern}}
{{#isString}}
custom(function = "check_xss_string"),
{{/isString}}
{{#maximum}}
{{#minimum}}
range(min = {{minimum}}, max = {{maximum}}),
{{/minimum}}
{{^minimum}}
range(max = {{maximum}}),
{{/minimum}}
{{/maximum}}
{{#minimum}}
{{^maximum}}
range(min = {{minimum}}),
{{/maximum}}
{{/minimum}}
{{#maxItems}}
{{#minItems}}
length(min = {{minItems}}, max = {{maxItems}}),
{{/minItems}}
{{^minItems}}
length(max = {{maxItems}}),
{{/minItems}}
{{/maxItems}}
{{^maxItems}}
{{#minItems}}
length(min = {{minItems}}),
{{/minItems}}
{{/maxItems}}
{{#vendorExtensions.is-vec-nested}}
nested,
{{/vendorExtensions.is-vec-nested}}
{{#vendorExtensions.is-vec-string}}
custom(function = "check_xss_vec_string"),
{{/vendorExtensions.is-vec-string}}
{{#vendorExtensions.is-map-nested}}
custom(function = "check_xss_map_nested"),
{{/vendorExtensions.is-map-nested}}
{{#vendorExtensions.is-map}}
custom(function = "check_xss_map"),
{{/vendorExtensions.is-map}}
{{#vendorExtensions.is-map-string}}
custom(function = "check_xss_map_string"),
{{/vendorExtensions.is-map-string}} )]
{{/hasValidation}}
{{^hasValidation}}
{{#vendorExtensions.is-nested}}
#[validate(nested)]
{{/vendorExtensions.is-nested}}
{{#vendorExtensions.is-string}}
#[validate(custom(function = "check_xss_string"))]
{{/vendorExtensions.is-string}}
{{#vendorExtensions.is-vec-nested}}
#[validate(nested)]
{{/vendorExtensions.is-vec-nested}}
{{#vendorExtensions.is-vec-string}}
#[validate(custom(function = "check_xss_vec_string"))]
{{/vendorExtensions.is-vec-string}}
{{#vendorExtensions.is-map-nested}}
#[validate(custom(function = "check_xss_map_nested"))]
{{/vendorExtensions.is-map-nested}}
{{#vendorExtensions.is-map}}
#[validate(custom(function = "check_xss_map"))]
{{/vendorExtensions.is-map}}
{{#vendorExtensions.is-map-string}}
#[validate(custom(function = "check_xss_map_string"))]
{{/vendorExtensions.is-map-string}}
{{/hasValidation}}
{{/isModel}}
body: &'a {{{dataType}}},
{{/x-consumes-plain-text}}
{{#x-consumes-plain-text}}
{{#isString}}
#[validate(custom(function = "check_xss_string"))]
body: &'a String,
{{/isString}}
{{^isString}}

View File

@@ -5,7 +5,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[allow(dead_code)]
pub struct Object(serde_json::Value);
pub struct Object(pub serde_json::Value);
impl validator::Validate for Object {
fn validate(&self) -> Result<(), validator::ValidationErrors> {

View File

@@ -76,8 +76,6 @@ pub async fn create(addr: &str, https: bool) {
}
} else {
info!("Starting a server (over http, so no TLS)");
// Using HTTP
let listener = TcpListener::bind(&addr).await.unwrap();
println!("Listening on http://{}", addr);
loop {

View File

@@ -302,7 +302,7 @@ export class {{classname}} extends BaseService {
headers: localVarHeaders,
observe: observe,
{{#httpTransferCacheInOptions}}
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
{{/httpTransferCacheInOptions}}
reportProgress: reportProgress
}

View File

@@ -1,46 +1,127 @@
## {{npmName}}@{{npmVersion}}
# {{npmName}}@{{npmVersion}}
This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
A TypeScript SDK client for the {{host}} API.
Environment
* Node.js
* Webpack
* Browserify
## Usage
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
First, install the SDK from npm.
Module system
* CommonJS
* ES6 module system
```bash
npm install {{npmName}} --save
```
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
Next, try it out.
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
```ts
{{>api_example}}
```
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
## Documentation
### API Endpoints
All URIs are relative to *{{basePath}}*
| Class | Method | HTTP request | Description
| ----- | ------ | ------------ | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
### Models
{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}}
{{/models}}
### Authorization
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{#authMethods}}
<a id="{{name}}{{#isOAuth}}-{{flow}}{{/isOAuth}}"></a>
#### {{name}}{{#isOAuth}} {{flow}}{{/isOAuth}}
{{#isApiKey}}
- **Type**: API key
- **API key parameter name**: `{{keyParamName}}`
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}
- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}
- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - `{{scope}}`: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## About
This TypeScript SDK client supports the [Fetch API](https://fetch.spec.whatwg.org/)
and is automatically generated by the
[OpenAPI Generator](https://openapi-generator.tech) project:
- API version: `{{appVersion}}`
- Package version: `{{npmVersion}}`
{{^hideGenerationTimestamp}}
- Build date: `{{generatedDate}}`
{{/hideGenerationTimestamp}}
- Generator version: `{{generatorVersion}}`
- Build package: `{{generatorClass}}`
The generated npm module supports the following:
- Environments
* Node.js
* Webpack
* Browserify
- Language levels
* ES5 - you must have a Promises/A+ library installed
* ES6
- Module systems
* CommonJS
* ES6 module system
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Development
### Building
To build and compile the typescript sources to javascript use:
```
To build the TypeScript source code, you need to have Node.js and npm installed.
After cloning the repository, navigate to the project directory and run:
```bash
npm install
npm run build
```
### Publishing
First build the package then run `npm publish`
Once you've built the package, you can publish it to npm:
### Consuming
navigate to the folder of your consuming project and run one of the following commands.
_published:_
```
npm install {{npmName}}@{{npmVersion}} --save
```bash
npm publish
```
_unPublished (not recommended):_
## License
```
npm install PATH_TO_GENERATED_PACKAGE --save
```
[{{licenseInfo}}]({{{licenseUrl}}})

View File

@@ -0,0 +1,63 @@
# {{classname}}{{#description}}
{{.}}{{/description}}
All URIs are relative to *{{basePath}}*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}} |
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
## {{operationId}}
> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
{{summary}}{{#notes}}
{{.}}{{/notes}}
### Example
```ts
{{>api_example}}
```
### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}}
{{#allParams}}| **{{paramName}}** | {{#isEnum}}{{#allowableValues}}{{#values}}`{{{.}}}`{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}{{/isEnum}}{{^isEnum}}{{#isModel}}[{{baseType}}]({{baseType}}.md){{/isModel}}{{^isModel}}`{{{dataType}}}`{{/isModel}}{{/isEnum}} | {{description}} |{{^required}} [Optional]{{/required}}{{^isContainer}}{{#defaultValue}} [Defaults to `{{.}}`]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [Enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} |
{{/allParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}`void` (Empty response body){{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}{{#isOAuth}} {{flow}}{{/isOAuth}}](../README.md#{{{name}}}{{#isOAuth}}-{{flow}}{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP request headers
- **Content-Type**: {{#consumes}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
{{#responses.0}}
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
{{#responses}}
| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} |
{{/responses}}
{{/responses.0}}
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
{{/operation}}
{{/operations}}

View File

@@ -0,0 +1,44 @@
import {
Configuration,
{{classname}},
} from '{{npmName}}';
import type { {{operationIdCamelCase}}Request } from '{{npmName}}';
async function example() {
console.log("🚀 Testing {{npmName}} SDK...");
{{#hasAuthMethods}}
const config = new Configuration({ {{#authMethods}}{{#isBasicBasic}}
// To configure HTTP basic authorization: {{{name}}}
username: "YOUR USERNAME",
password: "YOUR PASSWORD",{{/isBasicBasic}}{{#isBasicBearer}}
// Configure HTTP bearer authorization: {{{name}}}
accessToken: "YOUR BEARER TOKEN",{{/isBasicBearer}}{{#isOAuth}}
// To configure OAuth2 access token for authorization: {{{name}}} {{{flow}}}
accessToken: "YOUR ACCESS TOKEN",{{/isOAuth}}{{#isApiKey}}
// To configure API key authorization: {{{name}}}
apiKey: "YOUR API KEY",{{/isApiKey}}{{#isHttpSignature}}
// To configure HTTP signature authorization: {{{name}}}
headers: { "YOUR HEADER NAME": "YOUR SIGNATURE" },{{/isHttpSignature}}{{/authMethods}}
});
{{/hasAuthMethods}}
const api = new {{classname}}({{#hasAuthMethods}}config{{/hasAuthMethods}});
{{#hasParams}}
const body = {
{{#allParams}}
// {{{dataType}}}{{#description}} | {{{description}}}{{/description}}{{^required}} (optional){{/required}}
{{paramName}}: {{{example}}}{{^example}}...{{/example}},
{{/allParams}}
} satisfies {{operationIdCamelCase}}Request;
{{/hasParams}}
try {
const data = await api.{{{operationId}}}({{#hasParams}}body{{/hasParams}});
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);

View File

@@ -0,0 +1,41 @@
{{#models}}{{#model}}
# {{classname}}
{{#description}}{{&description}}
{{/description}}
## Properties
Name | Type
------------ | -------------
{{#vars}}`{{name}}` | {{#isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{^isPrimitiveType}}[{{dataType}}]({{complexType}}.md){{/isPrimitiveType}}
{{/vars}}
{{^withoutRuntimeChecks}}
## Example
```typescript
import type { {{classname}} } from '{{npmName}}'
// TODO: Update the object below with actual values
const example = {
{{#vars}}
"{{name}}": {{{example}}},
{{/vars}}
} satisfies {{classname}}
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as {{classname}}
console.log(exampleParsed)
```
{{/withoutRuntimeChecks}}
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
{{/model}}{{/models}}

View File

@@ -14,6 +14,21 @@ import java.util.List;
import static org.openapitools.codegen.TestUtils.linearize;
public class RustAxumServerCodegenTest {
@Test
public void testObjectStructFieldIsPublic() throws IOException {
Path target = Files.createTempDirectory("test");
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("rust-axum")
.setInputSpec("src/test/resources/3_0/petstore.yaml")
.setSkipOverwrite(false)
.setOutputDir(target.toAbsolutePath().toString().replace("\\", "/"));
List<File> files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
files.forEach(File::deleteOnExit);
Path typesPath = Path.of(target.toString(), "/src/types.rs");
TestUtils.assertFileExists(typesPath);
TestUtils.assertFileContains(typesPath, "pub struct Object(pub serde_json::Value);");
}
@Test
public void testPreventDuplicateOperationDeclaration() throws IOException {
Path target = Files.createTempDirectory("test");

View File

@@ -19,6 +19,56 @@ paths:
"application/json":
schema:
"$ref": "#/components/schemas/Message"
"/issue21143_1":
post:
operationId: i21143_1
requestBody:
required: true
content:
"application/json":
schema:
type: array
items:
type: integer
responses:
"200":
description: Re-serialize and echo the request data
content:
"application/json":
schema:
"$ref": "#/components/schemas/Message"
"/issue21143_2":
post:
operationId: i21143_2
requestBody:
required: true
content:
"application/json":
schema:
type: string
responses:
"200":
description: Re-serialize and echo the request data
content:
"application/json":
schema:
"$ref": "#/components/schemas/Message"
"/issue21143_3":
post:
operationId: i21143_3
requestBody:
required: true
content:
"application/json":
schema:
type: integer
responses:
"200":
description: Re-serialize and echo the request data
content:
"application/json":
schema:
"$ref": "#/components/schemas/Message"
components:
schemas:
Message:
@@ -87,7 +137,7 @@ components:
- d
SomethingCompletelyDifferent:
oneOf:
- items:
type: object
type: array
- type: object
- items:
type: object
type: array
- type: object

View File

@@ -0,0 +1,53 @@
openapi: 3.0.3
info:
title: Minimal
description: Api to reproduce bug
version: 0.5.1-SNAPSHOT.0
tags:
- name: test
servers:
- url: http://localhost:8080
paths:
/api/v1/test:
get:
tags:
- test
operationId: test
responses:
"200":
description: test operation
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TestBaseDto"
components:
schemas:
TestObjectType:
type: string
enum:
- TEST1
- TEST2
TestBaseDto:
type: object
properties:
something:
type: string
testObjectType:
$ref: "#/components/schemas/TestObjectType"
discriminator:
propertyName: testObjectType
mapping:
TEST2: '#/components/schemas/ExtendDto'
TEST1: '#/components/schemas/TestBaseDto'
ExtendDto:
allOf:
- $ref: '#/components/schemas/TestBaseDto'
- type: object
properties:
someItems:
type: array
items:
$ref: '#/components/schemas/TestBaseDto'

View File

@@ -1,11 +1,5 @@
.gitattributes
.gitignore
AuthApi.md
BodyApi.md
FormApi.md
HeaderApi.md
PathApi.md
QueryApi.md
README.md
apis/AuthApi.ts
apis/BodyApi.ts
@@ -17,6 +11,12 @@ apis/baseapi.ts
apis/exception.ts
auth/auth.ts
configuration.ts
docs/AuthApi.md
docs/BodyApi.md
docs/FormApi.md
docs/HeaderApi.md
docs/PathApi.md
docs/QueryApi.md
git_push.sh
http/http.ts
http/isomorphic-fetch.ts

View File

@@ -0,0 +1,103 @@
# .AuthApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testAuthHttpBasic**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
[**testAuthHttpBearer**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
# **testAuthHttpBasic**
> string testAuthHttpBasic()
To test HTTP basic authentication
### Example
```typescript
import { createConfiguration, AuthApi } from '';
const configuration = createConfiguration();
const apiInstance = new AuthApi(configuration);
const request = {};
const data = await apiInstance.testAuthHttpBasic(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
This endpoint does not need any parameter.
### Return type
**string**
### Authorization
[http_auth](README.md#http_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testAuthHttpBearer**
> string testAuthHttpBearer()
To test HTTP bearer authentication
### Example
```typescript
import { createConfiguration, AuthApi } from '';
const configuration = createConfiguration();
const apiInstance = new AuthApi(configuration);
const request = {};
const data = await apiInstance.testAuthHttpBearer(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
This endpoint does not need any parameter.
### Return type
**string**
### Authorization
[http_bearer_auth](README.md#http_bearer_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -0,0 +1,581 @@
# .BodyApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
[**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
[**testBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
[**testBodyMultipartFormdataSingleBinary**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
[**testEchoBodyAllOfPet**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
[**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
[**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
[**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
[**testEchoBodyStringEnum**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body
[**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
# **testBinaryGif**
> HttpFile testBinaryGif()
Test binary (gif) response body
### Example
```typescript
import { createConfiguration, BodyApi } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request = {};
const data = await apiInstance.testBinaryGif(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
This endpoint does not need any parameter.
### Return type
**HttpFile**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: image/gif
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testBodyApplicationOctetstreamBinary**
> string testBodyApplicationOctetstreamBinary()
Test body parameter(s)
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestBodyApplicationOctetstreamBinaryRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {
body: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
};
const data = await apiInstance.testBodyApplicationOctetstreamBinary(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **HttpFile**| |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/octet-stream
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testBodyMultipartFormdataArrayOfBinary**
> string testBodyMultipartFormdataArrayOfBinary()
Test array of binary in multipart mime
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest = {
files: [
{ data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
],
};
const data = await apiInstance.testBodyMultipartFormdataArrayOfBinary(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**files** | **Array&lt;HttpFile&gt;** | | defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testBodyMultipartFormdataSingleBinary**
> string testBodyMultipartFormdataSingleBinary()
Test single binary in multipart mime
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestBodyMultipartFormdataSingleBinaryRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {
myFile: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
};
const data = await apiInstance.testBodyMultipartFormdataSingleBinary(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**myFile** | [**HttpFile**] | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyAllOfPet**
> Pet testEchoBodyAllOfPet()
Test body parameter(s)
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyAllOfPetRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyAllOfPetRequest = {
// Pet object that needs to be added to the store (optional)
pet: null,
};
const data = await apiInstance.testEchoBodyAllOfPet(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | **Pet**| Pet object that needs to be added to the store |
### Return type
**Pet**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyFreeFormObjectResponseString**
> string testEchoBodyFreeFormObjectResponseString()
Test free form object
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyFreeFormObjectResponseStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {
// Free form object (optional)
body: {},
};
const data = await apiInstance.testEchoBodyFreeFormObjectResponseString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **any**| Free form object |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyPet**
> Pet testEchoBodyPet()
Test body parameter(s)
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyPetRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyPetRequest = {
// Pet object that needs to be added to the store (optional)
pet: {
id: 10,
name: "doggie",
category: {
id: 1,
name: "Dogs",
},
photoUrls: [
"photoUrls_example",
],
tags: [
{
id: 1,
name: "name_example",
},
],
status: "available",
},
};
const data = await apiInstance.testEchoBodyPet(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | **Pet**| Pet object that needs to be added to the store |
### Return type
**Pet**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyPetResponseString**
> string testEchoBodyPetResponseString()
Test empty response body
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyPetResponseStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyPetResponseStringRequest = {
// Pet object that needs to be added to the store (optional)
pet: {
id: 10,
name: "doggie",
category: {
id: 1,
name: "Dogs",
},
photoUrls: [
"photoUrls_example",
],
tags: [
{
id: 1,
name: "name_example",
},
],
status: "available",
},
};
const data = await apiInstance.testEchoBodyPetResponseString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | **Pet**| Pet object that needs to be added to the store |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyStringEnum**
> StringEnumRef testEchoBodyStringEnum()
Test string enum response body
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyStringEnumRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyStringEnumRequest = {
// String enum (optional)
body: "success",
};
const data = await apiInstance.testEchoBodyStringEnum(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **string**| String enum |
### Return type
**StringEnumRef**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEchoBodyTagResponseString**
> string testEchoBodyTagResponseString()
Test empty json (request body)
### Example
```typescript
import { createConfiguration, BodyApi } from '';
import type { BodyApiTestEchoBodyTagResponseStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new BodyApi(configuration);
const request: BodyApiTestEchoBodyTagResponseStringRequest = {
// Tag object (optional)
tag: {
id: 1,
name: "name_example",
},
};
const data = await apiInstance.testEchoBodyTagResponseString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tag** | **Tag**| Tag object |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -0,0 +1,194 @@
# .FormApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
[**testFormObjectMultipart**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema
[**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
# **testFormIntegerBooleanString**
> string testFormIntegerBooleanString()
Test form parameter(s)
### Example
```typescript
import { createConfiguration, FormApi } from '';
import type { FormApiTestFormIntegerBooleanStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new FormApi(configuration);
const request: FormApiTestFormIntegerBooleanStringRequest = {
integerForm: 1,
booleanForm: true,
stringForm: "stringForm_example",
};
const data = await apiInstance.testFormIntegerBooleanString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integerForm** | [**number**] | | (optional) defaults to undefined
**booleanForm** | [**boolean**] | | (optional) defaults to undefined
**stringForm** | [**string**] | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testFormObjectMultipart**
> string testFormObjectMultipart()
Test form parameter(s) for multipart schema
### Example
```typescript
import { createConfiguration, FormApi } from '';
import type { FormApiTestFormObjectMultipartRequest } from '';
const configuration = createConfiguration();
const apiInstance = new FormApi(configuration);
const request: FormApiTestFormObjectMultipartRequest = {
marker: {
name: "name_example",
},
};
const data = await apiInstance.testFormObjectMultipart(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**marker** | **TestFormObjectMultipartRequestMarker** | | defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testFormOneof**
> string testFormOneof()
Test form parameter(s) for oneOf schema
### Example
```typescript
import { createConfiguration, FormApi } from '';
import type { FormApiTestFormOneofRequest } from '';
const configuration = createConfiguration();
const apiInstance = new FormApi(configuration);
const request: FormApiTestFormOneofRequest = {
form1: "form1_example",
form2: 1,
form3: "form3_example",
form4: true,
id: 1,
name: "name_example",
};
const data = await apiInstance.testFormOneof(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**form1** | [**string**] | | (optional) defaults to undefined
**form2** | [**number**] | | (optional) defaults to undefined
**form3** | [**string**] | | (optional) defaults to undefined
**form4** | [**boolean**] | | (optional) defaults to undefined
**id** | [**number**] | | (optional) defaults to undefined
**name** | [**string**] | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -0,0 +1,75 @@
# .HeaderApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
# **testHeaderIntegerBooleanStringEnums**
> string testHeaderIntegerBooleanStringEnums()
Test header parameter(s)
### Example
```typescript
import { createConfiguration, HeaderApi } from '';
import type { HeaderApiTestHeaderIntegerBooleanStringEnumsRequest } from '';
const configuration = createConfiguration();
const apiInstance = new HeaderApi(configuration);
const request: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {
integerHeader: 1,
booleanHeader: true,
stringHeader: "string_header_example",
enumNonrefStringHeader: "success",
enumRefStringHeader: "success",
};
const data = await apiInstance.testHeaderIntegerBooleanStringEnums(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integerHeader** | [**number**] | | (optional) defaults to undefined
**booleanHeader** | [**boolean**] | | (optional) defaults to undefined
**stringHeader** | [**string**] | | (optional) defaults to undefined
**enumNonrefStringHeader** | [**&#39;success&#39; | &#39;failure&#39; | &#39;unclassified&#39;**]**Array<&#39;success&#39; &#124; &#39;failure&#39; &#124; &#39;unclassified&#39;>** | | (optional) defaults to undefined
**enumRefStringHeader** | **StringEnumRef** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -0,0 +1,72 @@
# .PathApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**
> string testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath()
Test path parameter(s)
### Example
```typescript
import { createConfiguration, PathApi } from '';
import type { PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest } from '';
const configuration = createConfiguration();
const apiInstance = new PathApi(configuration);
const request: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest = {
pathString: "path_string_example",
pathInteger: 1,
enumNonrefStringPath: "success",
enumRefStringPath: "success",
};
const data = await apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pathString** | [**string**] | | defaults to undefined
**pathInteger** | [**number**] | | defaults to undefined
**enumNonrefStringPath** | [**&#39;success&#39; | &#39;failure&#39; | &#39;unclassified&#39;**]**Array<&#39;success&#39; &#124; &#39;failure&#39; &#124; &#39;unclassified&#39;>** | | defaults to undefined
**enumRefStringPath** | **StringEnumRef** | | defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -0,0 +1,659 @@
# .QueryApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**deprecatedTest**](QueryApi.md#deprecatedTest) | **GET** /test/deprecated | Test deprecation
[**testEnumRefString**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)
[**testQueryDatetimeDateString**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s)
[**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
[**testQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
[**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
[**testQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
[**testQueryStyleFormExplodeFalseArrayString**](QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
[**testQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
# **deprecatedTest**
> string deprecatedTest()
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiDeprecatedTestRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiDeprecatedTestRequest = {
// name of pet (optional)
name: "name_example",
};
const data = await apiInstance.deprecatedTest(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | [**string**] | name of pet | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testEnumRefString**
> string testEnumRefString()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestEnumRefStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestEnumRefStringRequest = {
enumNonrefStringQuery: "success",
enumRefStringQuery: "success",
};
const data = await apiInstance.testEnumRefString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumNonrefStringQuery** | [**&#39;success&#39; | &#39;failure&#39; | &#39;unclassified&#39;**]**Array<&#39;success&#39; &#124; &#39;failure&#39; &#124; &#39;unclassified&#39;>** | | (optional) defaults to undefined
**enumRefStringQuery** | **StringEnumRef** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryDatetimeDateString**
> string testQueryDatetimeDateString()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryDatetimeDateStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryDatetimeDateStringRequest = {
datetimeQuery: new Date('1970-01-01T00:00:00.00Z'),
dateQuery: new Date('1970-01-01').toISOString().split('T')[0];,
stringQuery: "string_query_example",
};
const data = await apiInstance.testQueryDatetimeDateString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**datetimeQuery** | [**Date**] | | (optional) defaults to undefined
**dateQuery** | [**string**] | | (optional) defaults to undefined
**stringQuery** | [**string**] | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryIntegerBooleanString**
> string testQueryIntegerBooleanString()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryIntegerBooleanStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryIntegerBooleanStringRequest = {
integerQuery: 1,
booleanQuery: true,
stringQuery: "string_query_example",
};
const data = await apiInstance.testQueryIntegerBooleanString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integerQuery** | [**number**] | | (optional) defaults to undefined
**booleanQuery** | [**boolean**] | | (optional) defaults to undefined
**stringQuery** | [**string**] | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleDeepObjectExplodeTrueObject**
> string testQueryStyleDeepObjectExplodeTrueObject()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {
queryObject: {
id: 10,
name: "doggie",
category: {
id: 1,
name: "Dogs",
},
photoUrls: [
"photoUrls_example",
],
tags: [
{
id: 1,
name: "name_example",
},
],
status: "available",
},
};
const data = await apiInstance.testQueryStyleDeepObjectExplodeTrueObject(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **Pet** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleDeepObjectExplodeTrueObjectAllOf**
> string testQueryStyleDeepObjectExplodeTrueObjectAllOf()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {
queryObject: null,
};
const data = await apiInstance.testQueryStyleDeepObjectExplodeTrueObjectAllOf(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleFormExplodeFalseArrayInteger**
> string testQueryStyleFormExplodeFalseArrayInteger()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {
queryObject: [
1,
],
};
const data = await apiInstance.testQueryStyleFormExplodeFalseArrayInteger(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **Array&lt;number&gt;** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleFormExplodeFalseArrayString**
> string testQueryStyleFormExplodeFalseArrayString()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {
queryObject: [
"query_object_example",
],
};
const data = await apiInstance.testQueryStyleFormExplodeFalseArrayString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **Array&lt;string&gt;** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleFormExplodeTrueArrayString**
> string testQueryStyleFormExplodeTrueArrayString()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {
queryObject: {
values: [
"values_example",
],
},
};
const data = await apiInstance.testQueryStyleFormExplodeTrueArrayString(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleFormExplodeTrueObject**
> string testQueryStyleFormExplodeTrueObject()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleFormExplodeTrueObjectRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {
queryObject: {
id: 10,
name: "doggie",
category: {
id: 1,
name: "Dogs",
},
photoUrls: [
"photoUrls_example",
],
tags: [
{
id: 1,
name: "name_example",
},
],
status: "available",
},
};
const data = await apiInstance.testQueryStyleFormExplodeTrueObject(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **Pet** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
# **testQueryStyleFormExplodeTrueObjectAllOf**
> string testQueryStyleFormExplodeTrueObjectAllOf()
Test query parameter(s)
### Example
```typescript
import { createConfiguration, QueryApi } from '';
import type { QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest } from '';
const configuration = createConfiguration();
const apiInstance = new QueryApi(configuration);
const request: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {
queryObject: null,
};
const data = await apiInstance.testQueryStyleFormExplodeTrueObjectAllOf(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**queryObject** | **DataQuery** | | (optional) defaults to undefined
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -78,7 +78,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);

View File

@@ -78,7 +78,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,12 @@
apis/TestApi.ts
apis/index.ts
docs/ExtendDto.md
docs/TestApi.md
docs/TestBaseDto.md
docs/TestObjectType.md
index.ts
models/ExtendDto.ts
models/TestBaseDto.ts
models/TestObjectType.ts
models/index.ts
runtime.ts

View File

@@ -0,0 +1,57 @@
/* tslint:disable */
/* eslint-disable */
/**
* Minimal
* Api to reproduce bug
*
* The version of the OpenAPI document: 0.5.1-SNAPSHOT.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
TestBaseDto,
} from '../models/index';
import {
TestBaseDtoFromJSON,
TestBaseDtoToJSON,
} from '../models/index';
/**
*
*/
export class TestApi extends runtime.BaseAPI {
/**
*/
async testRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<TestBaseDto>>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
let urlPath = `/api/v1/test`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(TestBaseDtoFromJSON));
}
/**
*/
async test(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<TestBaseDto>> {
const response = await this.testRaw(initOverrides);
return await response.value();
}
}

View File

@@ -0,0 +1,3 @@
/* tslint:disable */
/* eslint-disable */
export * from './TestApi';

View File

@@ -0,0 +1,34 @@
# ExtendDto
## Properties
Name | Type
------------ | -------------
`someItems` | [Array&lt;TestBaseDto&gt;](TestBaseDto.md)
## Example
```typescript
import type { ExtendDto } from ''
// TODO: Update the object below with actual values
const example = {
"someItems": null,
} satisfies ExtendDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as ExtendDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,66 @@
# TestApi
All URIs are relative to *http://localhost:8080*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**test**](TestApi.md#test) | **GET** /api/v1/test | |
## test
> Array&lt;TestBaseDto&gt; test()
### Example
```ts
import {
Configuration,
TestApi,
} from '';
import type { TestRequest } from '';
async function example() {
console.log("🚀 Testing SDK...");
const api = new TestApi();
try {
const data = await api.test();
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**Array&lt;TestBaseDto&gt;**](TestBaseDto.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/json`
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | test operation | - |
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,36 @@
# TestBaseDto
## Properties
Name | Type
------------ | -------------
`something` | string
`testObjectType` | [TestObjectType](TestObjectType.md)
## Example
```typescript
import type { TestBaseDto } from ''
// TODO: Update the object below with actual values
const example = {
"something": null,
"testObjectType": null,
} satisfies TestBaseDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as TestBaseDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,32 @@
# TestObjectType
## Properties
Name | Type
------------ | -------------
## Example
```typescript
import type { TestObjectType } from ''
// TODO: Update the object below with actual values
const example = {
} satisfies TestObjectType
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as TestObjectType
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,5 @@
/* tslint:disable */
/* eslint-disable */
export * from './runtime';
export * from './apis/index';
export * from './models/index';

View File

@@ -0,0 +1,82 @@
/* tslint:disable */
/* eslint-disable */
/**
* Minimal
* Api to reproduce bug
*
* The version of the OpenAPI document: 0.5.1-SNAPSHOT.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 { mapValues } from '../runtime';
import type { TestBaseDto } from './TestBaseDto';
import {
TestBaseDtoFromJSON,
TestBaseDtoFromJSONTyped,
TestBaseDtoToJSON,
TestBaseDtoToJSONTyped,
} from './TestBaseDto';
import type { TestObjectType } from './TestObjectType';
import {
TestObjectTypeFromJSON,
TestObjectTypeFromJSONTyped,
TestObjectTypeToJSON,
TestObjectTypeToJSONTyped,
} from './TestObjectType';
/**
*
* @export
* @interface ExtendDto
*/
export interface ExtendDto extends TestBaseDto {
/**
*
* @type {Array<TestBaseDto>}
* @memberof ExtendDto
*/
someItems?: Array<TestBaseDto>;
}
/**
* Check if a given object implements the ExtendDto interface.
*/
export function instanceOfExtendDto(value: object): value is ExtendDto {
return true;
}
export function ExtendDtoFromJSON(json: any): ExtendDto {
return ExtendDtoFromJSONTyped(json, false);
}
export function ExtendDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtendDto {
if (json == null) {
return json;
}
return {
...TestBaseDtoFromJSONTyped(json, true),
'someItems': json['someItems'] == null ? undefined : ((json['someItems'] as Array<any>).map(TestBaseDtoFromJSON)),
};
}
export function ExtendDtoToJSON(json: any): ExtendDto {
return ExtendDtoToJSONTyped(json, false);
}
export function ExtendDtoToJSONTyped(value?: ExtendDto | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
...TestBaseDtoToJSONTyped(value, true),
'someItems': value['someItems'] == null ? undefined : ((value['someItems'] as Array<any>).map(TestBaseDtoToJSON)),
};
}

View File

@@ -0,0 +1,102 @@
/* tslint:disable */
/* eslint-disable */
/**
* Minimal
* Api to reproduce bug
*
* The version of the OpenAPI document: 0.5.1-SNAPSHOT.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 { mapValues } from '../runtime';
import type { TestObjectType } from './TestObjectType';
import {
TestObjectTypeFromJSON,
TestObjectTypeFromJSONTyped,
TestObjectTypeToJSON,
TestObjectTypeToJSONTyped,
} from './TestObjectType';
import { type ExtendDto, ExtendDtoFromJSONTyped, ExtendDtoToJSON, ExtendDtoToJSONTyped } from './ExtendDto';
/**
*
* @export
* @interface TestBaseDto
*/
export interface TestBaseDto {
/**
*
* @type {string}
* @memberof TestBaseDto
*/
something?: string;
/**
*
* @type {TestObjectType}
* @memberof TestBaseDto
*/
testObjectType?: TestObjectType;
}
/**
* Check if a given object implements the TestBaseDto interface.
*/
export function instanceOfTestBaseDto(value: object): value is TestBaseDto {
return true;
}
export function TestBaseDtoFromJSON(json: any): TestBaseDto {
return TestBaseDtoFromJSONTyped(json, false);
}
export function TestBaseDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean): TestBaseDto {
if (json == null) {
return json;
}
if (!ignoreDiscriminator) {
if (json['testObjectType'] === 'TEST2') {
return ExtendDtoFromJSONTyped(json, ignoreDiscriminator);
}
if (json['testObjectType'] === 'TEST1') {
return TestBaseDtoFromJSONTyped(json, true);
}
}
return {
'something': json['something'] == null ? undefined : json['something'],
'testObjectType': json['testObjectType'] == null ? undefined : TestObjectTypeFromJSON(json['testObjectType']),
};
}
export function TestBaseDtoToJSON(json: any): TestBaseDto {
return TestBaseDtoToJSONTyped(json, false);
}
export function TestBaseDtoToJSONTyped(value?: TestBaseDto | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
if (!ignoreDiscriminator) {
switch (value['testObjectType']) {
case 'TEST2':
return ExtendDtoToJSONTyped(value as ExtendDto, ignoreDiscriminator);
default:
return value;
}
}
return {
'something': value['something'],
'testObjectType': TestObjectTypeToJSON(value['testObjectType']),
};
}

View File

@@ -0,0 +1,54 @@
/* tslint:disable */
/* eslint-disable */
/**
* Minimal
* Api to reproduce bug
*
* The version of the OpenAPI document: 0.5.1-SNAPSHOT.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
*/
export const TestObjectType = {
TEST1: 'TEST1',
TEST2: 'TEST2',
unknown_default_open_api: '11184809'
} as const;
export type TestObjectType = typeof TestObjectType[keyof typeof TestObjectType];
export function instanceOfTestObjectType(value: any): boolean {
for (const key in TestObjectType) {
if (Object.prototype.hasOwnProperty.call(TestObjectType, key)) {
if (TestObjectType[key as keyof typeof TestObjectType] === value) {
return true;
}
}
}
return false;
}
export function TestObjectTypeFromJSON(json: any): TestObjectType {
return TestObjectTypeFromJSONTyped(json, false);
}
export function TestObjectTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TestObjectType {
return json as TestObjectType;
}
export function TestObjectTypeToJSON(value?: TestObjectType | null): any {
return value as any;
}
export function TestObjectTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): TestObjectType {
return value as TestObjectType;
}

View File

@@ -0,0 +1,5 @@
/* tslint:disable */
/* eslint-disable */
export * from './ExtendDto';
export * from './TestBaseDto';
export * from './TestObjectType';

View File

@@ -0,0 +1,432 @@
/* tslint:disable */
/* eslint-disable */
/**
* Minimal
* Api to reproduce bug
*
* The version of the OpenAPI document: 0.5.1-SNAPSHOT.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 const BASE_PATH = "http://localhost:8080".replace(/\/+$/, "");
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
set config(configuration: Configuration) {
this.configuration = configuration;
}
get basePath(): string {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi(): FetchAPI | undefined {
return this.configuration.fetchApi;
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get queryParamsStringify(): (params: HTTPQuery) => string {
return this.configuration.queryParamsStringify || querystring;
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
}
return undefined;
}
get headers(): HTTPHeaders | undefined {
return this.configuration.headers;
}
get credentials(): RequestCredentials | undefined {
return this.configuration.credentials;
}
}
export const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
private middleware: Middleware[];
constructor(protected configuration = DefaultConfig) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
/**
* 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.
*/
protected isJsonMime(mime: string | null | undefined): boolean {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
const { url, init } = await this.createFetchParams(context, initOverrides);
const response = await this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
}
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn =
typeof initOverrides === "function"
? initOverrides
: async () => initOverrides;
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit: RequestInit = {
...initParams,
...(await initOverrideFn({
init: initParams,
context,
}))
};
let body: any;
if (isFormData(overriddenInit.body)
|| (overriddenInit.body instanceof URLSearchParams)
|| isBlob(overriddenInit.body)) {
body = overriddenInit.body;
} else if (this.isJsonMime(headers['Content-Type'])) {
body = JSON.stringify(overriddenInit.body);
} else {
body = overriddenInit.body;
}
const init: RequestInit = {
...overriddenInit,
body
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = await middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
}) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
} else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
function isBlob(value: any): value is Blob {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value: any): value is FormData {
return typeof FormData !== "undefined" && value instanceof FormData;
}
export class ResponseError extends Error {
override name: "ResponseError" = "ResponseError";
constructor(public response: Response, msg?: string) {
super(msg);
}
}
export class FetchError extends Error {
override name: "FetchError" = "FetchError";
constructor(public cause: Error, msg?: string) {
super(msg);
}
}
export class RequiredError extends Error {
override name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
export type HTTPBody = Json | FormData | URLSearchParams;
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value as HTTPQuery, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
export function mapValues(data: any, fn: (item: any) => any) {
const result: { [key: string]: any } = {};
for (const key of Object.keys(data)) {
result[key] = fn(data[key]);
}
return result;
}
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface ErrorContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
error: unknown;
response?: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
onError?(context: ErrorContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value(): Promise<T> {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value(): Promise<void> {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value(): Promise<Blob> {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value(): Promise<string> {
return await this.raw.text();
};
}

View File

@@ -1,3 +1,7 @@
docs/AbstractUserDto.md
docs/BranchDto.md
docs/InternalAuthenticatedUserDto.md
docs/RemoteAuthenticatedUserDto.md
index.ts
models/AbstractUserDto.ts
models/BranchDto.ts

View File

@@ -0,0 +1,38 @@
# AbstractUserDto
## Properties
Name | Type
------------ | -------------
`username` | string
`branch` | [BranchDto](BranchDto.md)
`type` | string
## Example
```typescript
import type { AbstractUserDto } from ''
// TODO: Update the object below with actual values
const example = {
"username": null,
"branch": null,
"type": null,
} satisfies AbstractUserDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as AbstractUserDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,34 @@
# BranchDto
## Properties
Name | Type
------------ | -------------
`name` | string
## Example
```typescript
import type { BranchDto } from ''
// TODO: Update the object below with actual values
const example = {
"name": null,
} satisfies BranchDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as BranchDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,32 @@
# InternalAuthenticatedUserDto
## Properties
Name | Type
------------ | -------------
## Example
```typescript
import type { InternalAuthenticatedUserDto } from ''
// TODO: Update the object below with actual values
const example = {
} satisfies InternalAuthenticatedUserDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as InternalAuthenticatedUserDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,32 @@
# RemoteAuthenticatedUserDto
## Properties
Name | Type
------------ | -------------
## Example
```typescript
import type { RemoteAuthenticatedUserDto } from ''
// TODO: Update the object below with actual values
const example = {
} satisfies RemoteAuthenticatedUserDto
console.log(example)
// Convert the instance to a JSON string
const exampleJSON: string = JSON.stringify(example)
console.log(exampleJSON)
// Parse the JSON string back to an object
const exampleParsed = JSON.parse(exampleJSON) as RemoteAuthenticatedUserDto
console.log(exampleParsed)
```
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

View File

@@ -71,6 +71,7 @@ export function AbstractUserDtoFromJSONTyped(json: any, ignoreDiscriminator: boo
if (json['type'] === 'remote-authenticated') {
return RemoteAuthenticatedUserDtoFromJSONTyped(json, ignoreDiscriminator);
}
}
return {

View File

@@ -1,12 +1,12 @@
.gitattributes
.gitignore
DefaultApi.md
README.md
apis/DefaultApi.ts
apis/baseapi.ts
apis/exception.ts
auth/auth.ts
configuration.ts
docs/DefaultApi.md
git_push.sh
http/http.ts
http/isomorphic-fetch.ts

View File

@@ -0,0 +1,55 @@
# .DefaultApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**list**](DefaultApi.md#list) | **GET** /list |
# **list**
> ListPaged list()
### Example
```typescript
import { createConfiguration, DefaultApi } from '';
const configuration = createConfiguration();
const apiInstance = new DefaultApi(configuration);
const request = {};
const data = await apiInstance.list(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
This endpoint does not need any parameter.
### Return type
**ListPaged**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | OK | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -1,12 +1,12 @@
.gitattributes
.gitignore
DefaultApi.md
README.md
apis/DefaultApi.ts
apis/baseapi.ts
apis/exception.ts
auth/auth.ts
configuration.ts
docs/DefaultApi.md
git_push.sh
http/http.ts
http/isomorphic-fetch.ts

View File

@@ -0,0 +1,55 @@
# .DefaultApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**uniqueItems**](DefaultApi.md#uniqueItems) | **GET** /unique-items |
# **uniqueItems**
> Response uniqueItems()
### Example
```typescript
import { createConfiguration, DefaultApi } from '';
const configuration = createConfiguration();
const apiInstance = new DefaultApi(configuration);
const request = {};
const data = await apiInstance.uniqueItems(request);
console.log('API called successfully. Returned data:', data);
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Response**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | OK | - |
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

View File

@@ -1,12 +1,12 @@
.gitattributes
.gitignore
DefaultApi.md
README.md
apis/DefaultApi.ts
apis/baseapi.ts
apis/exception.ts
auth/auth.ts
configuration.ts
docs/DefaultApi.md
git_push.sh
http/http.ts
http/isomorphic-fetch.ts

File diff suppressed because it is too large Load Diff

View File

@@ -1213,10 +1213,8 @@ public class ApiClient extends JavaTimeFormatter {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (authNames != null && response.getStatusInfo().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1230,6 +1228,8 @@ public class ApiClient extends JavaTimeFormatter {
}
}
}
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);

View File

@@ -1213,10 +1213,8 @@ public class ApiClient extends JavaTimeFormatter {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (authNames != null && response.getStatusInfo().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1230,6 +1228,8 @@ public class ApiClient extends JavaTimeFormatter {
}
}
}
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);

View File

@@ -1295,10 +1295,8 @@ public class ApiClient extends JavaTimeFormatter {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (authNames != null && statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (authNames != null && response.getStatusInfo().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1313,6 +1311,8 @@ public class ApiClient extends JavaTimeFormatter {
}
}
final int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (statusCode == Status.NO_CONTENT.getStatusCode()) {

View File

@@ -138,3 +138,4 @@
</plugins>
</build>
</project>

View File

@@ -0,0 +1,113 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "tests",
"projects": {
"test-default": {
"root": "tests/default",
"sourceRoot": "tests/default/src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "tests/default/dist",
"index": "tests/default/src/index.html",
"main": "tests/default/src/main.ts",
"polyfills": "tests/default/src/polyfills.ts",
"tsConfig": "tests/default/src/tsconfig.app.json",
"assets": [
"tests/default/src/favicon.ico",
"tests/default/src/assets"
],
"styles": [
"tests/default/src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "tests/default/src/environments/environment.ts",
"with": "tests/default/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"development": {}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
},
"configurations": {
"production": {
"browserTarget": "test-default:build:production"
},
"development": {
"browserTarget": "test-default:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "test-default:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "tests/default/src/test.ts",
"polyfills": "tests/default/src/polyfills.ts",
"tsConfig": "tests/default/src/tsconfig.spec.json",
"karmaConfig": "tests/default/src/karma.conf.js",
"styles": [
"tests/default/src/styles.css"
],
"scripts": [],
"assets": [
"tests/default/src/favicon.ico",
"tests/default/src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tests/default/src/tsconfig.app.json",
"tests/default/src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {
"analytics": false
}
}

View File

@@ -101,7 +101,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -162,7 +162,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -228,7 +228,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -295,7 +295,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -354,7 +354,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -424,7 +424,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -506,7 +506,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -592,7 +592,7 @@ export class PetService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);

View File

@@ -83,7 +83,7 @@ export class StoreService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -137,7 +137,7 @@ export class StoreService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -193,7 +193,7 @@ export class StoreService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -259,7 +259,7 @@ export class StoreService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);

View File

@@ -96,7 +96,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -163,7 +163,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -230,7 +230,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -287,7 +287,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -343,7 +343,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -410,7 +410,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -463,7 +463,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
@@ -534,7 +534,7 @@ export class UserService extends BaseService {
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
{
"name": "typescript-angular-v16-unit-tests",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"update": "ng update"
},
"private": true,
"dependencies": {
"@angular/animations": "^16.1.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/forms": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"@angular/platform-browser-dynamic": "^16.1.2",
"@angular/router": "^16.1.2",
"core-js": "^3.31.0",
"rxjs": "^7.8.1",
"tslib": "^2.5.3",
"zone.js": "~0.13.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.1",
"@angular/cli": "^16.1.1",
"@angular/compiler-cli": "^16.1.2",
"@angular/language-service": "^16.1.2",
"@types/jasmine": "~4.3.4",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^18.16.18",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"eslint": "^8.43.0",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"jasmine-core": "~5.0.1",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"ts-node": "~10.9.1",
"typescript": "^5.1.3"
}
}

View File

@@ -0,0 +1,141 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>typescript-angular-v17-provided-in-root-tests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Typescript-Angular v17 Petstore Client</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>withnpmm-npm-install</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<basedir>builds/with-npm</basedir>
<arguments>
<argument>--legacy-peer-deps</argument>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>withnpmm-npm-run-build</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<basedir>builds/with-npm</basedir>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>clean-typescript-angular-v16-test-outputs</id>
<goals>
<goal>clean</goal>
</goals>
<phase>post-integration-test</phase>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>builds/with-npm</directory>
<followSymlinks>false</followSymlinks>
<useDefaultExcludes>false</useDefaultExcludes>
<includes>
<include>dist/**</include>
<include>node_modules/**</include>
<include>package-lock.json</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>test</argument>
<argument>--</argument>
<argument>--progress=false</argument>
<argument>--no-watch</argument>
<argument>--browsers</argument>
<argument>ChromeHeadless</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,44 @@
<div>
<h1>
Welcome to {{ title }}!
</h1>
</div>
<section id="pet-api">
<h2>Pet API</h2>
<button (click)="addPet()">
Add pet
</button>
<button (click)="getPetByID()">
Get pet by ID
</button>
<button (click)="updatePet()">
Update pet by ID
</button>
<button (click)="deletePet()">
Delete pet
</button>
</section>
<section id="pet">
<h2>Pet</h2>
<div *ngIf="pet">
<p>Name: {{ pet.name }}</p>
<p>ID: {{ pet.id }}</p>
</div>
</section>
<section id="store-api">
<h2>Store API</h2>
<button (click)="getStoreInventory()">
Get inventory
</button>
</section>
<section id="store">
<h2>Store</h2>
<ul *ngIf="store">
<li *ngFor="let item of store">{{item.key}}: {{item.number}}</li>
</ul>
</section>

View File

@@ -0,0 +1,91 @@
import { TestBed, waitForAsync } from '@angular/core/testing'
import { HttpClientModule } from '@angular/common/http'
import {
ApiModule,
Configuration,
type ConfigurationParameters,
PetService,
StoreService,
UserService
} from '@swagger/typescript-angular-petstore'
import { AppComponent } from './app.component'
import { fakePetstoreBackendProviders } from '../test/fakeBackend'
describe('AppComponent', () => {
const apiConfigurationParams: ConfigurationParameters = {
// add configuration params here
apiKeys: { api_key: 'foobar' }
}
const apiConfig = new Configuration(apiConfigurationParams)
const getApiConfig: () => Configuration = () => {
return apiConfig
}
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
ApiModule.forRoot(getApiConfig)
],
providers: [
PetService,
StoreService,
UserService,
...fakePetstoreBackendProviders
],
declarations: [
AppComponent
]
}).compileComponents()
}))
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.debugElement.componentInstance
expect(app).toBeTruthy()
}))
it('should render title in a h1 tag', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent)
fixture.detectChanges()
const compiled = fixture.debugElement.nativeElement
expect(compiled.querySelector('h1').textContent).toContain('Welcome to Typescript Angular v16 (provided in root)!')
}))
describe('constructor()', () => {
it('should have a petService provided', () => {
const petService = TestBed.inject(PetService)
expect(petService).toBeTruthy()
})
it('should have a storeService provided', () => {
const storeService = TestBed.inject(StoreService)
expect(storeService).toBeTruthy()
})
it('should have a userService provided', () => {
const userService = TestBed.inject(UserService)
expect(userService).toBeTruthy()
})
})
describe('addPet()', () => {
it('should add a new pet', () => {
const fixture = TestBed.createComponent(AppComponent)
const instance = fixture.componentInstance
const petService = TestBed.inject(PetService)
spyOn(petService, 'addPet').and.callThrough()
fixture.detectChanges()
instance.addPet()
expect(petService.addPet).toHaveBeenCalledWith({
name: 'pet',
photoUrls: []
})
})
})
})

View File

@@ -0,0 +1,75 @@
import { Component } from '@angular/core'
import {
PetService,
StoreService,
UserService,
type Pet
} from '@swagger/typescript-angular-petstore'
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Typescript Angular v16 (provided in root)'
pet: Pet
store: Array<{ key: string, number: number }>
constructor (private readonly petService: PetService,
private readonly storeService: StoreService,
private readonly userService: UserService
) {
this.pet = {
name: 'pet',
photoUrls: []
}
}
public addPet (): void {
this.petService.addPet(this.pet)
.subscribe((result: Pet) => {
this.pet = result
}
)
}
public getPetByID (): void {
if (this.pet.id !== undefined) {
this.petService.getPetById(this.pet.id)
.subscribe((result: Pet) => {
this.pet = result
}
)
}
}
public updatePet (): void {
this.petService.updatePet(this.pet)
.subscribe((result: Pet) => {
this.pet = result
}
)
}
public deletePet (): void {
if (this.pet.id !== undefined) {
this.petService.deletePet(this.pet.id)
.subscribe((result) => {
this.pet = result
}
)
}
}
public getStoreInventory (): void {
this.storeService.getInventory()
.subscribe((result) => {
this.store = []
for (const item in result) {
const number = result[item]
this.store.push({ key: item, number })
}
})
}
}

View File

@@ -0,0 +1,35 @@
import { BrowserModule } from '@angular/platform-browser'
import { NgModule } from '@angular/core'
import { HttpClientModule } from '@angular/common/http'
import {
ApiModule,
Configuration,
type ConfigurationParameters
} from '@swagger/typescript-angular-petstore'
import { AppComponent } from './app.component'
export const apiConfigurationParams: ConfigurationParameters = {
credentials: { api_key: 'foobar' }
}
export const apiConfig = new Configuration(apiConfigurationParams)
export function getApiConfig () {
return apiConfig
}
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule,
ApiModule.forRoot(getApiConfig)
],
providers: [
],
bootstrap: [AppComponent]
})
export class AppModule { }

Some files were not shown because too many files have changed in this diff Show More