diff --git a/.github/workflows/gradle-plugin-tests.yaml b/.github/workflows/gradle-plugin-tests.yaml index 135a74263c30..bd1f2d21c9ff 100644 --- a/.github/workflows/gradle-plugin-tests.yaml +++ b/.github/workflows/gradle-plugin-tests.yaml @@ -20,7 +20,7 @@ jobs: java-version: 11 distribution: 'temurin' - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-maven-repository with: diff --git a/.github/workflows/gradle-test.yaml b/.github/workflows/gradle-test.yaml index 7bf6cce1d635..8923e20077b6 100644 --- a/.github/workflows/gradle-test.yaml +++ b/.github/workflows/gradle-test.yaml @@ -37,14 +37,14 @@ jobs: java-version: 11 # Cache Gradle Dependencies - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} # Cache Gradle Wrapper - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 6bb3083d76a2..ea2ad33a39fc 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -28,14 +28,14 @@ jobs: distribution: 'temurin' java-version: ${{ matrix.java }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.gradle/caches diff --git a/.github/workflows/maven-plugin-tests.yaml b/.github/workflows/maven-plugin-tests.yaml index c64c9d14748e..4844576096b6 100644 --- a/.github/workflows/maven-plugin-tests.yaml +++ b/.github/workflows/maven-plugin-tests.yaml @@ -20,7 +20,7 @@ jobs: java-version: 11 distribution: 'temurin' - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-maven-repository with: diff --git a/.github/workflows/openapi-generator.yaml b/.github/workflows/openapi-generator.yaml index 177297ad00f7..1e9fb800ba5f 100644 --- a/.github/workflows/openapi-generator.yaml +++ b/.github/workflows/openapi-generator.yaml @@ -22,7 +22,7 @@ jobs: java-version: 11 distribution: 'temurin' - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-maven-repository with: @@ -60,7 +60,7 @@ jobs: java-version: 11 distribution: 'temurin' - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-maven-repository with: diff --git a/.github/workflows/samples-dart.yaml b/.github/workflows/samples-dart.yaml index a2c4f59d8108..02b6c487ac88 100644 --- a/.github/workflows/samples-dart.yaml +++ b/.github/workflows/samples-dart.yaml @@ -24,7 +24,7 @@ jobs: java-version: 11 cache: maven - name: Cache test dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: pub-cache with: diff --git a/.github/workflows/samples-groovy.yaml b/.github/workflows/samples-groovy.yaml index 8a5a20bc5553..68c38aaa6ede 100644 --- a/.github/workflows/samples-groovy.yaml +++ b/.github/workflows/samples-groovy.yaml @@ -27,7 +27,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-client-echo-api-jdk11.yaml b/.github/workflows/samples-java-client-echo-api-jdk11.yaml index f1fe59ac1fee..96635a4d3f92 100644 --- a/.github/workflows/samples-java-client-echo-api-jdk11.yaml +++ b/.github/workflows/samples-java-client-echo-api-jdk11.yaml @@ -28,7 +28,7 @@ jobs: distribution: 'temurin' java-version: 11 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-client-echo-api-jdk8.yaml b/.github/workflows/samples-java-client-echo-api-jdk8.yaml index a8d874db664f..2c5cbb93711e 100644 --- a/.github/workflows/samples-java-client-echo-api-jdk8.yaml +++ b/.github/workflows/samples-java-client-echo-api-jdk8.yaml @@ -35,7 +35,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-client-jdk11.yaml b/.github/workflows/samples-java-client-jdk11.yaml index 605eca642eac..358ea1b02c31 100644 --- a/.github/workflows/samples-java-client-jdk11.yaml +++ b/.github/workflows/samples-java-client-jdk11.yaml @@ -78,7 +78,7 @@ jobs: distribution: 'temurin' java-version: 11 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-client-jdk17.yaml b/.github/workflows/samples-java-client-jdk17.yaml index a0085de209db..65bdb2a3413b 100644 --- a/.github/workflows/samples-java-client-jdk17.yaml +++ b/.github/workflows/samples-java-client-jdk17.yaml @@ -27,7 +27,7 @@ jobs: distribution: 'temurin' java-version: 17 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-helidon.yaml b/.github/workflows/samples-java-helidon.yaml index 3a2e97e18b13..0ea61f91ff52 100644 --- a/.github/workflows/samples-java-helidon.yaml +++ b/.github/workflows/samples-java-helidon.yaml @@ -29,7 +29,7 @@ jobs: distribution: 'temurin' java-version: ${{ matrix.version }} - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-play-framework.yaml b/.github/workflows/samples-java-play-framework.yaml index 73d220624384..f4e6d8e8597c 100644 --- a/.github/workflows/samples-java-play-framework.yaml +++ b/.github/workflows/samples-java-play-framework.yaml @@ -35,7 +35,7 @@ jobs: distribution: 'temurin' java-version: 11 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-server-jdk8.yaml b/.github/workflows/samples-java-server-jdk8.yaml index b984fa19d8be..51de7249423f 100644 --- a/.github/workflows/samples-java-server-jdk8.yaml +++ b/.github/workflows/samples-java-server-jdk8.yaml @@ -38,7 +38,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-java-wiremock.yaml b/.github/workflows/samples-java-wiremock.yaml index d6a6df2ad7d0..4398c723236f 100644 --- a/.github/workflows/samples-java-wiremock.yaml +++ b/.github/workflows/samples-java-wiremock.yaml @@ -23,7 +23,7 @@ jobs: distribution: 'temurin' java-version: 11 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-jaxrs-jdk11.yaml b/.github/workflows/samples-jaxrs-jdk11.yaml index 07581168ad64..0af4e77544a2 100644 --- a/.github/workflows/samples-jaxrs-jdk11.yaml +++ b/.github/workflows/samples-jaxrs-jdk11.yaml @@ -24,7 +24,7 @@ jobs: distribution: 'temurin' java-version: 11 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-jaxrs.yaml b/.github/workflows/samples-jaxrs.yaml index 1e8f80d4851d..3e709c111d9d 100644 --- a/.github/workflows/samples-jaxrs.yaml +++ b/.github/workflows/samples-jaxrs.yaml @@ -44,7 +44,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-jdk17.yaml b/.github/workflows/samples-jdk17.yaml index 9ea67b210e1d..41ebe0190d9c 100644 --- a/.github/workflows/samples-jdk17.yaml +++ b/.github/workflows/samples-jdk17.yaml @@ -54,7 +54,7 @@ jobs: distribution: 'temurin' java-version: 17 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-kotlin-client.yaml b/.github/workflows/samples-kotlin-client.yaml index d42d47717f0f..7ec4a90ece25 100644 --- a/.github/workflows/samples-kotlin-client.yaml +++ b/.github/workflows/samples-kotlin-client.yaml @@ -75,7 +75,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-kotlin-server-jdk17.yaml b/.github/workflows/samples-kotlin-server-jdk17.yaml index f36a3fa48382..79186a7e1776 100644 --- a/.github/workflows/samples-kotlin-server-jdk17.yaml +++ b/.github/workflows/samples-kotlin-server-jdk17.yaml @@ -38,7 +38,7 @@ jobs: distribution: 'temurin' java-version: 17 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml index cce5b85a54d1..8777ffcbeccd 100644 --- a/.github/workflows/samples-kotlin-server.yaml +++ b/.github/workflows/samples-kotlin-server.yaml @@ -50,7 +50,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-python-petstore.yaml b/.github/workflows/samples-python-petstore.yaml index 4cf215d0c8d9..c04b857a4bab 100644 --- a/.github/workflows/samples-python-petstore.yaml +++ b/.github/workflows/samples-python-petstore.yaml @@ -39,7 +39,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}- path: | diff --git a/.github/workflows/samples-python-pydantic-v1-petstore.yaml b/.github/workflows/samples-python-pydantic-v1-petstore.yaml index cf898074d30e..1d3ff5878600 100644 --- a/.github/workflows/samples-python-pydantic-v1-petstore.yaml +++ b/.github/workflows/samples-python-pydantic-v1-petstore.yaml @@ -39,7 +39,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}- path: | diff --git a/.github/workflows/samples-r.yaml b/.github/workflows/samples-r.yaml new file mode 100644 index 000000000000..dc5205fb2d78 --- /dev/null +++ b/.github/workflows/samples-r.yaml @@ -0,0 +1,42 @@ +name: Samples R + +on: + push: + paths: + - 'samples/client/echo_api/r/**' + pull_request: + paths: + - 'samples/client/echo_api/r/**' + +jobs: + build: + name: Build R + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - 'samples/client/echo_api/r/' + steps: + - uses: actions/checkout@v4 + - name: Setup node.js + uses: actions/setup-node@v4 + - name: Run echo server + run: | + git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server + (cd http-echo-server && npm install && npm start &) + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 3.6.1 + - uses: r-lib/actions/setup-r-dependencies@v2 + working-directory: ${{ matrix.sample }} + with: + cache-version: 2 + - name: Install curl + run: sudo apt-get install -y r-cran-curl + - name: build and test + working-directory: ${{ matrix.sample }} + run: | + # export _R_CHECK_FORCE_SUGGESTS_=false + /bin/bash build_and_test.bash + shell: bash diff --git a/.github/workflows/samples-scala.yaml b/.github/workflows/samples-scala.yaml index 9e9eb8c249ed..953b35355c79 100644 --- a/.github/workflows/samples-scala.yaml +++ b/.github/workflows/samples-scala.yaml @@ -39,7 +39,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-spring-jdk17.yaml b/.github/workflows/samples-spring-jdk17.yaml index 10206fafe070..76a6aa76ceaf 100644 --- a/.github/workflows/samples-spring-jdk17.yaml +++ b/.github/workflows/samples-spring-jdk17.yaml @@ -24,7 +24,7 @@ jobs: distribution: 'temurin' java-version: 17 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/samples-spring.yaml b/.github/workflows/samples-spring.yaml index 60279c833753..063c38e566cd 100644 --- a/.github/workflows/samples-spring.yaml +++ b/.github/workflows/samples-spring.yaml @@ -64,7 +64,7 @@ jobs: distribution: 'temurin' java-version: 8 - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: maven-repository with: diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index ddb2d75a7138..211fa1a40b4a 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -25,7 +25,7 @@ jobs: java-version: ${{ matrix.java }} distribution: 'temurin' - name: Cache maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-maven-repository with: diff --git a/bin/configs/r-echo-api.yaml b/bin/configs/r-echo-api.yaml new file mode 100644 index 000000000000..4e631725783e --- /dev/null +++ b/bin/configs/r-echo-api.yaml @@ -0,0 +1,6 @@ +generatorName: r +outputDir: samples/client/echo_api/r +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/r +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 76b98ac0d77d..bce79d0b61f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -347,7 +347,7 @@ public String toString() { sb.append(", isVoid=").append(isVoid); sb.append(", isResponseBinary=").append(isResponseBinary); sb.append(", isResponseFile=").append(isResponseFile); - sb.append(", isResponseFile=").append(isResponseOptional); + sb.append(", isResponseOptional=").append(isResponseOptional); sb.append(", hasReference=").append(hasReference); sb.append(", hasDefaultResponse=").append(hasDefaultResponse); sb.append(", hasErrorResponseObject=").append(hasErrorResponseObject); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 0eb4fa5c55d5..637727ebbecd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -4507,6 +4507,11 @@ public CodegenOperation fromOperation(String path, if (operation == null) throw new RuntimeException("operation cannot be null in fromOperation"); + if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-internal"))) { + LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true", + httpMethod, path, operation.getOperationId()); + } + Map schemas = ModelUtils.getSchemas(this.openAPI); CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION); Set imports = new HashSet<>(); @@ -8197,51 +8202,6 @@ public int hashCode() { } } - /** - * This method has been kept to keep the introduction of ModelUtils.isAnyType as a non-breaking change - * this way, existing forks of our generator can continue to use this method - * TODO in 6.0.0 replace this method with ModelUtils.isAnyType - * Return true if the schema value can be any type, i.e. it can be - * the null value, integer, number, string, object or array. - * One use case is when the "type" attribute in the OAS schema is unspecified. - * - * Examples: - * - * arbitraryTypeValue: - * description: This is an arbitrary type schema. - * It is not a free-form object. - * The value can be any type except the 'null' value. - * arbitraryTypeNullableValue: - * description: This is an arbitrary type schema. - * It is not a free-form object. - * The value can be any type, including the 'null' value. - * nullable: true - * - * @param schema the OAS schema. - * @return true if the schema value can be an arbitrary type. - */ - public boolean isAnyTypeSchema(Schema schema) { - if (schema == null) { - once(LOGGER).error("Schema cannot be null in isAnyTypeSchema check"); - return false; - } - - if (ModelUtils.isFreeFormObject(schema)) { - // make sure it's not free form object - return false; - } - - if (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null && - (schema.getProperties() == null || schema.getProperties().isEmpty()) && - schema.getAdditionalProperties() == null && schema.getNot() == null && - schema.getEnum() == null) { - return true; - // If and when type arrays are supported in a future OAS specification, - // we could return true if the type array includes all possible JSON schema types. - } - return false; - } - /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 6af7f8cfb430..b4ae0a7842f1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -508,7 +508,10 @@ void generateModels(List files, List allModels, List unu Schema schema = schemas.get(name); - if (ModelUtils.isFreeFormObject(schema)) { // check to see if it's a free-form object + if (schema.getExtensions() != null && Boolean.TRUE.equals(schema.getExtensions().get("x-internal"))) { + LOGGER.info("Model {} not generated since x-internal is set to true", name); + continue; + } else if (ModelUtils.isFreeFormObject(schema)) { // check to see if it's a free-form object if (!ModelUtils.shouldGenerateFreeFormObjectModel(name, config)) { LOGGER.info("Model {} not generated since it's a free-form object", name); continue; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java index fc6806f13169..f5032301b739 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java @@ -419,6 +419,8 @@ public ExtendedCodegenOperation(CodegenOperation o) { this.isArray = o.isArray; this.isMultipart = o.isMultipart; this.isResponseBinary = o.isResponseBinary; + this.isResponseFile = o.isResponseFile; + this.isResponseOptional = o.isResponseOptional; this.hasReference = o.hasReference; this.isRestfulIndex = o.isRestfulIndex; this.isRestfulShow = o.isRestfulShow; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java index e18d765a981c..f5d72b984d74 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java @@ -140,6 +140,7 @@ public PerlClientCodegen() { typeMapping.put("set", "ARRAY"); typeMapping.put("map", "HASH"); typeMapping.put("object", "object"); + typeMapping.put("AnyType", "object"); typeMapping.put("binary", "string"); typeMapping.put("file", "string"); typeMapping.put("ByteArray", "string"); @@ -158,8 +159,8 @@ public PerlClientCodegen() { // option to change the order of form/body parameter cliOptions.add(CliOption.newBoolean( - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) .defaultValue(Boolean.FALSE.toString())); } @@ -201,6 +202,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + supportingFiles.add(new SupportingFile("cpanfile.mustache", "", "cpanfile")); } @Override @@ -699,9 +701,9 @@ public CodegenModel fromModel(String name, Schema sc) { * A custom version is made for this method to ensure that * property.format remains empty string * - * @param name name of the property - * @param p OAS property schema - * @param required true if the property is required in the next higher object schema, false otherwise + * @param name name of the property + * @param p OAS property schema + * @param required true if the property is required in the next higher object schema, false otherwise * @param schemaIsFromAdditionalProperties true if the property is defined by additional properties schema * @return Codegen Property object */ @@ -713,5 +715,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo } @Override - public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.PERL; } + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.PERL; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index a5e6be37b78b..40f766cf524a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -1303,6 +1303,7 @@ public ExtendedCodegenOperation(CodegenOperation o) { this.isMultipart = o.isMultipart; this.isResponseBinary = o.isResponseBinary; this.isResponseFile = o.isResponseFile; + this.isResponseOptional = o.isResponseOptional; this.hasReference = o.hasReference; this.isRestfulIndex = o.isRestfulIndex; this.isRestfulShow = o.isRestfulShow; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/RestApplication.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/RestApplication.mustache index 92459a5b7cd4..4f7ce12fd02c 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/RestApplication.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/RestApplication.mustache @@ -9,7 +9,7 @@ import {{javaxPackage}}.ws.rs.core.Application; {{#appName}},title = "{{{.}}}"{{/appName}} {{#appDescription}},description = "{{{.}}}"{{/appDescription}} {{#license}},license = @org.eclipse.microprofile.openapi.annotations.info.License(name = "{{{licenseInfo}}}", url = "{{{licenseUrl}}}"){{/license}} - {{#contact}},contact = @org.eclipse.microprofile.openapi.annotations.info.Contact(name = "{{{infoName}}}", email = "{{{infoEmail}}}"){{/contact}} + {{#contact}},contact = @org.eclipse.microprofile.openapi.annotations.info.Contact(name = "{{{infoName}}}", email = "{{{infoEmail}}}", url = "{{{infoUrl}}}"){{/contact}} )){{/info}}{{/openAPI}}{{/useMicroProfileOpenAPIAnnotations}} @ApplicationPath(RestResourceRoot.APPLICATION_PATH) public class RestApplication extends Application { diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache index 4bc0161261e5..506bb7f45180 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache @@ -43,7 +43,7 @@ class {{{classname}}} { {{#defaultValue}}defaultValue: {{{defaultValue}}},{{/defaultValue}} name: r'{{{baseName}}}', required: {{#required}}true{{/required}}{{^required}}false{{/required}}, - includeIfNull: {{#required}}{{#isNullable}}true{{/isNullable}}false{{/required}}{{^required}}false{{/required}} + includeIfNull: {{#required}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/required}}{{^required}}false{{/required}} ) {{/isBinary}} {{#isBinary}} diff --git a/modules/openapi-generator/src/main/resources/perl/Configuration.mustache b/modules/openapi-generator/src/main/resources/perl/Configuration.mustache index 346f5e305580..be4d8bee73ef 100644 --- a/modules/openapi-generator/src/main/resources/perl/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/perl/Configuration.mustache @@ -82,7 +82,7 @@ sub new { # class/static variables $p{http_timeout} //= 180; - $p{http_user_agent} //= '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{moduleVersion}}}/perl{{/httpUserAgent}}'; + $p{http_user_agent} //= '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/' . VERSION . '/perl{{/httpUserAgent}}'; # authentication setting $p{api_key} //= {}; diff --git a/modules/openapi-generator/src/main/resources/perl/api_test.mustache b/modules/openapi-generator/src/main/resources/perl/api_test.mustache index 214c3d03039c..d055ddb653d9 100644 --- a/modules/openapi-generator/src/main/resources/perl/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/perl/api_test.mustache @@ -4,7 +4,7 @@ # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -29,3 +29,5 @@ isa_ok($api, '{{moduleName}}::{{classname}}'); {{/operation}} {{/operations}} + +done_testing(); diff --git a/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache b/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache new file mode 100644 index 000000000000..402fd48a247d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache @@ -0,0 +1,11 @@ +requires 'Class::Accessor'; +requires 'Test::Exception'; +requires 'Test::More'; +requires 'Log::Any'; +requires 'LWP::UserAgent'; +requires 'URI::Query'; +requires 'Module::Runtime'; +requires 'DateTime'; +requires 'Module::Find'; +requires 'Moose::Role'; +requires 'JSON', '>= 2.00, < 2.80'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/perl/object_test.mustache b/modules/openapi-generator/src/main/resources/perl/object_test.mustache index 394d3daa3337..71328bab5af4 100644 --- a/modules/openapi-generator/src/main/resources/perl/object_test.mustache +++ b/modules/openapi-generator/src/main/resources/perl/object_test.mustache @@ -4,7 +4,7 @@ # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -23,3 +23,5 @@ use_ok('{{moduleName}}::Object::{{classname}}'); {{/model}} {{/models}} + +done_testing(); diff --git a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache index 00b23629acb4..177ec4cd84ad 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache @@ -571,7 +571,7 @@ impl std::str::FromStr for {{{classname}}} { impl PartialEq for {{{classname}}} { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } } {{/anyOf.size}} @@ -604,7 +604,7 @@ impl std::str::FromStr for {{{classname}}} { impl PartialEq for {{{classname}}} { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } } {{/oneOf.size}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 23aa2e526804..9bed60ee16aa 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -351,10 +351,24 @@ export class {{classname}} extends runtime.BaseAPI { {{/isDeprecated}} */ {{^useSingleRequestParameter}} - async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}> { + async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> { {{#returnType}} const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides); + {{#isResponseOptional}} + switch (response.raw.status) { + {{#responses}} + {{#is2xx}} + case {{code}}: + return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}}; + {{/is2xx}} + {{/responses}} + default: + return await response.value(); + } + {{/isResponseOptional}} + {{^isResponseOptional}} return await response.value(); + {{/isResponseOptional}} {{/returnType}} {{^returnType}} await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides); @@ -362,10 +376,24 @@ export class {{classname}} extends runtime.BaseAPI { } {{/useSingleRequestParameter}} {{#useSingleRequestParameter}} - async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}> { + async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> { {{#returnType}} const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides); + {{#isResponseOptional}} + switch (response.raw.status) { + {{#responses}} + {{#is2xx}} + case {{code}}: + return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}}; + {{/is2xx}} + {{/responses}} + default: + return await response.value(); + } + {{/isResponseOptional}} + {{^isResponseOptional}} return await response.value(); + {{/isResponseOptional}} {{/returnType}} {{^returnType}} await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index c750dbabed7d..1d6a5978343a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -74,6 +74,16 @@ public void testDeeplyNestedAdditionalPropertiesImports() { Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1); } + @Test + public void testOptionalResponseImports() { + final DefaultCodegen codegen = new DefaultCodegen(); + final OpenAPI openApi = TestUtils.parseFlattenSpec("src/test/resources/3_0/optionalResponse.yaml"); + codegen.setOpenAPI(openApi); + PathItem path = openApi.getPaths().get("/api/Users/{userId}"); + CodegenOperation operation = codegen.fromOperation("/api/Users/{userId}", "get", path.getGet(), path.getServers()); + Assert.assertEquals(operation.isResponseOptional, true); + } + @Test public void testEnumImports() { final DefaultCodegen codegen = new DefaultCodegen(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java index a6bccbff1ac7..31a67ed61901 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java @@ -1,11 +1,13 @@ package org.openapitools.codegen.typescript.fetch; import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.MapSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen; @@ -43,6 +45,16 @@ public void testSnapshotVersion() { } + @Test + public void testOptionalResponseImports() { + TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen(); + final OpenAPI openApi = TestUtils.parseFlattenSpec("src/test/resources/3_0/optionalResponse.yaml"); + codegen.setOpenAPI(openApi); + PathItem path = openApi.getPaths().get("/api/Users/{userId}"); + CodegenOperation operation = codegen.fromOperation("/api/Users/{userId}", "get", path.getGet(), path.getServers()); + Assert.assertEquals(operation.isResponseOptional, true); + } + @Test public void testWithoutSnapshotVersion() { OpenAPI api = TestUtils.createOpenAPI(); diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml index 0fcc9905aae3..b2eb6c526368 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml @@ -1275,6 +1275,22 @@ paths: $ref: '#/components/schemas/Variable' '400': description: Invalid Value + /internal/only: + get: + x-internal: true + tags: + - values + summary: internal only + description: '' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Variable' + '400': + description: Invalid Value servers: - url: 'http://{server}.swagger.io:{port}/v2' description: petstore server @@ -2490,6 +2506,7 @@ components: - pending - sold PropertyNameCollision: + x-internal: false type: object properties: _type: @@ -2498,6 +2515,12 @@ components: type: string type_: type: string + InteralOnly: + type: object + x-internal: true + properties: + type: + type: string AllOfModelArrayAnyOf: allOf: - $ref: "#/components/schemas/Category" diff --git a/modules/openapi-generator/src/test/resources/3_0/optionalResponse.yaml b/modules/openapi-generator/src/test/resources/3_0/optionalResponse.yaml new file mode 100644 index 000000000000..650f7016795d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/optionalResponse.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.1 +info: + title: My Sample User API + version: '1.0' +paths: + /api/Users/{userId}: + get: + tags: + - Users + summary: Get a specific user + operationId: GetUserById + parameters: + - name: userId + in: path + description: ID of the user + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Success + content: + text/plain: + schema: + $ref: '#/components/schemas/UserDto' + application/json: + schema: + $ref: '#/components/schemas/UserDto' + text/json: + schema: + $ref: '#/components/schemas/UserDto' + '204': + description: No Content +components: + schemas: + UserDto: + required: + - id + type: object + properties: + id: + type: string + format: uuid + name: + type: string + nullable: true + additionalProperties: false diff --git a/samples/client/echo_api/r/.Rbuildignore b/samples/client/echo_api/r/.Rbuildignore new file mode 100644 index 000000000000..75126be0d34b --- /dev/null +++ b/samples/client/echo_api/r/.Rbuildignore @@ -0,0 +1,20 @@ +^.*\.Rproj$ # Designates the directory as an RStudio Project +^\.Rproj\.user$ # Used by RStudio for temporary files +^README\.Rmd$ # An Rmd file used to generate README.md +^LICENSE\.md$ # Full text of the license +^cran-comments\.md$ # Comments for CRAN submission +^data-raw$ # Code used to create data included in the package +^pkgdown$ # Resources used for the package website +^_pkgdown\.yml$ # Configuration info for the package website +^\.github$ # Contributing guidelines, CoC, issue templates, etc. +^\.Rhistory$ +^\.gitignore$ +^\.openapi-generator-ignore$ +^\.travis\.yml$ +^\.lintr$ +^\.github$ +^\.openapi-generator$ +^docs$ +^git_push\.sh$ +^openapi\.Rcheck$ +^\.\.Rcheck$ diff --git a/samples/client/echo_api/r/.github/workflows/r-client.yaml b/samples/client/echo_api/r/.github/workflows/r-client.yaml new file mode 100644 index 000000000000..216ebe6c0034 --- /dev/null +++ b/samples/client/echo_api/r/.github/workflows/r-client.yaml @@ -0,0 +1,33 @@ +# This file is automatically generated by openapi-generator (https://openapi-generator.tech) +# +# Based on https://github.com/r-lib/actions/tree/v2/examples +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ubuntu-latest + env: + R_KEEP_PKG_SOURCE: yes + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck, any::roxygen2, any::lintr, local::. + needs: check, roxygen2, lint + - name: Lint + run: lintr::lint_package() + shell: Rscript {0} + - name: Roxygenize + run: | + roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace')) + shell: Rscript {0} + - uses: r-lib/actions/check-r-package@v2 diff --git a/samples/client/echo_api/r/.gitignore b/samples/client/echo_api/r/.gitignore new file mode 100644 index 000000000000..5d21150e0cae --- /dev/null +++ b/samples/client/echo_api/r/.gitignore @@ -0,0 +1,35 @@ +# ref: https://github.com/github/gitignore/blob/master/R.gitignore + +# History files +.Rhistory +.Rapp.history + +# Session Data files +.RData + +# Example code in package build process +*-Ex.R + +# Output files from R CMD build +/*.tar.gz + +# Output files from R CMD check +/*.Rcheck/ + +# RStudio files +.Rproj.user/ + +# produced vignettes +vignettes/*.html +vignettes/*.pdf + +# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 +.httr-oauth + +# knitr and R markdown default cache directories +/*_cache/ +/cache/ + +# Temporary files created by R markdown +*.utf8.md +*.knit.md diff --git a/samples/client/echo_api/r/.lintr b/samples/client/echo_api/r/.lintr new file mode 100644 index 000000000000..54ee36a49cd7 --- /dev/null +++ b/samples/client/echo_api/r/.lintr @@ -0,0 +1,7 @@ +linters: linters_with_defaults( + line_length_linter(160), + object_name_linter = NULL, + cyclocomp_linter = NULL + ) +exclusions: list( + ) diff --git a/samples/client/echo_api/r/.openapi-generator-ignore b/samples/client/echo_api/r/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/r/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/r/.openapi-generator/FILES b/samples/client/echo_api/r/.openapi-generator/FILES new file mode 100644 index 000000000000..00661ff72f60 --- /dev/null +++ b/samples/client/echo_api/r/.openapi-generator/FILES @@ -0,0 +1,46 @@ +.Rbuildignore +.github/workflows/r-client.yaml +.gitignore +.lintr +.travis.yml +DESCRIPTION +NAMESPACE +R/api_client.R +R/api_response.R +R/auth_api.R +R/bird.R +R/body_api.R +R/category.R +R/data_query.R +R/default_value.R +R/form_api.R +R/header_api.R +R/number_properties_only.R +R/path_api.R +R/pet.R +R/query.R +R/query_api.R +R/string_enum_ref.R +R/tag.R +R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R +R/test_query_style_form_explode_true_array_string_query_object_parameter.R +README.md +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +git_push.sh +tests/testthat.R diff --git a/samples/client/echo_api/r/.openapi-generator/VERSION b/samples/client/echo_api/r/.openapi-generator/VERSION new file mode 100644 index 000000000000..fff4bdd7ab59 --- /dev/null +++ b/samples/client/echo_api/r/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/r/.travis.yml b/samples/client/echo_api/r/.travis.yml new file mode 100644 index 000000000000..b96a0ef5a859 --- /dev/null +++ b/samples/client/echo_api/r/.travis.yml @@ -0,0 +1,18 @@ +# ref: https://docs.travis-ci.com/user/languages/r/ +language: r +cache: + directories: + - /home/travis/R/Library +r_packages: +- jsonlite +- httr +- testthat +# uncomment below to install deps with devtools +#install: +#- R -e 'devtools::install_deps(dep = T)' +script: +- R CMD build . +- R CMD check *tar.gz +- R CMD INSTALL *tar.gz +after_failure: +- cat ${TRAVIS_BUILD_DIR}/namsor.Rcheck/tests/testthat.Rout.fail diff --git a/samples/client/echo_api/r/DESCRIPTION b/samples/client/echo_api/r/DESCRIPTION new file mode 100644 index 000000000000..9d255d5abc1f --- /dev/null +++ b/samples/client/echo_api/r/DESCRIPTION @@ -0,0 +1,15 @@ +Package: openapi +Title: R Package Client for Echo Server API +Version: 1.0.0 +Author: person("OpenAPI Generator community", email = "team@openapitools.org", role = c("aut", "cre")) +Maintainer: OpenAPI Generator community +Description: Echo Server API +URL: https://github.com/GIT_USER_ID/GIT_REPO_ID +BugReports: https://github.com/GIT_USER_ID/GIT_REPO_ID/issues +Depends: R (>= 3.3) +Encoding: UTF-8 +License: Apache 2.0 +LazyData: true +Suggests: testthat +Imports: jsonlite, httr, R6, base64enc, stringr +RoxygenNote: 7.2.1 diff --git a/samples/client/echo_api/r/NAMESPACE b/samples/client/echo_api/r/NAMESPACE new file mode 100644 index 000000000000..ba08b5eee57f --- /dev/null +++ b/samples/client/echo_api/r/NAMESPACE @@ -0,0 +1,34 @@ +# Generated by openapi-generator: https://openapi-generator.tech +# Do not edit by hand + +import(R6) +import(jsonlite) +import(httr) +import(base64enc) +import(stringr) + + +# Core +export(ApiClient) +export(ApiResponse) + +# Models +export(Bird) +export(Category) +export(DataQuery) +export(DefaultValue) +export(NumberPropertiesOnly) +export(Pet) +export(Query) +export(StringEnumRef) +export(Tag) +export(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) +export(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) + +# APIs +export(AuthApi) +export(BodyApi) +export(FormApi) +export(HeaderApi) +export(PathApi) +export(QueryApi) diff --git a/samples/client/echo_api/r/R/api_client.R b/samples/client/echo_api/r/R/api_client.R new file mode 100644 index 000000000000..dedada13adce --- /dev/null +++ b/samples/client/echo_api/r/R/api_client.R @@ -0,0 +1,391 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' ApiClient Class +#' +#' Generic API client for OpenAPI client library builds. +#' OpenAPI generic API client. This client handles the client- +#' server communication, and is invariant across implementations. Specifics of +#' the methods and models for each application are generated from the OpenAPI Generator +#' templates. +#' +#' NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +#' Ref: https://openapi-generator.tech +#' Do not edit the class manually. +#' +#' @docType class +#' @title ApiClient +#' @description ApiClient Class +#' @format An \code{R6Class} generator object +#' @field base_path Base url +#' @field user_agent Default user agent +#' @field default_headers Default headers +#' @field username Username for HTTP basic authentication +#' @field password Password for HTTP basic authentication +#' @field api_keys API keys +#' @field bearer_token Bearer token +#' @field timeout Default timeout in seconds +#' @field retry_status_codes vector of status codes to retry +#' @field max_retry_attempts maximum number of retries for the status codes +#' @importFrom httr add_headers accept timeout content +#' @export +ApiClient <- R6::R6Class( + "ApiClient", + public = list( + # base path of all requests + base_path = "http://localhost:3000", + # user agent in the HTTP request + user_agent = "OpenAPI-Generator/1.0.0/r", + # default headers in the HTTP request + default_headers = NULL, + # username (HTTP basic authentication) + username = NULL, + # password (HTTP basic authentication) + password = NULL, + # API keys + api_keys = NULL, + # Bearer token + bearer_token = NULL, + # Time Out (seconds) + timeout = NULL, + # Vector of status codes to retry + retry_status_codes = NULL, + # Maximum number of retry attempts for the retry status codes + max_retry_attempts = NULL, + #' Initialize a new ApiClient. + #' + #' @description + #' Initialize a new ApiClient. + #' + #' @param base_path Base path. + #' @param user_agent User agent. + #' @param default_headers Default headers. + #' @param username User name. + #' @param password Password. + #' @param api_keys API keys. + #' @param access_token Access token. + #' @param bearer_token Bearer token. + #' @param timeout Timeout. + #' @param retry_status_codes Status codes for retry. + #' @param max_retry_attempts Maxmium number of retry. + #' @export + initialize = function(base_path = NULL, user_agent = NULL, + default_headers = NULL, + username = NULL, password = NULL, api_keys = NULL, + access_token = NULL, bearer_token = NULL, timeout = NULL, + retry_status_codes = NULL, max_retry_attempts = NULL) { + if (!is.null(base_path)) { + self$base_path <- base_path + } + + if (!is.null(default_headers)) { + self$default_headers <- default_headers + } + + if (!is.null(username)) { + self$username <- username + } + + if (!is.null(password)) { + self$password <- password + } + + if (!is.null(access_token)) { + self$access_token <- access_token + } + + if (!is.null(bearer_token)) { + self$bearer_token <- bearer_token + } + + if (!is.null(api_keys)) { + self$api_keys <- api_keys + } else { + self$api_keys <- list() + } + + if (!is.null(user_agent)) { + self$`user_agent` <- user_agent + } + + if (!is.null(timeout)) { + self$timeout <- timeout + } + + if (!is.null(retry_status_codes)) { + self$retry_status_codes <- retry_status_codes + } + + if (!is.null(max_retry_attempts)) { + self$max_retry_attempts <- max_retry_attempts + } + }, + #' Prepare to make an API call with the retry logic. + #' + #' @description + #' Prepare to make an API call with the retry logic. + #' + #' @param url URL. + #' @param method HTTP method. + #' @param query_params The query parameters. + #' @param header_params The header parameters. + #' @param form_params The form parameters. + #' @param file_params The form parameters for uploading files. + #' @param accepts The list of Accept headers. + #' @param content_types The list of Content-Type headers. + #' @param body The HTTP request body. + #' @param stream_callback Callback function to process the data stream + #' @param ... Other optional arguments. + #' @return HTTP response + #' @export + CallApi = function(url, method, query_params, header_params, form_params, + file_params, accepts, content_types, + body, stream_callback = NULL, ...) { + + resp <- self$Execute(url, method, query_params, header_params, + form_params, file_params, + accepts, content_types, + body, stream_callback = stream_callback, ...) + + if (is.null(self$max_retry_attempts)) { + self$max_retry_attempts <- 3 + } + + if (!is.null(self$retry_status_codes)) { + + for (i in 1 : self$max_retry_attempts) { + if (resp$status_code %in% self$retry_status_codes) { + Sys.sleep((2 ^ i) + stats::runif(n = 1, min = 0, max = 1)) + resp <- self$Execute(url, method, query_params, header_params, + form_params, file_params, accepts, content_types, + body, stream_callback = stream_callback, ...) + } else { + break + } + } + } + + resp + }, + #' Make an API call + #' + #' @description + #' Make an API call + #' + #' @param url URL. + #' @param method HTTP method. + #' @param query_params The query parameters. + #' @param header_params The header parameters. + #' @param form_params The form parameters. + #' @param file_params The form parameters for uploading files. + #' @param accepts The list of Accept headers + #' @param content_types The list of Content-Type headers + #' @param body The HTTP request body. + #' @param stream_callback Callback function to process data stream + #' @param ... Other optional arguments. + #' @return HTTP response + #' @export + Execute = function(url, method, query_params, header_params, + form_params, file_params, + accepts, content_types, + body, stream_callback = NULL, ...) { + headers <- httr::add_headers(c(header_params, self$default_headers)) + + http_timeout <- NULL + if (!is.null(self$timeout)) { + http_timeout <- httr::timeout(self$timeout) + } + + # set HTTP accept header + accept = self$select_header(accepts) + if (!is.null(accept)) { + headers['Accept'] = accept + } + + # set HTTP content-type header + content_type = self$select_header(content_types) + if (!is.null(content_type)) { + headers['Content-Type'] = content_type + } + + if (typeof(stream_callback) == "closure") { # stream data + if (method == "GET") { + httr::GET(url, query = query_params, headers, http_timeout, + httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else if (method == "POST") { + httr::POST(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else if (method == "PUT") { + httr::PUT(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else if (method == "PATCH") { + httr::PATCH(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else if (method == "HEAD") { + httr::HEAD(url, query = query_params, headers, http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else if (method == "DELETE") { + httr::DELETE(url, query = query_params, headers, http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...) + } else { + err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`." + stop(err_msg) + } + } else { # no streaming + if (method == "GET") { + httr_response <- httr::GET(url, query = query_params, headers, http_timeout, + httr::user_agent(self$`user_agent`), ...) + } else if (method == "POST") { + httr_response <- httr::POST(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + httr::user_agent(self$`user_agent`), ...) + } else if (method == "PUT") { + httr_response <- httr::PUT(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), ...) + } else if (method == "PATCH") { + httr_response <- httr::PATCH(url, query = query_params, headers, body = body, + httr::content_type("application/json"), http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), ...) + } else if (method == "HEAD") { + httr_response <- httr::HEAD(url, query = query_params, headers, http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), ...) + } else if (method == "DELETE") { + httr_response <- httr::DELETE(url, query = query_params, headers, http_timeout, + http_timeout, httr::user_agent(self$`user_agent`), ...) + } else { + err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`." + stop(err_msg) + } + + # return ApiResponse + api_response <- ApiResponse$new() + api_response$status_code <- httr::status_code(httr_response) + api_response$status_code_desc <- httr::http_status(httr_response)$reason + api_response$response <- httr::content(httr_response, "text", encoding = "UTF-8") + api_response$headers <- httr::headers(httr_response) + + api_response + } + }, + #' Deserialize the content of API response to the given type. + #' + #' @description + #' Deserialize the content of API response to the given type. + #' + #' @param raw_response Raw response. + #' @param return_type R return type. + #' @param pkg_env Package environment. + #' @return Deserialized object. + #' @export + deserialize = function(raw_response, return_type, pkg_env) { + resp_obj <- jsonlite::fromJSON(raw_response) + self$deserializeObj(resp_obj, return_type, pkg_env) + }, + #' Deserialize the response from jsonlite object based on the given type + #' + #' @description + #' Deserialize the response from jsonlite object based on the given type + #' by handling complex and nested types by iterating recursively + #' Example return_types will be like "array[integer]", "map(Pet)", "array[map(Tag)]", etc., + #' + #' @param obj Response object. + #' @param return_type R return type. + #' @param pkg_env Package environment. + #' @return Deserialized object. + #' @export + deserializeObj = function(obj, return_type, pkg_env) { + return_obj <- NULL + primitive_types <- c("character", "numeric", "integer", "logical", "complex") + + # To handle the "map" type + if (startsWith(return_type, "map(")) { + inner_return_type <- regmatches(return_type, + regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2] + return_obj <- lapply(names(obj), function(name) { + self$deserializeObj(obj[[name]], inner_return_type, pkg_env) + }) + names(return_obj) <- names(obj) + } else if (startsWith(return_type, "array[")) { + # To handle the "array" type + inner_return_type <- regmatches(return_type, + regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2] + if (c(inner_return_type) %in% primitive_types) { + return_obj <- vector("list", length = length(obj)) + if (length(obj) > 0) { + for (row in 1:length(obj)) { + return_obj[[row]] <- self$deserializeObj(obj[row], inner_return_type, pkg_env) + } + } + } else { + if (!is.null(nrow(obj))) { + return_obj <- vector("list", length = nrow(obj)) + if (nrow(obj) > 0) { + for (row in 1:nrow(obj)) { + return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], + inner_return_type, pkg_env) + } + } + } + } + } else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) { + # To handle model objects which are not array or map containers. Ex:"Pet" + return_type <- get(return_type, envir = as.environment(pkg_env)) + return_obj <- return_type$new() + # check if discriminator is defined + if (!is.null(return_obj$`_discriminator_property_name`)) { + data_type <- return_obj$`_discriminator_property_name` + # use discriminator mapping if provided + if (!is.null(return_obj$`_discriminator_mapping_name`)) { + data_type <- (return_obj$`_discriminator_mapping_name`)[[obj[[data_type]]]] + } else { + # no mapping provided, use the value directly + data_type <- obj[[data_type]] + } + # create an object of the mapped type (e.g. Cat) + return_type <- get(data_type, envir = as.environment(pkg_env)) + return_obj <- return_type$new() + } + return_obj$fromJSON( + jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE) + ) + } else { + # To handle primitive type + return_obj <- obj + } + return_obj + }, + #' Return a property header (for accept or content-type). + #' + #' @description + #' Return a property header (for accept or content-type). If JSON-related MIME is found, + #' return it. Otherwise, return the first one, if any. + #' + #' @param headers A list of headers + #' @return A header (e.g. 'application/json') + #' @export + select_header = function(headers) { + if (length(headers) == 0) { + return(invisible(NULL)) + } else { + for (header in headers) { + if (str_detect(header, "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")) { + # return JSON-related MIME + return(header) + } + } + + # not json mime type, simply return the first one + return(headers[1]) + } + } + ) +) diff --git a/samples/client/echo_api/r/R/api_response.R b/samples/client/echo_api/r/R/api_response.R new file mode 100644 index 000000000000..c6d45622464c --- /dev/null +++ b/samples/client/echo_api/r/R/api_response.R @@ -0,0 +1,50 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title ApiResponse +#' @description ApiResponse Class +#' @format An \code{R6Class} generator object +#' @field content The deserialized response body. +#' @field response The raw response from the endpoint. +#' @field status_code The HTTP response status code. +#' @field status_code_desc The brief description of the HTTP response status code. +#' @field headers The HTTP response headers. +#' @export +ApiResponse <- R6::R6Class( + "ApiResponse", + public = list( + content = NULL, + response = NULL, + status_code = NULL, + status_code_desc = NULL, + headers = NULL, + #' Initialize a new ApiResponse class. + #' + #' @description + #' Initialize a new ApiResponse class. + #' + #' @param content The deserialized response body. + #' @param response The raw response from the endpoint. + #' @param status_code The HTTP response status code. + #' @param status_code_desc The brief description of the HTTP response status code. + #' @param headers The HTTP response headers. + #' @export + initialize = function(content = NULL, + response = NULL, + status_code = NULL, + status_code_desc = NULL, + headers = NULL) { + self$content <- content + self$response <- response + self$status_code <- status_code + self$status_code_desc <- status_code_desc + self$headers <- headers + } + ) +) diff --git a/samples/client/echo_api/r/R/auth_api.R b/samples/client/echo_api/r/R/auth_api.R new file mode 100644 index 000000000000..b78961ddbbf9 --- /dev/null +++ b/samples/client/echo_api/r/R/auth_api.R @@ -0,0 +1,288 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Auth operations +#' @description AuthApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestAuthHttpBasic } \emph{ To test HTTP basic authentication } +#' To test HTTP basic authentication +#' +#' \itemize{ +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestAuthHttpBearer } \emph{ To test HTTP bearer authentication } +#' To test HTTP bearer authentication +#' +#' \itemize{ +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestAuthHttpBasic #################### +#' +#' library(openapi) +#' +#' #To test HTTP basic authentication +#' api_instance <- AuthApi$new() +#' +#' # Configure HTTP basic authorization: http_auth +#' api_instance$api_client$username <- Sys.getenv("USERNAME") +#' api_instance$api_client$password <- Sys.getenv("PASSWORD") +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestAuthHttpBasic(data_file = "result.txt") +#' result <- api_instance$TestAuthHttpBasic() +#' dput(result) +#' +#' +#' #################### TestAuthHttpBearer #################### +#' +#' library(openapi) +#' +#' #To test HTTP bearer authentication +#' api_instance <- AuthApi$new() +#' +#' # Configure HTTP bearer authorization: http_bearer_auth +#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN") +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestAuthHttpBearer(data_file = "result.txt") +#' result <- api_instance$TestAuthHttpBearer() +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +AuthApi <- R6::R6Class( + "AuthApi", + public = list( + api_client = NULL, + #' Initialize a new AuthApi. + #' + #' @description + #' Initialize a new AuthApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' To test HTTP basic authentication + #' + #' @description + #' To test HTTP basic authentication + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestAuthHttpBasic = function(data_file = NULL, ...) { + local_var_response <- self$TestAuthHttpBasicWithHttpInfo(data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' To test HTTP basic authentication + #' + #' @description + #' To test HTTP basic authentication + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestAuthHttpBasicWithHttpInfo = function(data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + local_var_url_path <- "/auth/http/basic" + # HTTP basic auth + if (!is.null(self$api_client$username) || !is.null(self$api_client$password)) { + header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":")))) + } + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' To test HTTP bearer authentication + #' + #' @description + #' To test HTTP bearer authentication + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestAuthHttpBearer = function(data_file = NULL, ...) { + local_var_response <- self$TestAuthHttpBearerWithHttpInfo(data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' To test HTTP bearer authentication + #' + #' @description + #' To test HTTP bearer authentication + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestAuthHttpBearerWithHttpInfo = function(data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + local_var_url_path <- "/auth/http/bearer" + # Bearer token + if (!is.null(self$api_client$bearer_token)) { + header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ") + } + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/bird.R b/samples/client/echo_api/r/R/bird.R new file mode 100644 index 000000000000..57616beecb71 --- /dev/null +++ b/samples/client/echo_api/r/R/bird.R @@ -0,0 +1,188 @@ +#' Create a new Bird +#' +#' @description +#' Bird Class +#' +#' @docType class +#' @title Bird +#' @description Bird Class +#' @format An \code{R6Class} generator object +#' @field size character [optional] +#' @field color character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +Bird <- R6::R6Class( + "Bird", + public = list( + `size` = NULL, + `color` = NULL, + #' Initialize a new Bird class. + #' + #' @description + #' Initialize a new Bird class. + #' + #' @param size size + #' @param color color + #' @param ... Other optional arguments. + #' @export + initialize = function(`size` = NULL, `color` = NULL, ...) { + if (!is.null(`size`)) { + if (!(is.character(`size`) && length(`size`) == 1)) { + stop(paste("Error! Invalid data for `size`. Must be a string:", `size`)) + } + self$`size` <- `size` + } + if (!is.null(`color`)) { + if (!(is.character(`color`) && length(`color`) == 1)) { + stop(paste("Error! Invalid data for `color`. Must be a string:", `color`)) + } + self$`color` <- `color` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Bird in JSON format + #' @export + toJSON = function() { + BirdObject <- list() + if (!is.null(self$`size`)) { + BirdObject[["size"]] <- + self$`size` + } + if (!is.null(self$`color`)) { + BirdObject[["color"]] <- + self$`color` + } + BirdObject + }, + #' Deserialize JSON string into an instance of Bird + #' + #' @description + #' Deserialize JSON string into an instance of Bird + #' + #' @param input_json the JSON input + #' @return the instance of Bird + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`size`)) { + self$`size` <- this_object$`size` + } + if (!is.null(this_object$`color`)) { + self$`color` <- this_object$`color` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Bird in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`size`)) { + sprintf( + '"size": + "%s" + ', + self$`size` + ) + }, + if (!is.null(self$`color`)) { + sprintf( + '"color": + "%s" + ', + self$`color` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of Bird + #' + #' @description + #' Deserialize JSON string into an instance of Bird + #' + #' @param input_json the JSON input + #' @return the instance of Bird + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`size` <- this_object$`size` + self$`color` <- this_object$`color` + self + }, + #' Validate JSON input with respect to Bird + #' + #' @description + #' Validate JSON input with respect to Bird and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of Bird + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# Bird$unlock() +# +## Below is an example to define the print function +# Bird$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# Bird$lock() + diff --git a/samples/client/echo_api/r/R/body_api.R b/samples/client/echo_api/r/R/body_api.R new file mode 100644 index 000000000000..7a22b2939cb9 --- /dev/null +++ b/samples/client/echo_api/r/R/body_api.R @@ -0,0 +1,1155 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Body operations +#' @description BodyApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestBinaryGif } \emph{ Test binary (gif) response body } +#' Test binary (gif) response body +#' +#' \itemize{ +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : data.frame +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestBodyApplicationOctetstreamBinary } \emph{ Test body parameter(s) } +#' Test body parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } body data.frame +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestBodyMultipartFormdataArrayOfBinary } \emph{ Test array of binary in multipart mime } +#' Test array of binary in multipart mime +#' +#' \itemize{ +#' \item \emph{ @param } files list( data.frame ) +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestBodyMultipartFormdataSingleBinary } \emph{ Test single binary in multipart mime } +#' Test single binary in multipart mime +#' +#' \itemize{ +#' \item \emph{ @param } my_file data.frame +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestEchoBodyAllOfPet } \emph{ Test body parameter(s) } +#' Test body parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } pet \link{Pet} +#' \item \emph{ @returnType } \link{Pet} \cr +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : Pet +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestEchoBodyFreeFormObjectResponseString } \emph{ Test free form object } +#' Test free form object +#' +#' \itemize{ +#' \item \emph{ @param } body object +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestEchoBodyPet } \emph{ Test body parameter(s) } +#' Test body parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } pet \link{Pet} +#' \item \emph{ @returnType } \link{Pet} \cr +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : Pet +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestEchoBodyPetResponseString } \emph{ Test empty response body } +#' Test empty response body +#' +#' \itemize{ +#' \item \emph{ @param } pet \link{Pet} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestEchoBodyTagResponseString } \emph{ Test empty json (request body) } +#' Test empty json (request body) +#' +#' \itemize{ +#' \item \emph{ @param } tag \link{Tag} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestBinaryGif #################### +#' +#' library(openapi) +#' +#' #Test binary (gif) response body +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestBinaryGif(data_file = "result.txt") +#' result <- api_instance$TestBinaryGif() +#' dput(result) +#' +#' +#' #################### TestBodyApplicationOctetstreamBinary #################### +#' +#' library(openapi) +#' var_body <- File.new('/path/to/file') # data.frame | (Optional) +#' +#' #Test body parameter(s) +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_bodydata_file = "result.txt") +#' result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_body) +#' dput(result) +#' +#' +#' #################### TestBodyMultipartFormdataArrayOfBinary #################### +#' +#' library(openapi) +#' var_files <- c(123) # array[data.frame] | +#' +#' #Test array of binary in multipart mime +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_filesdata_file = "result.txt") +#' result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_files) +#' dput(result) +#' +#' +#' #################### TestBodyMultipartFormdataSingleBinary #################### +#' +#' library(openapi) +#' var_my_file <- File.new('/path/to/file') # data.frame | (Optional) +#' +#' #Test single binary in multipart mime +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_filedata_file = "result.txt") +#' result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_file) +#' dput(result) +#' +#' +#' #################### TestEchoBodyAllOfPet #################### +#' +#' library(openapi) +#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) +#' +#' #Test body parameter(s) +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEchoBodyAllOfPet(pet = var_petdata_file = "result.txt") +#' result <- api_instance$TestEchoBodyAllOfPet(pet = var_pet) +#' dput(result) +#' +#' +#' #################### TestEchoBodyFreeFormObjectResponseString #################### +#' +#' library(openapi) +#' var_body <- c(key = TODO) # object | Free form object (Optional) +#' +#' #Test free form object +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_bodydata_file = "result.txt") +#' result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_body) +#' dput(result) +#' +#' +#' #################### TestEchoBodyPet #################### +#' +#' library(openapi) +#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) +#' +#' #Test body parameter(s) +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEchoBodyPet(pet = var_petdata_file = "result.txt") +#' result <- api_instance$TestEchoBodyPet(pet = var_pet) +#' dput(result) +#' +#' +#' #################### TestEchoBodyPetResponseString #################### +#' +#' library(openapi) +#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) +#' +#' #Test empty response body +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEchoBodyPetResponseString(pet = var_petdata_file = "result.txt") +#' result <- api_instance$TestEchoBodyPetResponseString(pet = var_pet) +#' dput(result) +#' +#' +#' #################### TestEchoBodyTagResponseString #################### +#' +#' library(openapi) +#' var_tag <- Tag$new(123, "name_example") # Tag | Tag object (Optional) +#' +#' #Test empty json (request body) +#' api_instance <- BodyApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEchoBodyTagResponseString(tag = var_tagdata_file = "result.txt") +#' result <- api_instance$TestEchoBodyTagResponseString(tag = var_tag) +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +BodyApi <- R6::R6Class( + "BodyApi", + public = list( + api_client = NULL, + #' Initialize a new BodyApi. + #' + #' @description + #' Initialize a new BodyApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' Test binary (gif) response body + #' + #' @description + #' Test binary (gif) response body + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return data.frame + #' @export + TestBinaryGif = function(data_file = NULL, ...) { + local_var_response <- self$TestBinaryGifWithHttpInfo(data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test binary (gif) response body + #' + #' @description + #' Test binary (gif) response body + #' + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (data.frame) with additional information such as HTTP status code, headers + #' @export + TestBinaryGifWithHttpInfo = function(data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + local_var_url_path <- "/binary/gif" + + # The Accept request HTTP header + local_var_accepts <- list("image/gif") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "data.frame", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param body (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestBodyApplicationOctetstreamBinary = function(body = NULL, data_file = NULL, ...) { + local_var_response <- self$TestBodyApplicationOctetstreamBinaryWithHttpInfo(body, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param body (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestBodyApplicationOctetstreamBinaryWithHttpInfo = function(body = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`body`)) { + local_var_body <- `body`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/body/application/octetstream/binary" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/octet-stream") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test array of binary in multipart mime + #' + #' @description + #' Test array of binary in multipart mime + #' + #' @param files + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestBodyMultipartFormdataArrayOfBinary = function(files, data_file = NULL, ...) { + local_var_response <- self$TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test array of binary in multipart mime + #' + #' @description + #' Test array of binary in multipart mime + #' + #' @param files + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo = function(files, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + if (missing(`files`)) { + stop("Missing required parameter `files`.") + } + + + file_params["files"] <- httr::upload_file(`files`) + local_var_url_path <- "/body/application/octetstream/array_of_binary" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("multipart/form-data") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test single binary in multipart mime + #' + #' @description + #' Test single binary in multipart mime + #' + #' @param my_file (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestBodyMultipartFormdataSingleBinary = function(my_file = NULL, data_file = NULL, ...) { + local_var_response <- self$TestBodyMultipartFormdataSingleBinaryWithHttpInfo(my_file, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test single binary in multipart mime + #' + #' @description + #' Test single binary in multipart mime + #' + #' @param my_file (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestBodyMultipartFormdataSingleBinaryWithHttpInfo = function(my_file = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + file_params["my-file"] <- httr::upload_file(`my_file`) + local_var_url_path <- "/body/application/octetstream/single_binary" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("multipart/form-data") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return Pet + #' @export + TestEchoBodyAllOfPet = function(pet = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEchoBodyAllOfPetWithHttpInfo(pet, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (Pet) with additional information such as HTTP status code, headers + #' @export + TestEchoBodyAllOfPetWithHttpInfo = function(pet = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`pet`)) { + local_var_body <- `pet`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/echo/body/allOf/Pet" + + # The Accept request HTTP header + local_var_accepts <- list("application/json") + + # The Content-Type representation header + local_var_content_types <- list("application/json") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test free form object + #' + #' @description + #' Test free form object + #' + #' @param body (optional) Free form object + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestEchoBodyFreeFormObjectResponseString = function(body = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test free form object + #' + #' @description + #' Test free form object + #' + #' @param body (optional) Free form object + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestEchoBodyFreeFormObjectResponseStringWithHttpInfo = function(body = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`body`)) { + local_var_body <- `body`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/echo/body/FreeFormObject/response_string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/json") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return Pet + #' @export + TestEchoBodyPet = function(pet = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEchoBodyPetWithHttpInfo(pet, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test body parameter(s) + #' + #' @description + #' Test body parameter(s) + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (Pet) with additional information such as HTTP status code, headers + #' @export + TestEchoBodyPetWithHttpInfo = function(pet = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`pet`)) { + local_var_body <- `pet`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/echo/body/Pet" + + # The Accept request HTTP header + local_var_accepts <- list("application/json") + + # The Content-Type representation header + local_var_content_types <- list("application/json") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test empty response body + #' + #' @description + #' Test empty response body + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestEchoBodyPetResponseString = function(pet = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEchoBodyPetResponseStringWithHttpInfo(pet, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test empty response body + #' + #' @description + #' Test empty response body + #' + #' @param pet (optional) Pet object that needs to be added to the store + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestEchoBodyPetResponseStringWithHttpInfo = function(pet = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`pet`)) { + local_var_body <- `pet`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/echo/body/Pet/response_string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/json") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test empty json (request body) + #' + #' @description + #' Test empty json (request body) + #' + #' @param tag (optional) Tag object + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestEchoBodyTagResponseString = function(tag = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEchoBodyTagResponseStringWithHttpInfo(tag, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test empty json (request body) + #' + #' @description + #' Test empty json (request body) + #' + #' @param tag (optional) Tag object + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestEchoBodyTagResponseStringWithHttpInfo = function(tag = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + if (!is.null(`tag`)) { + local_var_body <- `tag`$toJSONString() + } else { + body <- NULL + } + + local_var_url_path <- "/echo/body/Tag/response_string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/json") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/category.R b/samples/client/echo_api/r/R/category.R new file mode 100644 index 000000000000..3213851b9e9e --- /dev/null +++ b/samples/client/echo_api/r/R/category.R @@ -0,0 +1,188 @@ +#' Create a new Category +#' +#' @description +#' Category Class +#' +#' @docType class +#' @title Category +#' @description Category Class +#' @format An \code{R6Class} generator object +#' @field id integer [optional] +#' @field name character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +Category <- R6::R6Class( + "Category", + public = list( + `id` = NULL, + `name` = NULL, + #' Initialize a new Category class. + #' + #' @description + #' Initialize a new Category class. + #' + #' @param id id + #' @param name name + #' @param ... Other optional arguments. + #' @export + initialize = function(`id` = NULL, `name` = NULL, ...) { + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`name`)) { + if (!(is.character(`name`) && length(`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", `name`)) + } + self$`name` <- `name` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Category in JSON format + #' @export + toJSON = function() { + CategoryObject <- list() + if (!is.null(self$`id`)) { + CategoryObject[["id"]] <- + self$`id` + } + if (!is.null(self$`name`)) { + CategoryObject[["name"]] <- + self$`name` + } + CategoryObject + }, + #' Deserialize JSON string into an instance of Category + #' + #' @description + #' Deserialize JSON string into an instance of Category + #' + #' @param input_json the JSON input + #' @return the instance of Category + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`name`)) { + self$`name` <- this_object$`name` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Category in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of Category + #' + #' @description + #' Deserialize JSON string into an instance of Category + #' + #' @param input_json the JSON input + #' @return the instance of Category + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`id` <- this_object$`id` + self$`name` <- this_object$`name` + self + }, + #' Validate JSON input with respect to Category + #' + #' @description + #' Validate JSON input with respect to Category and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of Category + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# Category$unlock() +# +## Below is an example to define the print function +# Category$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# Category$lock() + diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R new file mode 100644 index 000000000000..0a749f98d6ed --- /dev/null +++ b/samples/client/echo_api/r/R/data_query.R @@ -0,0 +1,263 @@ +#' Create a new DataQuery +#' +#' @description +#' DataQuery Class +#' +#' @docType class +#' @title DataQuery +#' @description DataQuery Class +#' @format An \code{R6Class} generator object +#' @field id Query integer [optional] +#' @field outcomes list(character) [optional] +#' @field suffix test suffix character [optional] +#' @field text Some text containing white spaces character [optional] +#' @field date A date character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +DataQuery <- R6::R6Class( + "DataQuery", + inherit = Query, + public = list( + `id` = NULL, + `outcomes` = NULL, + `suffix` = NULL, + `text` = NULL, + `date` = NULL, + #' Initialize a new DataQuery class. + #' + #' @description + #' Initialize a new DataQuery class. + #' + #' @param id Query + #' @param outcomes outcomes. Default to [SUCCESS, FAILURE]. + #' @param suffix test suffix + #' @param text Some text containing white spaces + #' @param date A date + #' @param ... Other optional arguments. + #' @export + initialize = function(`id` = NULL, `outcomes` = [SUCCESS, FAILURE], `suffix` = NULL, `text` = NULL, `date` = NULL, ...) { + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`outcomes`)) { + stopifnot(is.vector(`outcomes`), length(`outcomes`) != 0) + sapply(`outcomes`, function(x) stopifnot(is.character(x))) + self$`outcomes` <- `outcomes` + } + if (!is.null(`suffix`)) { + if (!(is.character(`suffix`) && length(`suffix`) == 1)) { + stop(paste("Error! Invalid data for `suffix`. Must be a string:", `suffix`)) + } + self$`suffix` <- `suffix` + } + if (!is.null(`text`)) { + if (!(is.character(`text`) && length(`text`) == 1)) { + stop(paste("Error! Invalid data for `text`. Must be a string:", `text`)) + } + self$`text` <- `text` + } + if (!is.null(`date`)) { + if (!is.character(`date`)) { + stop(paste("Error! Invalid data for `date`. Must be a string:", `date`)) + } + self$`date` <- `date` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return DataQuery in JSON format + #' @export + toJSON = function() { + DataQueryObject <- list() + if (!is.null(self$`id`)) { + DataQueryObject[["id"]] <- + self$`id` + } + if (!is.null(self$`outcomes`)) { + DataQueryObject[["outcomes"]] <- + self$`outcomes` + } + if (!is.null(self$`suffix`)) { + DataQueryObject[["suffix"]] <- + self$`suffix` + } + if (!is.null(self$`text`)) { + DataQueryObject[["text"]] <- + self$`text` + } + if (!is.null(self$`date`)) { + DataQueryObject[["date"]] <- + self$`date` + } + DataQueryObject + }, + #' Deserialize JSON string into an instance of DataQuery + #' + #' @description + #' Deserialize JSON string into an instance of DataQuery + #' + #' @param input_json the JSON input + #' @return the instance of DataQuery + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`outcomes`)) { + self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`suffix`)) { + self$`suffix` <- this_object$`suffix` + } + if (!is.null(this_object$`text`)) { + self$`text` <- this_object$`text` + } + if (!is.null(this_object$`date`)) { + self$`date` <- this_object$`date` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return DataQuery in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`outcomes`)) { + sprintf( + '"outcomes": + [%s] + ', + paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`suffix`)) { + sprintf( + '"suffix": + "%s" + ', + self$`suffix` + ) + }, + if (!is.null(self$`text`)) { + sprintf( + '"text": + "%s" + ', + self$`text` + ) + }, + if (!is.null(self$`date`)) { + sprintf( + '"date": + "%s" + ', + self$`date` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of DataQuery + #' + #' @description + #' Deserialize JSON string into an instance of DataQuery + #' + #' @param input_json the JSON input + #' @return the instance of DataQuery + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`id` <- this_object$`id` + self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi")) + self$`suffix` <- this_object$`suffix` + self$`text` <- this_object$`text` + self$`date` <- this_object$`date` + self + }, + #' Validate JSON input with respect to DataQuery + #' + #' @description + #' Validate JSON input with respect to DataQuery and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of DataQuery + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# DataQuery$unlock() +# +## Below is an example to define the print function +# DataQuery$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# DataQuery$lock() + diff --git a/samples/client/echo_api/r/R/default_value.R b/samples/client/echo_api/r/R/default_value.R new file mode 100644 index 000000000000..6f051e08903f --- /dev/null +++ b/samples/client/echo_api/r/R/default_value.R @@ -0,0 +1,331 @@ +#' Create a new DefaultValue +#' +#' @description +#' to test the default value of properties +#' +#' @docType class +#' @title DefaultValue +#' @description DefaultValue Class +#' @format An \code{R6Class} generator object +#' @field array_string_enum_ref_default list(\link{StringEnumRef}) [optional] +#' @field array_string_enum_default list(character) [optional] +#' @field array_string_default list(character) [optional] +#' @field array_integer_default list(integer) [optional] +#' @field array_string list(character) [optional] +#' @field array_string_nullable list(character) [optional] +#' @field array_string_extension_nullable list(character) [optional] +#' @field string_nullable character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +DefaultValue <- R6::R6Class( + "DefaultValue", + public = list( + `array_string_enum_ref_default` = NULL, + `array_string_enum_default` = NULL, + `array_string_default` = NULL, + `array_integer_default` = NULL, + `array_string` = NULL, + `array_string_nullable` = NULL, + `array_string_extension_nullable` = NULL, + `string_nullable` = NULL, + #' Initialize a new DefaultValue class. + #' + #' @description + #' Initialize a new DefaultValue class. + #' + #' @param array_string_enum_ref_default array_string_enum_ref_default. Default to ["success","failure"]. + #' @param array_string_enum_default array_string_enum_default. Default to ["success","failure"]. + #' @param array_string_default array_string_default. Default to ["failure","skipped"]. + #' @param array_integer_default array_integer_default. Default to [1,3]. + #' @param array_string array_string + #' @param array_string_nullable array_string_nullable + #' @param array_string_extension_nullable array_string_extension_nullable + #' @param string_nullable string_nullable + #' @param ... Other optional arguments. + #' @export + initialize = function(`array_string_enum_ref_default` = ["success","failure"], `array_string_enum_default` = ["success","failure"], `array_string_default` = ["failure","skipped"], `array_integer_default` = [1,3], `array_string` = NULL, `array_string_nullable` = NULL, `array_string_extension_nullable` = NULL, `string_nullable` = NULL, ...) { + if (!is.null(`array_string_enum_ref_default`)) { + stopifnot(is.vector(`array_string_enum_ref_default`), length(`array_string_enum_ref_default`) != 0) + sapply(`array_string_enum_ref_default`, function(x) stopifnot(R6::is.R6(x))) + self$`array_string_enum_ref_default` <- `array_string_enum_ref_default` + } + if (!is.null(`array_string_enum_default`)) { + stopifnot(is.vector(`array_string_enum_default`), length(`array_string_enum_default`) != 0) + sapply(`array_string_enum_default`, function(x) stopifnot(is.character(x))) + self$`array_string_enum_default` <- `array_string_enum_default` + } + if (!is.null(`array_string_default`)) { + stopifnot(is.vector(`array_string_default`), length(`array_string_default`) != 0) + sapply(`array_string_default`, function(x) stopifnot(is.character(x))) + self$`array_string_default` <- `array_string_default` + } + if (!is.null(`array_integer_default`)) { + stopifnot(is.vector(`array_integer_default`), length(`array_integer_default`) != 0) + sapply(`array_integer_default`, function(x) stopifnot(is.character(x))) + self$`array_integer_default` <- `array_integer_default` + } + if (!is.null(`array_string`)) { + stopifnot(is.vector(`array_string`), length(`array_string`) != 0) + sapply(`array_string`, function(x) stopifnot(is.character(x))) + self$`array_string` <- `array_string` + } + if (!is.null(`array_string_nullable`)) { + stopifnot(is.vector(`array_string_nullable`), length(`array_string_nullable`) != 0) + sapply(`array_string_nullable`, function(x) stopifnot(is.character(x))) + self$`array_string_nullable` <- `array_string_nullable` + } + if (!is.null(`array_string_extension_nullable`)) { + stopifnot(is.vector(`array_string_extension_nullable`), length(`array_string_extension_nullable`) != 0) + sapply(`array_string_extension_nullable`, function(x) stopifnot(is.character(x))) + self$`array_string_extension_nullable` <- `array_string_extension_nullable` + } + if (!is.null(`string_nullable`)) { + if (!(is.character(`string_nullable`) && length(`string_nullable`) == 1)) { + stop(paste("Error! Invalid data for `string_nullable`. Must be a string:", `string_nullable`)) + } + self$`string_nullable` <- `string_nullable` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return DefaultValue in JSON format + #' @export + toJSON = function() { + DefaultValueObject <- list() + if (!is.null(self$`array_string_enum_ref_default`)) { + DefaultValueObject[["array_string_enum_ref_default"]] <- + lapply(self$`array_string_enum_ref_default`, function(x) x$toJSON()) + } + if (!is.null(self$`array_string_enum_default`)) { + DefaultValueObject[["array_string_enum_default"]] <- + self$`array_string_enum_default` + } + if (!is.null(self$`array_string_default`)) { + DefaultValueObject[["array_string_default"]] <- + self$`array_string_default` + } + if (!is.null(self$`array_integer_default`)) { + DefaultValueObject[["array_integer_default"]] <- + self$`array_integer_default` + } + if (!is.null(self$`array_string`)) { + DefaultValueObject[["array_string"]] <- + self$`array_string` + } + if (!is.null(self$`array_string_nullable`)) { + DefaultValueObject[["array_string_nullable"]] <- + self$`array_string_nullable` + } + if (!is.null(self$`array_string_extension_nullable`)) { + DefaultValueObject[["array_string_extension_nullable"]] <- + self$`array_string_extension_nullable` + } + if (!is.null(self$`string_nullable`)) { + DefaultValueObject[["string_nullable"]] <- + self$`string_nullable` + } + DefaultValueObject + }, + #' Deserialize JSON string into an instance of DefaultValue + #' + #' @description + #' Deserialize JSON string into an instance of DefaultValue + #' + #' @param input_json the JSON input + #' @return the instance of DefaultValue + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`array_string_enum_ref_default`)) { + self$`array_string_enum_ref_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_ref_default`, "array[StringEnumRef]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_string_enum_default`)) { + self$`array_string_enum_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_default`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_string_default`)) { + self$`array_string_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_default`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_integer_default`)) { + self$`array_integer_default` <- ApiClient$new()$deserializeObj(this_object$`array_integer_default`, "array[integer]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_string`)) { + self$`array_string` <- ApiClient$new()$deserializeObj(this_object$`array_string`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_string_nullable`)) { + self$`array_string_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_nullable`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`array_string_extension_nullable`)) { + self$`array_string_extension_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_extension_nullable`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`string_nullable`)) { + self$`string_nullable` <- this_object$`string_nullable` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return DefaultValue in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`array_string_enum_ref_default`)) { + sprintf( + '"array_string_enum_ref_default": + [%s] +', + paste(sapply(self$`array_string_enum_ref_default`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") + ) + }, + if (!is.null(self$`array_string_enum_default`)) { + sprintf( + '"array_string_enum_default": + [%s] + ', + paste(unlist(lapply(self$`array_string_enum_default`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`array_string_default`)) { + sprintf( + '"array_string_default": + [%s] + ', + paste(unlist(lapply(self$`array_string_default`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`array_integer_default`)) { + sprintf( + '"array_integer_default": + [%s] + ', + paste(unlist(lapply(self$`array_integer_default`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`array_string`)) { + sprintf( + '"array_string": + [%s] + ', + paste(unlist(lapply(self$`array_string`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`array_string_nullable`)) { + sprintf( + '"array_string_nullable": + [%s] + ', + paste(unlist(lapply(self$`array_string_nullable`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`array_string_extension_nullable`)) { + sprintf( + '"array_string_extension_nullable": + [%s] + ', + paste(unlist(lapply(self$`array_string_extension_nullable`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`string_nullable`)) { + sprintf( + '"string_nullable": + "%s" + ', + self$`string_nullable` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of DefaultValue + #' + #' @description + #' Deserialize JSON string into an instance of DefaultValue + #' + #' @param input_json the JSON input + #' @return the instance of DefaultValue + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`array_string_enum_ref_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_ref_default`, "array[StringEnumRef]", loadNamespace("openapi")) + self$`array_string_enum_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_default`, "array[character]", loadNamespace("openapi")) + self$`array_string_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_default`, "array[character]", loadNamespace("openapi")) + self$`array_integer_default` <- ApiClient$new()$deserializeObj(this_object$`array_integer_default`, "array[integer]", loadNamespace("openapi")) + self$`array_string` <- ApiClient$new()$deserializeObj(this_object$`array_string`, "array[character]", loadNamespace("openapi")) + self$`array_string_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_nullable`, "array[character]", loadNamespace("openapi")) + self$`array_string_extension_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_extension_nullable`, "array[character]", loadNamespace("openapi")) + self$`string_nullable` <- this_object$`string_nullable` + self + }, + #' Validate JSON input with respect to DefaultValue + #' + #' @description + #' Validate JSON input with respect to DefaultValue and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of DefaultValue + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# DefaultValue$unlock() +# +## Below is an example to define the print function +# DefaultValue$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# DefaultValue$lock() + diff --git a/samples/client/echo_api/r/R/form_api.R b/samples/client/echo_api/r/R/form_api.R new file mode 100644 index 000000000000..188c5a29db26 --- /dev/null +++ b/samples/client/echo_api/r/R/form_api.R @@ -0,0 +1,327 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Form operations +#' @description FormApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestFormIntegerBooleanString } \emph{ Test form parameter(s) } +#' Test form parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } integer_form integer +#' \item \emph{ @param } boolean_form character +#' \item \emph{ @param } string_form character +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestFormOneof } \emph{ Test form parameter(s) for oneOf schema } +#' Test form parameter(s) for oneOf schema +#' +#' \itemize{ +#' \item \emph{ @param } form1 character +#' \item \emph{ @param } form2 integer +#' \item \emph{ @param } form3 character +#' \item \emph{ @param } form4 character +#' \item \emph{ @param } id integer +#' \item \emph{ @param } name character +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestFormIntegerBooleanString #################### +#' +#' library(openapi) +#' var_integer_form <- 56 # integer | (Optional) +#' var_boolean_form <- "boolean_form_example" # character | (Optional) +#' var_string_form <- "string_form_example" # character | (Optional) +#' +#' #Test form parameter(s) +#' api_instance <- FormApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_formdata_file = "result.txt") +#' result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_form) +#' dput(result) +#' +#' +#' #################### TestFormOneof #################### +#' +#' library(openapi) +#' var_form1 <- "form1_example" # character | (Optional) +#' var_form2 <- 56 # integer | (Optional) +#' var_form3 <- "form3_example" # character | (Optional) +#' var_form4 <- "form4_example" # character | (Optional) +#' var_id <- 56 # integer | (Optional) +#' var_name <- "name_example" # character | (Optional) +#' +#' #Test form parameter(s) for oneOf schema +#' api_instance <- FormApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_namedata_file = "result.txt") +#' result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_name) +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +FormApi <- R6::R6Class( + "FormApi", + public = list( + api_client = NULL, + #' Initialize a new FormApi. + #' + #' @description + #' Initialize a new FormApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' Test form parameter(s) + #' + #' @description + #' Test form parameter(s) + #' + #' @param integer_form (optional) No description + #' @param boolean_form (optional) No description + #' @param string_form (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestFormIntegerBooleanString = function(integer_form = NULL, boolean_form = NULL, string_form = NULL, data_file = NULL, ...) { + local_var_response <- self$TestFormIntegerBooleanStringWithHttpInfo(integer_form, boolean_form, string_form, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test form parameter(s) + #' + #' @description + #' Test form parameter(s) + #' + #' @param integer_form (optional) No description + #' @param boolean_form (optional) No description + #' @param string_form (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestFormIntegerBooleanStringWithHttpInfo = function(integer_form = NULL, boolean_form = NULL, string_form = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + + form_params["integer_form"] <- `integer_form` + form_params["boolean_form"] <- `boolean_form` + form_params["string_form"] <- `string_form` + local_var_url_path <- "/form/integer/boolean/string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/x-www-form-urlencoded") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test form parameter(s) for oneOf schema + #' + #' @description + #' Test form parameter(s) for oneOf schema + #' + #' @param form1 (optional) No description + #' @param form2 (optional) No description + #' @param form3 (optional) No description + #' @param form4 (optional) No description + #' @param id (optional) No description + #' @param name (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestFormOneof = function(form1 = NULL, form2 = NULL, form3 = NULL, form4 = NULL, id = NULL, name = NULL, data_file = NULL, ...) { + local_var_response <- self$TestFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test form parameter(s) for oneOf schema + #' + #' @description + #' Test form parameter(s) for oneOf schema + #' + #' @param form1 (optional) No description + #' @param form2 (optional) No description + #' @param form3 (optional) No description + #' @param form4 (optional) No description + #' @param id (optional) No description + #' @param name (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestFormOneofWithHttpInfo = function(form1 = NULL, form2 = NULL, form3 = NULL, form4 = NULL, id = NULL, name = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + + + + + form_params["form1"] <- `form1` + form_params["form2"] <- `form2` + form_params["form3"] <- `form3` + form_params["form4"] <- `form4` + form_params["id"] <- `id` + form_params["name"] <- `name` + local_var_url_path <- "/form/oneof" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("application/x-www-form-urlencoded") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/header_api.R b/samples/client/echo_api/r/R/header_api.R new file mode 100644 index 000000000000..e561a35c304c --- /dev/null +++ b/samples/client/echo_api/r/R/header_api.R @@ -0,0 +1,194 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Header operations +#' @description HeaderApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestHeaderIntegerBooleanStringEnums } \emph{ Test header parameter(s) } +#' Test header parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } integer_header integer +#' \item \emph{ @param } boolean_header character +#' \item \emph{ @param } string_header character +#' \item \emph{ @param } enum_nonref_string_header Enum < [success, failure, unclassified] > +#' \item \emph{ @param } enum_ref_string_header \link{StringEnumRef} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestHeaderIntegerBooleanStringEnums #################### +#' +#' library(openapi) +#' var_integer_header <- 56 # integer | (Optional) +#' var_boolean_header <- "boolean_header_example" # character | (Optional) +#' var_string_header <- "string_header_example" # character | (Optional) +#' var_enum_nonref_string_header <- "enum_nonref_string_header_example" # character | (Optional) +#' var_enum_ref_string_header <- StringEnumRef$new() # StringEnumRef | (Optional) +#' +#' #Test header parameter(s) +#' api_instance <- HeaderApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_headerdata_file = "result.txt") +#' result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_header) +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +HeaderApi <- R6::R6Class( + "HeaderApi", + public = list( + api_client = NULL, + #' Initialize a new HeaderApi. + #' + #' @description + #' Initialize a new HeaderApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' Test header parameter(s) + #' + #' @description + #' Test header parameter(s) + #' + #' @param integer_header (optional) No description + #' @param boolean_header (optional) No description + #' @param string_header (optional) No description + #' @param enum_nonref_string_header (optional) No description + #' @param enum_ref_string_header (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestHeaderIntegerBooleanStringEnums = function(integer_header = NULL, boolean_header = NULL, string_header = NULL, enum_nonref_string_header = NULL, enum_ref_string_header = NULL, data_file = NULL, ...) { + local_var_response <- self$TestHeaderIntegerBooleanStringEnumsWithHttpInfo(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test header parameter(s) + #' + #' @description + #' Test header parameter(s) + #' + #' @param integer_header (optional) No description + #' @param boolean_header (optional) No description + #' @param string_header (optional) No description + #' @param enum_nonref_string_header (optional) No description + #' @param enum_ref_string_header (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestHeaderIntegerBooleanStringEnumsWithHttpInfo = function(integer_header = NULL, boolean_header = NULL, string_header = NULL, enum_nonref_string_header = NULL, enum_ref_string_header = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + + + + header_params["integer_header"] <- `integer_header` + + header_params["boolean_header"] <- `boolean_header` + + header_params["string_header"] <- `string_header` + + header_params["enum_nonref_string_header"] <- `enum_nonref_string_header` + + header_params["enum_ref_string_header"] <- `enum_ref_string_header` + + local_var_url_path <- "/header/integer/boolean/string/enums" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/number_properties_only.R b/samples/client/echo_api/r/R/number_properties_only.R new file mode 100644 index 000000000000..a025def4e587 --- /dev/null +++ b/samples/client/echo_api/r/R/number_properties_only.R @@ -0,0 +1,224 @@ +#' Create a new NumberPropertiesOnly +#' +#' @description +#' NumberPropertiesOnly Class +#' +#' @docType class +#' @title NumberPropertiesOnly +#' @description NumberPropertiesOnly Class +#' @format An \code{R6Class} generator object +#' @field number numeric [optional] +#' @field float numeric [optional] +#' @field double numeric [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +NumberPropertiesOnly <- R6::R6Class( + "NumberPropertiesOnly", + public = list( + `number` = NULL, + `float` = NULL, + `double` = NULL, + #' Initialize a new NumberPropertiesOnly class. + #' + #' @description + #' Initialize a new NumberPropertiesOnly class. + #' + #' @param number number + #' @param float float + #' @param double double + #' @param ... Other optional arguments. + #' @export + initialize = function(`number` = NULL, `float` = NULL, `double` = NULL, ...) { + if (!is.null(`number`)) { + self$`number` <- `number` + } + if (!is.null(`float`)) { + if (!(is.numeric(`float`) && length(`float`) == 1)) { + stop(paste("Error! Invalid data for `float`. Must be a number:", `float`)) + } + self$`float` <- `float` + } + if (!is.null(`double`)) { + if (!(is.numeric(`double`) && length(`double`) == 1)) { + stop(paste("Error! Invalid data for `double`. Must be a number:", `double`)) + } + self$`double` <- `double` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return NumberPropertiesOnly in JSON format + #' @export + toJSON = function() { + NumberPropertiesOnlyObject <- list() + if (!is.null(self$`number`)) { + NumberPropertiesOnlyObject[["number"]] <- + self$`number` + } + if (!is.null(self$`float`)) { + NumberPropertiesOnlyObject[["float"]] <- + self$`float` + } + if (!is.null(self$`double`)) { + NumberPropertiesOnlyObject[["double"]] <- + self$`double` + } + NumberPropertiesOnlyObject + }, + #' Deserialize JSON string into an instance of NumberPropertiesOnly + #' + #' @description + #' Deserialize JSON string into an instance of NumberPropertiesOnly + #' + #' @param input_json the JSON input + #' @return the instance of NumberPropertiesOnly + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`number`)) { + self$`number` <- this_object$`number` + } + if (!is.null(this_object$`float`)) { + self$`float` <- this_object$`float` + } + if (!is.null(this_object$`double`)) { + self$`double` <- this_object$`double` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return NumberPropertiesOnly in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`number`)) { + sprintf( + '"number": + %d + ', + self$`number` + ) + }, + if (!is.null(self$`float`)) { + sprintf( + '"float": + %d + ', + self$`float` + ) + }, + if (!is.null(self$`double`)) { + sprintf( + '"double": + %d + ', + self$`double` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of NumberPropertiesOnly + #' + #' @description + #' Deserialize JSON string into an instance of NumberPropertiesOnly + #' + #' @param input_json the JSON input + #' @return the instance of NumberPropertiesOnly + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`number` <- this_object$`number` + self$`float` <- this_object$`float` + self$`double` <- this_object$`double` + self + }, + #' Validate JSON input with respect to NumberPropertiesOnly + #' + #' @description + #' Validate JSON input with respect to NumberPropertiesOnly and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of NumberPropertiesOnly + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + if (self$`double` > 50.2) { + return(FALSE) + } + if (self$`double` < 0.8) { + return(FALSE) + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + if (self$`double` > 50.2) { + invalid_fields["double"] <- "Invalid value for `double`, must be smaller than or equal to 50.2." + } + if (self$`double` < 0.8) { + invalid_fields["double"] <- "Invalid value for `double`, must be bigger than or equal to 0.8." + } + + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# NumberPropertiesOnly$unlock() +# +## Below is an example to define the print function +# NumberPropertiesOnly$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# NumberPropertiesOnly$lock() + diff --git a/samples/client/echo_api/r/R/path_api.R b/samples/client/echo_api/r/R/path_api.R new file mode 100644 index 000000000000..7d0b9ba2e374 --- /dev/null +++ b/samples/client/echo_api/r/R/path_api.R @@ -0,0 +1,211 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Path operations +#' @description PathApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath } \emph{ Test path parameter(s) } +#' Test path parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } path_string character +#' \item \emph{ @param } path_integer integer +#' \item \emph{ @param } enum_nonref_string_path Enum < [success, failure, unclassified] > +#' \item \emph{ @param } enum_ref_string_path \link{StringEnumRef} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath #################### +#' +#' library(openapi) +#' var_path_string <- "path_string_example" # character | +#' var_path_integer <- 56 # integer | +#' var_enum_nonref_string_path <- "enum_nonref_string_path_example" # character | +#' var_enum_ref_string_path <- StringEnumRef$new() # StringEnumRef | +#' +#' #Test path parameter(s) +#' api_instance <- PathApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_pathdata_file = "result.txt") +#' result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_path) +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +PathApi <- R6::R6Class( + "PathApi", + public = list( + api_client = NULL, + #' Initialize a new PathApi. + #' + #' @description + #' Initialize a new PathApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' Test path parameter(s) + #' + #' @description + #' Test path parameter(s) + #' + #' @param path_string + #' @param path_integer + #' @param enum_nonref_string_path + #' @param enum_ref_string_path + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath = function(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, data_file = NULL, ...) { + local_var_response <- self$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test path parameter(s) + #' + #' @description + #' Test path parameter(s) + #' + #' @param path_string + #' @param path_integer + #' @param enum_nonref_string_path + #' @param enum_ref_string_path + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo = function(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + if (missing(`path_string`)) { + stop("Missing required parameter `path_string`.") + } + + if (missing(`path_integer`)) { + stop("Missing required parameter `path_integer`.") + } + + if (missing(`enum_nonref_string_path`)) { + stop("Missing required parameter `enum_nonref_string_path`.") + } + + if (missing(`enum_ref_string_path`)) { + stop("Missing required parameter `enum_ref_string_path`.") + } + + + + + + local_var_url_path <- "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + if (!missing(`path_string`)) { + local_var_url_path <- gsub("\\{path_string\\}", URLencode(as.character(`path_string`), reserved = TRUE), local_var_url_path) + } + + if (!missing(`path_integer`)) { + local_var_url_path <- gsub("\\{path_integer\\}", URLencode(as.character(`path_integer`), reserved = TRUE), local_var_url_path) + } + + if (!missing(`enum_nonref_string_path`)) { + local_var_url_path <- gsub("\\{enum_nonref_string_path\\}", URLencode(as.character(`enum_nonref_string_path`), reserved = TRUE), local_var_url_path) + } + + if (!missing(`enum_ref_string_path`)) { + local_var_url_path <- gsub("\\{enum_ref_string_path\\}", URLencode(as.character(`enum_ref_string_path`), reserved = TRUE), local_var_url_path) + } + + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/pet.R b/samples/client/echo_api/r/R/pet.R new file mode 100644 index 000000000000..9d2e80b3bb21 --- /dev/null +++ b/samples/client/echo_api/r/R/pet.R @@ -0,0 +1,330 @@ +#' Create a new Pet +#' +#' @description +#' Pet Class +#' +#' @docType class +#' @title Pet +#' @description Pet Class +#' @format An \code{R6Class} generator object +#' @field id integer [optional] +#' @field name character +#' @field category \link{Category} [optional] +#' @field photoUrls list(character) +#' @field tags list(\link{Tag}) [optional] +#' @field status pet status in the store character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +Pet <- R6::R6Class( + "Pet", + public = list( + `id` = NULL, + `name` = NULL, + `category` = NULL, + `photoUrls` = NULL, + `tags` = NULL, + `status` = NULL, + #' Initialize a new Pet class. + #' + #' @description + #' Initialize a new Pet class. + #' + #' @param name name + #' @param photoUrls photoUrls + #' @param id id + #' @param category category + #' @param tags tags + #' @param status pet status in the store + #' @param ... Other optional arguments. + #' @export + initialize = function(`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...) { + if (!missing(`name`)) { + if (!(is.character(`name`) && length(`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", `name`)) + } + self$`name` <- `name` + } + if (!missing(`photoUrls`)) { + stopifnot(is.vector(`photoUrls`), length(`photoUrls`) != 0) + sapply(`photoUrls`, function(x) stopifnot(is.character(x))) + self$`photoUrls` <- `photoUrls` + } + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`category`)) { + stopifnot(R6::is.R6(`category`)) + self$`category` <- `category` + } + if (!is.null(`tags`)) { + stopifnot(is.vector(`tags`), length(`tags`) != 0) + sapply(`tags`, function(x) stopifnot(R6::is.R6(x))) + self$`tags` <- `tags` + } + if (!is.null(`status`)) { + if (!(`status` %in% c("available", "pending", "sold"))) { + stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = "")) + } + if (!(is.character(`status`) && length(`status`) == 1)) { + stop(paste("Error! Invalid data for `status`. Must be a string:", `status`)) + } + self$`status` <- `status` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Pet in JSON format + #' @export + toJSON = function() { + PetObject <- list() + if (!is.null(self$`id`)) { + PetObject[["id"]] <- + self$`id` + } + if (!is.null(self$`name`)) { + PetObject[["name"]] <- + self$`name` + } + if (!is.null(self$`category`)) { + PetObject[["category"]] <- + self$`category`$toJSON() + } + if (!is.null(self$`photoUrls`)) { + PetObject[["photoUrls"]] <- + self$`photoUrls` + } + if (!is.null(self$`tags`)) { + PetObject[["tags"]] <- + lapply(self$`tags`, function(x) x$toJSON()) + } + if (!is.null(self$`status`)) { + PetObject[["status"]] <- + self$`status` + } + PetObject + }, + #' Deserialize JSON string into an instance of Pet + #' + #' @description + #' Deserialize JSON string into an instance of Pet + #' + #' @param input_json the JSON input + #' @return the instance of Pet + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`name`)) { + self$`name` <- this_object$`name` + } + if (!is.null(this_object$`category`)) { + `category_object` <- Category$new() + `category_object`$fromJSON(jsonlite::toJSON(this_object$`category`, auto_unbox = TRUE, digits = NA)) + self$`category` <- `category_object` + } + if (!is.null(this_object$`photoUrls`)) { + self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("openapi")) + } + if (!is.null(this_object$`tags`)) { + self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("openapi")) + } + if (!is.null(this_object$`status`)) { + if (!is.null(this_object$`status`) && !(this_object$`status` %in% c("available", "pending", "sold"))) { + stop(paste("Error! \"", this_object$`status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = "")) + } + self$`status` <- this_object$`status` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Pet in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + ) + }, + if (!is.null(self$`category`)) { + sprintf( + '"category": + %s + ', + jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA) + ) + }, + if (!is.null(self$`photoUrls`)) { + sprintf( + '"photoUrls": + [%s] + ', + paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + }, + if (!is.null(self$`tags`)) { + sprintf( + '"tags": + [%s] +', + paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",") + ) + }, + if (!is.null(self$`status`)) { + sprintf( + '"status": + "%s" + ', + self$`status` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of Pet + #' + #' @description + #' Deserialize JSON string into an instance of Pet + #' + #' @param input_json the JSON input + #' @return the instance of Pet + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`id` <- this_object$`id` + self$`name` <- this_object$`name` + self$`category` <- Category$new()$fromJSON(jsonlite::toJSON(this_object$`category`, auto_unbox = TRUE, digits = NA)) + self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("openapi")) + self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("openapi")) + if (!is.null(this_object$`status`) && !(this_object$`status` %in% c("available", "pending", "sold"))) { + stop(paste("Error! \"", this_object$`status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = "")) + } + self$`status` <- this_object$`status` + self + }, + #' Validate JSON input with respect to Pet + #' + #' @description + #' Validate JSON input with respect to Pet and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + # check the required field `name` + if (!is.null(input_json$`name`)) { + if (!(is.character(input_json$`name`) && length(input_json$`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", input_json$`name`)) + } + } else { + stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `name` is missing.")) + } + # check the required field `photoUrls` + if (!is.null(input_json$`photoUrls`)) { + stopifnot(is.vector(input_json$`photoUrls`), length(input_json$`photoUrls`) != 0) + tmp <- sapply(input_json$`photoUrls`, function(x) stopifnot(is.character(x))) + } else { + stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `photoUrls` is missing.")) + } + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of Pet + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + # check if the required `name` is null + if (is.null(self$`name`)) { + return(FALSE) + } + + # check if the required `photoUrls` is null + if (is.null(self$`photoUrls`)) { + return(FALSE) + } + + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + # check if the required `name` is null + if (is.null(self$`name`)) { + invalid_fields["name"] <- "Non-nullable required field `name` cannot be null." + } + + # check if the required `photoUrls` is null + if (is.null(self$`photoUrls`)) { + invalid_fields["photoUrls"] <- "Non-nullable required field `photoUrls` cannot be null." + } + + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# Pet$unlock() +# +## Below is an example to define the print function +# Pet$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# Pet$lock() + diff --git a/samples/client/echo_api/r/R/query.R b/samples/client/echo_api/r/R/query.R new file mode 100644 index 000000000000..4dcf16ddaf29 --- /dev/null +++ b/samples/client/echo_api/r/R/query.R @@ -0,0 +1,187 @@ +#' Create a new Query +#' +#' @description +#' Query Class +#' +#' @docType class +#' @title Query +#' @description Query Class +#' @format An \code{R6Class} generator object +#' @field id Query integer [optional] +#' @field outcomes list(character) [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +Query <- R6::R6Class( + "Query", + public = list( + `id` = NULL, + `outcomes` = NULL, + #' Initialize a new Query class. + #' + #' @description + #' Initialize a new Query class. + #' + #' @param id Query + #' @param outcomes outcomes. Default to ["SUCCESS","FAILURE"]. + #' @param ... Other optional arguments. + #' @export + initialize = function(`id` = NULL, `outcomes` = ["SUCCESS","FAILURE"], ...) { + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`outcomes`)) { + stopifnot(is.vector(`outcomes`), length(`outcomes`) != 0) + sapply(`outcomes`, function(x) stopifnot(is.character(x))) + self$`outcomes` <- `outcomes` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Query in JSON format + #' @export + toJSON = function() { + QueryObject <- list() + if (!is.null(self$`id`)) { + QueryObject[["id"]] <- + self$`id` + } + if (!is.null(self$`outcomes`)) { + QueryObject[["outcomes"]] <- + self$`outcomes` + } + QueryObject + }, + #' Deserialize JSON string into an instance of Query + #' + #' @description + #' Deserialize JSON string into an instance of Query + #' + #' @param input_json the JSON input + #' @return the instance of Query + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`outcomes`)) { + self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi")) + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Query in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`outcomes`)) { + sprintf( + '"outcomes": + [%s] + ', + paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of Query + #' + #' @description + #' Deserialize JSON string into an instance of Query + #' + #' @param input_json the JSON input + #' @return the instance of Query + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`id` <- this_object$`id` + self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi")) + self + }, + #' Validate JSON input with respect to Query + #' + #' @description + #' Validate JSON input with respect to Query and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of Query + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# Query$unlock() +# +## Below is an example to define the print function +# Query$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# Query$lock() + diff --git a/samples/client/echo_api/r/R/query_api.R b/samples/client/echo_api/r/R/query_api.R new file mode 100644 index 000000000000..c9a97540cc55 --- /dev/null +++ b/samples/client/echo_api/r/R/query_api.R @@ -0,0 +1,1051 @@ +#' Echo Server API +#' +#' Echo Server API +#' +#' The version of the OpenAPI document: 0.1.0 +#' Contact: team@openapitools.org +#' Generated by: https://openapi-generator.tech +#' +#' @docType class +#' @title Query operations +#' @description QueryApi +#' @format An \code{R6Class} generator object +#' @field api_client Handles the client-server communication. +#' +#' @section Methods: +#' \describe{ +#' \strong{ TestEnumRefString } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } enum_nonref_string_query Enum < [success, failure, unclassified] > +#' \item \emph{ @param } enum_ref_string_query \link{StringEnumRef} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryDatetimeDateString } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } datetime_query character +#' \item \emph{ @param } date_query character +#' \item \emph{ @param } string_query character +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryIntegerBooleanString } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } integer_query integer +#' \item \emph{ @param } boolean_query character +#' \item \emph{ @param } string_query character +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryStyleDeepObjectExplodeTrueObject } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } query_object \link{Pet} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryStyleDeepObjectExplodeTrueObjectAllOf } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } query_object \link{TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryStyleFormExplodeTrueArrayString } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } query_object \link{TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryStyleFormExplodeTrueObject } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } query_object \link{Pet} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' \strong{ TestQueryStyleFormExplodeTrueObjectAllOf } \emph{ Test query parameter(s) } +#' Test query parameter(s) +#' +#' \itemize{ +#' \item \emph{ @param } query_object \link{DataQuery} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' +#' } +#' +#' +#' @examples +#' \dontrun{ +#' #################### TestEnumRefString #################### +#' +#' library(openapi) +#' var_enum_nonref_string_query <- "enum_nonref_string_query_example" # character | (Optional) +#' var_enum_ref_string_query <- StringEnumRef$new() # StringEnumRef | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_querydata_file = "result.txt") +#' result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_query) +#' dput(result) +#' +#' +#' #################### TestQueryDatetimeDateString #################### +#' +#' library(openapi) +#' var_datetime_query <- "datetime_query_example" # character | (Optional) +#' var_date_query <- "date_query_example" # character | (Optional) +#' var_string_query <- "string_query_example" # character | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_querydata_file = "result.txt") +#' result <- api_instance$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_query) +#' dput(result) +#' +#' +#' #################### TestQueryIntegerBooleanString #################### +#' +#' library(openapi) +#' var_integer_query <- 56 # integer | (Optional) +#' var_boolean_query <- "boolean_query_example" # character | (Optional) +#' var_string_query <- "string_query_example" # character | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_querydata_file = "result.txt") +#' result <- api_instance$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_query) +#' dput(result) +#' +#' +#' #################### TestQueryStyleDeepObjectExplodeTrueObject #################### +#' +#' library(openapi) +#' var_query_object <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt") +#' result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_object) +#' dput(result) +#' +#' +#' #################### TestQueryStyleDeepObjectExplodeTrueObjectAllOf #################### +#' +#' library(openapi) +#' var_query_object <- test_query_style_deepObject_explode_true_object_allOf_query_object_parameter$new("size_example", "color_example", 123, "name_example") # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt") +#' result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_object) +#' dput(result) +#' +#' +#' #################### TestQueryStyleFormExplodeTrueArrayString #################### +#' +#' library(openapi) +#' var_query_object <- test_query_style_form_explode_true_array_string_query_object_parameter$new(c("values_example")) # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_objectdata_file = "result.txt") +#' result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_object) +#' dput(result) +#' +#' +#' #################### TestQueryStyleFormExplodeTrueObject #################### +#' +#' library(openapi) +#' var_query_object <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt") +#' result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_object) +#' dput(result) +#' +#' +#' #################### TestQueryStyleFormExplodeTrueObjectAllOf #################### +#' +#' library(openapi) +#' var_query_object <- DataQuery$new(123, c("SUCCESS"), "suffix_example", "text_example", "date_example") # DataQuery | (Optional) +#' +#' #Test query parameter(s) +#' api_instance <- QueryApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt") +#' result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_object) +#' dput(result) +#' +#' +#' } +#' @importFrom R6 R6Class +#' @importFrom base64enc base64encode +#' @export +QueryApi <- R6::R6Class( + "QueryApi", + public = list( + api_client = NULL, + #' Initialize a new QueryApi. + #' + #' @description + #' Initialize a new QueryApi. + #' + #' @param api_client An instance of API client. + #' @export + initialize = function(api_client) { + if (!missing(api_client)) { + self$api_client <- api_client + } else { + self$api_client <- ApiClient$new() + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param enum_nonref_string_query (optional) No description + #' @param enum_ref_string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestEnumRefString = function(enum_nonref_string_query = NULL, enum_ref_string_query = NULL, data_file = NULL, ...) { + local_var_response <- self$TestEnumRefStringWithHttpInfo(enum_nonref_string_query, enum_ref_string_query, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param enum_nonref_string_query (optional) No description + #' @param enum_ref_string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestEnumRefStringWithHttpInfo = function(enum_nonref_string_query = NULL, enum_ref_string_query = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + if (!(`enum_nonref_string_query` %in% c("success", "failure", "unclassified"))) { + stop("Invalid value for enum_nonref_string_query when calling QueryApi$TestEnumRefString. Must be [success, failure, unclassified].") + } + query_params[["enum_nonref_string_query"]] <- `enum_nonref_string_query` + + query_params[["enum_ref_string_query"]] <- `enum_ref_string_query` + + local_var_url_path <- "/query/enum_ref_string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param datetime_query (optional) No description + #' @param date_query (optional) No description + #' @param string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryDatetimeDateString = function(datetime_query = NULL, date_query = NULL, string_query = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryDatetimeDateStringWithHttpInfo(datetime_query, date_query, string_query, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param datetime_query (optional) No description + #' @param date_query (optional) No description + #' @param string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryDatetimeDateStringWithHttpInfo = function(datetime_query = NULL, date_query = NULL, string_query = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + + query_params[["datetime_query"]] <- `datetime_query` + + query_params[["date_query"]] <- `date_query` + + query_params[["string_query"]] <- `string_query` + + local_var_url_path <- "/query/datetime/date/string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param integer_query (optional) No description + #' @param boolean_query (optional) No description + #' @param string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryIntegerBooleanString = function(integer_query = NULL, boolean_query = NULL, string_query = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryIntegerBooleanStringWithHttpInfo(integer_query, boolean_query, string_query, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param integer_query (optional) No description + #' @param boolean_query (optional) No description + #' @param string_query (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryIntegerBooleanStringWithHttpInfo = function(integer_query = NULL, boolean_query = NULL, string_query = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + + + query_params[["integer_query"]] <- `integer_query` + + query_params[["boolean_query"]] <- `boolean_query` + + query_params[["string_query"]] <- `string_query` + + local_var_url_path <- "/query/integer/boolean/string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryStyleDeepObjectExplodeTrueObject = function(query_object = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(query_object, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + query_params[["query_object"]] <- `query_object` + + local_var_url_path <- "/query/style_deepObject/explode_true/object" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryStyleDeepObjectExplodeTrueObjectAllOf = function(query_object = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(query_object, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + query_params[["query_object"]] <- `query_object` + + local_var_url_path <- "/query/style_deepObject/explode_true/object/allOf" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryStyleFormExplodeTrueArrayString = function(query_object = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryStyleFormExplodeTrueArrayStringWithHttpInfo(query_object, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryStyleFormExplodeTrueArrayStringWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + query_params[["query_object"]] <- `query_object` + + local_var_url_path <- "/query/style_form/explode_true/array_string" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryStyleFormExplodeTrueObject = function(query_object = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryStyleFormExplodeTrueObjectWithHttpInfo(query_object, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryStyleFormExplodeTrueObjectWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + query_params[["query_object"]] <- `query_object` + + local_var_url_path <- "/query/style_form/explode_true/object" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestQueryStyleFormExplodeTrueObjectAllOf = function(query_object = NULL, data_file = NULL, ...) { + local_var_response <- self$TestQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(query_object, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test query parameter(s) + #' + #' @description + #' Test query parameter(s) + #' + #' @param query_object (optional) No description + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + + query_params[["query_object"]] <- `query_object` + + local_var_url_path <- "/query/style_form/explode_true/object/allOf" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list() + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "GET", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + } + ) +) diff --git a/samples/client/echo_api/r/R/string_enum_ref.R b/samples/client/echo_api/r/R/string_enum_ref.R new file mode 100644 index 000000000000..d13f7fbf67aa --- /dev/null +++ b/samples/client/echo_api/r/R/string_enum_ref.R @@ -0,0 +1,88 @@ +#' @docType class +#' @title StringEnumRef +#' @description StringEnumRef Class +#' @format An \code{R6Class} generator object +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +StringEnumRef <- R6::R6Class( + "StringEnumRef", + public = list( + #' Initialize a new StringEnumRef class. + #' + #' @description + #' Initialize a new StringEnumRef class. + #' + #' @param ... Optional arguments. + #' @export + initialize = function(...) { + local.optional.var <- list(...) + val <- unlist(local.optional.var) + enumvec <- .parse_StringEnumRef() + + stopifnot(length(val) == 1L) + + if (!val %in% enumvec) + stop("Use one of the valid values: ", + paste0(enumvec, collapse = ", ")) + private$value <- val + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return StringEnumRef in JSON format + #' @export + toJSON = function() { + jsonlite::toJSON(private$value, auto_unbox = TRUE) + }, + #' Deserialize JSON string into an instance of StringEnumRef + #' + #' @description + #' Deserialize JSON string into an instance of StringEnumRef + #' + #' @param input_json the JSON input + #' @return the instance of StringEnumRef + #' @export + fromJSON = function(input_json) { + private$value <- jsonlite::fromJSON(input_json, + simplifyVector = FALSE) + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return StringEnumRef in JSON format + #' @export + toJSONString = function() { + as.character(jsonlite::toJSON(private$value, + auto_unbox = TRUE)) + }, + #' Deserialize JSON string into an instance of StringEnumRef + #' + #' @description + #' Deserialize JSON string into an instance of StringEnumRef + #' + #' @param input_json the JSON input + #' @return the instance of StringEnumRef + #' @export + fromJSONString = function(input_json) { + private$value <- jsonlite::fromJSON(input_json, + simplifyVector = FALSE) + self + } + ), + private = list( + value = NULL + ) +) + +# add to utils.R +.parse_StringEnumRef <- function(vals) { + res <- gsub("^\\[|\\]$", "", "[success, failure, unclassified]") + unlist(strsplit(res, ", ")) +} + diff --git a/samples/client/echo_api/r/R/tag.R b/samples/client/echo_api/r/R/tag.R new file mode 100644 index 000000000000..829aa0d82067 --- /dev/null +++ b/samples/client/echo_api/r/R/tag.R @@ -0,0 +1,188 @@ +#' Create a new Tag +#' +#' @description +#' Tag Class +#' +#' @docType class +#' @title Tag +#' @description Tag Class +#' @format An \code{R6Class} generator object +#' @field id integer [optional] +#' @field name character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +Tag <- R6::R6Class( + "Tag", + public = list( + `id` = NULL, + `name` = NULL, + #' Initialize a new Tag class. + #' + #' @description + #' Initialize a new Tag class. + #' + #' @param id id + #' @param name name + #' @param ... Other optional arguments. + #' @export + initialize = function(`id` = NULL, `name` = NULL, ...) { + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`name`)) { + if (!(is.character(`name`) && length(`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", `name`)) + } + self$`name` <- `name` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Tag in JSON format + #' @export + toJSON = function() { + TagObject <- list() + if (!is.null(self$`id`)) { + TagObject[["id"]] <- + self$`id` + } + if (!is.null(self$`name`)) { + TagObject[["name"]] <- + self$`name` + } + TagObject + }, + #' Deserialize JSON string into an instance of Tag + #' + #' @description + #' Deserialize JSON string into an instance of Tag + #' + #' @param input_json the JSON input + #' @return the instance of Tag + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`name`)) { + self$`name` <- this_object$`name` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return Tag in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of Tag + #' + #' @description + #' Deserialize JSON string into an instance of Tag + #' + #' @param input_json the JSON input + #' @return the instance of Tag + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`id` <- this_object$`id` + self$`name` <- this_object$`name` + self + }, + #' Validate JSON input with respect to Tag + #' + #' @description + #' Validate JSON input with respect to Tag and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of Tag + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# Tag$unlock() +# +## Below is an example to define the print function +# Tag$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# Tag$lock() + diff --git a/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R new file mode 100644 index 000000000000..0dc284be8a92 --- /dev/null +++ b/samples/client/echo_api/r/R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -0,0 +1,238 @@ +#' Create a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +#' +#' @description +#' TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter Class +#' +#' @docType class +#' @title TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +#' @description TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter Class +#' @format An \code{R6Class} generator object +#' @field size character [optional] +#' @field color character [optional] +#' @field id integer [optional] +#' @field name character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Class( + "TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter", + public = list( + `size` = NULL, + `color` = NULL, + `id` = NULL, + `name` = NULL, + #' Initialize a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class. + #' + #' @description + #' Initialize a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class. + #' + #' @param size size + #' @param color color + #' @param id id + #' @param name name + #' @param ... Other optional arguments. + #' @export + initialize = function(`size` = NULL, `color` = NULL, `id` = NULL, `name` = NULL, ...) { + if (!is.null(`size`)) { + if (!(is.character(`size`) && length(`size`) == 1)) { + stop(paste("Error! Invalid data for `size`. Must be a string:", `size`)) + } + self$`size` <- `size` + } + if (!is.null(`color`)) { + if (!(is.character(`color`) && length(`color`) == 1)) { + stop(paste("Error! Invalid data for `color`. Must be a string:", `color`)) + } + self$`color` <- `color` + } + if (!is.null(`id`)) { + if (!(is.numeric(`id`) && length(`id`) == 1)) { + stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`)) + } + self$`id` <- `id` + } + if (!is.null(`name`)) { + if (!(is.character(`name`) && length(`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", `name`)) + } + self$`name` <- `name` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format + #' @export + toJSON = function() { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject <- list() + if (!is.null(self$`size`)) { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["size"]] <- + self$`size` + } + if (!is.null(self$`color`)) { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["color"]] <- + self$`color` + } + if (!is.null(self$`id`)) { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["id"]] <- + self$`id` + } + if (!is.null(self$`name`)) { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["name"]] <- + self$`name` + } + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject + }, + #' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' + #' @description + #' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' + #' @param input_json the JSON input + #' @return the instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`size`)) { + self$`size` <- this_object$`size` + } + if (!is.null(this_object$`color`)) { + self$`color` <- this_object$`color` + } + if (!is.null(this_object$`id`)) { + self$`id` <- this_object$`id` + } + if (!is.null(this_object$`name`)) { + self$`name` <- this_object$`name` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`size`)) { + sprintf( + '"size": + "%s" + ', + self$`size` + ) + }, + if (!is.null(self$`color`)) { + sprintf( + '"color": + "%s" + ', + self$`color` + ) + }, + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + ) + }, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' + #' @description + #' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' + #' @param input_json the JSON input + #' @return the instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`size` <- this_object$`size` + self$`color` <- this_object$`color` + self$`id` <- this_object$`id` + self$`name` <- this_object$`name` + self + }, + #' Validate JSON input with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' + #' @description + #' Validate JSON input with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$unlock() +# +## Below is an example to define the print function +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$lock() + diff --git a/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R new file mode 100644 index 000000000000..8bd1bc7c273a --- /dev/null +++ b/samples/client/echo_api/r/R/test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -0,0 +1,162 @@ +#' Create a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +#' +#' @description +#' TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter Class +#' +#' @docType class +#' @title TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +#' @description TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter Class +#' @format An \code{R6Class} generator object +#' @field values list(character) [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class( + "TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter", + public = list( + `values` = NULL, + #' Initialize a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class. + #' + #' @description + #' Initialize a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class. + #' + #' @param values values + #' @param ... Other optional arguments. + #' @export + initialize = function(`values` = NULL, ...) { + if (!is.null(`values`)) { + stopifnot(is.vector(`values`), length(`values`) != 0) + sapply(`values`, function(x) stopifnot(is.character(x))) + self$`values` <- `values` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format + #' @export + toJSON = function() { + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject <- list() + if (!is.null(self$`values`)) { + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject[["values"]] <- + self$`values` + } + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject + }, + #' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' + #' @description + #' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' + #' @param input_json the JSON input + #' @return the instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`values`)) { + self$`values` <- ApiClient$new()$deserializeObj(this_object$`values`, "array[character]", loadNamespace("openapi")) + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`values`)) { + sprintf( + '"values": + [%s] + ', + paste(unlist(lapply(self$`values`, function(x) paste0('"', x, '"'))), collapse = ",") + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' + #' @description + #' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' + #' @param input_json the JSON input + #' @return the instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`values` <- ApiClient$new()$deserializeObj(this_object$`values`, "array[character]", loadNamespace("openapi")) + self + }, + #' Validate JSON input with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' + #' @description + #' Validate JSON input with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$unlock() +# +## Below is an example to define the print function +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$lock() + diff --git a/samples/client/echo_api/r/README.md b/samples/client/echo_api/r/README.md new file mode 100644 index 000000000000..19e750a47e5a --- /dev/null +++ b/samples/client/echo_api/r/README.md @@ -0,0 +1,130 @@ +# R API client for openapi + +Echo Server API + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.RClientCodegen + +## Installation + +### Prerequisites + +Install the dependencies + +```R +install.packages("jsonlite") +install.packages("httr") +install.packages("base64enc") +``` + +### Build the package + +```sh +git clone https://github.com/GIT_USER_ID/GIT_REPO_ID +cd GIT_REPO_ID +R CMD build . +R CMD check openapi_1.0.0.tar.gz --no-manual +R CMD INSTALL --preclean openapi_1.0.0.tar.gz +``` + +### Install the package + +```R +install.packages("openapi") +``` + +To install directly from Github, use `devtools`: +```R +install.packages("devtools") +library(devtools) +install_github("GIT_USER_ID/GIT_REPO_ID") +``` + +To install the package from a local file: +```R +install.packages("openapi_1.0.0.tar.gz", repos = NULL, type = "source") +``` + +### Usage + +```R +library(openapi) +``` + +### Reformat code + +To reformat code using [styler](https://styler.r-lib.org/index.html), please run the following in the R console: + +```R +install.packages("remotes") +remotes::install_github("r-lib/styler@v1.7.0.9003") +library("styler") +style_dir() +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthApi* | [**TestAuthHttpBasic**](docs/AuthApi.md#TestAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication +*AuthApi* | [**TestAuthHttpBearer**](docs/AuthApi.md#TestAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication +*BodyApi* | [**TestBinaryGif**](docs/BodyApi.md#TestBinaryGif) | **POST** /binary/gif | Test binary (gif) response body +*BodyApi* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyApi.md#TestBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*BodyApi* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#TestBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyApi* | [**TestBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#TestBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime +*BodyApi* | [**TestEchoBodyAllOfPet**](docs/BodyApi.md#TestEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) +*BodyApi* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#TestEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*BodyApi* | [**TestEchoBodyPet**](docs/BodyApi.md#TestEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +*BodyApi* | [**TestEchoBodyPetResponseString**](docs/BodyApi.md#TestEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +*BodyApi* | [**TestEchoBodyTagResponseString**](docs/BodyApi.md#TestEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*FormApi* | [**TestFormIntegerBooleanString**](docs/FormApi.md#TestFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**TestFormOneof**](docs/FormApi.md#TestFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderApi* | [**TestHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#TestHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) +*PathApi* | [**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) +*QueryApi* | [**TestEnumRefString**](docs/QueryApi.md#TestEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +*QueryApi* | [**TestQueryDatetimeDateString**](docs/QueryApi.md#TestQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +*QueryApi* | [**TestQueryIntegerBooleanString**](docs/QueryApi.md#TestQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*QueryApi* | [**TestQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryApi* | [**TestQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +*QueryApi* | [**TestQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +## Documentation for Models + + - [Bird](docs/Bird.md) + - [Category](docs/Category.md) + - [DataQuery](docs/DataQuery.md) + - [DefaultValue](docs/DefaultValue.md) + - [NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [Pet](docs/Pet.md) + - [Query](docs/Query.md) + - [StringEnumRef](docs/StringEnumRef.md) + - [Tag](docs/Tag.md) + - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### http_auth + +- **Type**: HTTP basic authentication + +### http_bearer_auth + +- **Type**: Bearer authentication + + +## Author + +team@openapitools.org diff --git a/samples/client/echo_api/r/build_and_test.bash b/samples/client/echo_api/r/build_and_test.bash new file mode 100644 index 000000000000..730dd53024a6 --- /dev/null +++ b/samples/client/echo_api/r/build_and_test.bash @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +REPO=https://cloud.r-project.org + +export R_LIBS_USER=$HOME/R + +echo "R lib directory: $R_LIBS_USER" + +mkdir $R_LIBS_USER || true + +#Rscript -e "install.packages('jsonlite', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('httr', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('testthat', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('R6', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('base64enc', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('rlang', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('rjson', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('devtools', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('stringr', repos='$REPO', lib='$R_LIBS_USER')" +#Rscript -e "install.packages('lifecycle', repos='$REPO', lib='$R_LIBS_USER')" +# +R CMD build . +R CMD check *tar.gz --no-manual +R CMD install --preclean *tar.gz diff --git a/samples/client/echo_api/r/docs/AuthApi.md b/samples/client/echo_api/r/docs/AuthApi.md new file mode 100644 index 000000000000..cdc718d01484 --- /dev/null +++ b/samples/client/echo_api/r/docs/AuthApi.md @@ -0,0 +1,99 @@ +# 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** +> character TestAuthHttpBasic() + +To test HTTP basic authentication + +To test HTTP basic authentication + +### Example +```R +library(openapi) + +# To test HTTP basic authentication +# + +api_instance <- AuthApi$new() +# Configure HTTP basic authorization: http_auth +api_instance$api_client$username <- Sys.getenv("USERNAME") +api_instance$api_client$password <- Sys.getenv("PASSWORD") +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestAuthHttpBasic(data_file = "result.txt") +result <- api_instance$TestAuthHttpBasic() +dput(result) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**character** + +### 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 | - | + +# **TestAuthHttpBearer** +> character TestAuthHttpBearer() + +To test HTTP bearer authentication + +To test HTTP bearer authentication + +### Example +```R +library(openapi) + +# To test HTTP bearer authentication +# + +api_instance <- AuthApi$new() +# Configure HTTP bearer authorization: http_bearer_auth +api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN") +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestAuthHttpBearer(data_file = "result.txt") +result <- api_instance$TestAuthHttpBearer() +dput(result) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/Bird.md b/samples/client/echo_api/r/docs/Bird.md new file mode 100644 index 000000000000..9375f8d80e2e --- /dev/null +++ b/samples/client/echo_api/r/docs/Bird.md @@ -0,0 +1,10 @@ +# openapi::Bird + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **character** | | [optional] +**color** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/docs/BodyApi.md b/samples/client/echo_api/r/docs/BodyApi.md new file mode 100644 index 000000000000..9d631b65ce82 --- /dev/null +++ b/samples/client/echo_api/r/docs/BodyApi.md @@ -0,0 +1,435 @@ +# 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 +[**TestEchoBodyTagResponseString**](BodyApi.md#TestEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) + + +# **TestBinaryGif** +> data.frame TestBinaryGif() + +Test binary (gif) response body + +Test binary (gif) response body + +### Example +```R +library(openapi) + +# Test binary (gif) response body +# + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestBinaryGif(data_file = "result.txt") +result <- api_instance$TestBinaryGif() +dput(result) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**data.frame** + +### 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 | - | + +# **TestBodyApplicationOctetstreamBinary** +> character TestBodyApplicationOctetstreamBinary(body = var.body) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```R +library(openapi) + +# Test body parameter(s) +# +# prepare function argument(s) +var_body <- File.new('/path/to/file') # data.frame | (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_bodydata_file = "result.txt") +result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_body) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **data.frame**| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestBodyMultipartFormdataArrayOfBinary** +> character TestBodyMultipartFormdataArrayOfBinary(files) + +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### Example +```R +library(openapi) + +# Test array of binary in multipart mime +# +# prepare function argument(s) +var_files <- c(123) # array[data.frame] | + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_filesdata_file = "result.txt") +result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_files) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **files** | list( **data.frame** )| | + +### Return type + +**character** + +### 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 | - | + +# **TestBodyMultipartFormdataSingleBinary** +> character TestBodyMultipartFormdataSingleBinary(my_file = var.my_file) + +Test single binary in multipart mime + +Test single binary in multipart mime + +### Example +```R +library(openapi) + +# Test single binary in multipart mime +# +# prepare function argument(s) +var_my_file <- File.new('/path/to/file') # data.frame | (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_filedata_file = "result.txt") +result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_file) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **my_file** | **data.frame**| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestEchoBodyAllOfPet** +> Pet TestEchoBodyAllOfPet(pet = var.pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```R +library(openapi) + +# Test body parameter(s) +# +# prepare function argument(s) +var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEchoBodyAllOfPet(pet = var_petdata_file = "result.txt") +result <- api_instance$TestEchoBodyAllOfPet(pet = var_pet) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### 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 | - | + +# **TestEchoBodyFreeFormObjectResponseString** +> character TestEchoBodyFreeFormObjectResponseString(body = var.body) + +Test free form object + +Test free form object + +### Example +```R +library(openapi) + +# Test free form object +# +# prepare function argument(s) +var_body <- c(key = TODO) # object | Free form object (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_bodydata_file = "result.txt") +result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_body) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **object**| Free form object | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestEchoBodyPet** +> Pet TestEchoBodyPet(pet = var.pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```R +library(openapi) + +# Test body parameter(s) +# +# prepare function argument(s) +var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEchoBodyPet(pet = var_petdata_file = "result.txt") +result <- api_instance$TestEchoBodyPet(pet = var_pet) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### 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 | - | + +# **TestEchoBodyPetResponseString** +> character TestEchoBodyPetResponseString(pet = var.pet) + +Test empty response body + +Test empty response body + +### Example +```R +library(openapi) + +# Test empty response body +# +# prepare function argument(s) +var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEchoBodyPetResponseString(pet = var_petdata_file = "result.txt") +result <- api_instance$TestEchoBodyPetResponseString(pet = var_pet) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestEchoBodyTagResponseString** +> character TestEchoBodyTagResponseString(tag = var.tag) + +Test empty json (request body) + +Test empty json (request body) + +### Example +```R +library(openapi) + +# Test empty json (request body) +# +# prepare function argument(s) +var_tag <- Tag$new(123, "name_example") # Tag | Tag object (Optional) + +api_instance <- BodyApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEchoBodyTagResponseString(tag = var_tagdata_file = "result.txt") +result <- api_instance$TestEchoBodyTagResponseString(tag = var_tag) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag** | [**Tag**](Tag.md)| Tag object | [optional] + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/Category.md b/samples/client/echo_api/r/docs/Category.md new file mode 100644 index 000000000000..d28e076fe64f --- /dev/null +++ b/samples/client/echo_api/r/docs/Category.md @@ -0,0 +1,10 @@ +# openapi::Category + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **integer** | | [optional] +**name** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/docs/DataQuery.md b/samples/client/echo_api/r/docs/DataQuery.md new file mode 100644 index 000000000000..097f1885fe5f --- /dev/null +++ b/samples/client/echo_api/r/docs/DataQuery.md @@ -0,0 +1,13 @@ +# openapi::DataQuery + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **integer** | Query | [optional] +**outcomes** | **array[character]** | | [optional] [default to [SUCCESS, FAILURE]] [Enum: ] +**suffix** | **character** | test suffix | [optional] +**text** | **character** | Some text containing white spaces | [optional] +**date** | **character** | A date | [optional] + + diff --git a/samples/client/echo_api/r/docs/DefaultValue.md b/samples/client/echo_api/r/docs/DefaultValue.md new file mode 100644 index 000000000000..74b381be8db9 --- /dev/null +++ b/samples/client/echo_api/r/docs/DefaultValue.md @@ -0,0 +1,17 @@ +# openapi::DefaultValue + +to test the default value of properties + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_string_enum_ref_default** | [**array[StringEnumRef]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]] +**array_string_enum_default** | **array[character]** | | [optional] [default to ["success","failure"]] [Enum: ] +**array_string_default** | **array[character]** | | [optional] [default to ["failure","skipped"]] +**array_integer_default** | **array[integer]** | | [optional] [default to [1,3]] +**array_string** | **array[character]** | | [optional] +**array_string_nullable** | **array[character]** | | [optional] +**array_string_extension_nullable** | **array[character]** | | [optional] +**string_nullable** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/docs/FormApi.md b/samples/client/echo_api/r/docs/FormApi.md new file mode 100644 index 000000000000..b444d98794f6 --- /dev/null +++ b/samples/client/echo_api/r/docs/FormApi.md @@ -0,0 +1,118 @@ +# 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) +[**TestFormOneof**](FormApi.md#TestFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema + + +# **TestFormIntegerBooleanString** +> character TestFormIntegerBooleanString(integer_form = var.integer_form, boolean_form = var.boolean_form, string_form = var.string_form) + +Test form parameter(s) + +Test form parameter(s) + +### Example +```R +library(openapi) + +# Test form parameter(s) +# +# prepare function argument(s) +var_integer_form <- 56 # integer | (Optional) +var_boolean_form <- "boolean_form_example" # character | (Optional) +var_string_form <- "string_form_example" # character | (Optional) + +api_instance <- FormApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_formdata_file = "result.txt") +result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_form) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_form** | **integer**| | [optional] + **boolean_form** | **character**| | [optional] + **string_form** | **character**| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestFormOneof** +> character TestFormOneof(form1 = var.form1, form2 = var.form2, form3 = var.form3, form4 = var.form4, id = var.id, name = var.name) + +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### Example +```R +library(openapi) + +# Test form parameter(s) for oneOf schema +# +# prepare function argument(s) +var_form1 <- "form1_example" # character | (Optional) +var_form2 <- 56 # integer | (Optional) +var_form3 <- "form3_example" # character | (Optional) +var_form4 <- "form4_example" # character | (Optional) +var_id <- 56 # integer | (Optional) +var_name <- "name_example" # character | (Optional) + +api_instance <- FormApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_namedata_file = "result.txt") +result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_name) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **form1** | **character**| | [optional] + **form2** | **integer**| | [optional] + **form3** | **character**| | [optional] + **form4** | **character**| | [optional] + **id** | **integer**| | [optional] + **name** | **character**| | [optional] + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/HeaderApi.md b/samples/client/echo_api/r/docs/HeaderApi.md new file mode 100644 index 000000000000..c776aeb0722d --- /dev/null +++ b/samples/client/echo_api/r/docs/HeaderApi.md @@ -0,0 +1,64 @@ +# 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** +> character TestHeaderIntegerBooleanStringEnums(integer_header = var.integer_header, boolean_header = var.boolean_header, string_header = var.string_header, enum_nonref_string_header = var.enum_nonref_string_header, enum_ref_string_header = var.enum_ref_string_header) + +Test header parameter(s) + +Test header parameter(s) + +### Example +```R +library(openapi) + +# Test header parameter(s) +# +# prepare function argument(s) +var_integer_header <- 56 # integer | (Optional) +var_boolean_header <- "boolean_header_example" # character | (Optional) +var_string_header <- "string_header_example" # character | (Optional) +var_enum_nonref_string_header <- "enum_nonref_string_header_example" # character | (Optional) +var_enum_ref_string_header <- StringEnumRef$new() # StringEnumRef | (Optional) + +api_instance <- HeaderApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_headerdata_file = "result.txt") +result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_header) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_header** | **integer**| | [optional] + **boolean_header** | **character**| | [optional] + **string_header** | **character**| | [optional] + **enum_nonref_string_header** | Enum [success, failure, unclassified] | | [optional] + **enum_ref_string_header** | [**StringEnumRef**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/NumberPropertiesOnly.md b/samples/client/echo_api/r/docs/NumberPropertiesOnly.md new file mode 100644 index 000000000000..5491ac6bee14 --- /dev/null +++ b/samples/client/echo_api/r/docs/NumberPropertiesOnly.md @@ -0,0 +1,11 @@ +# openapi::NumberPropertiesOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**number** | **numeric** | | [optional] +**float** | **numeric** | | [optional] +**double** | **numeric** | | [optional] [Max: 50.2] [Min: 0.8] + + diff --git a/samples/client/echo_api/r/docs/PathApi.md b/samples/client/echo_api/r/docs/PathApi.md new file mode 100644 index 000000000000..ee4647056295 --- /dev/null +++ b/samples/client/echo_api/r/docs/PathApi.md @@ -0,0 +1,62 @@ +# 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** +> character TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```R +library(openapi) + +# Test path parameter(s) +# +# prepare function argument(s) +var_path_string <- "path_string_example" # character | +var_path_integer <- 56 # integer | +var_enum_nonref_string_path <- "enum_nonref_string_path_example" # character | +var_enum_ref_string_path <- StringEnumRef$new() # StringEnumRef | + +api_instance <- PathApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_pathdata_file = "result.txt") +result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_path) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path_string** | **character**| | + **path_integer** | **integer**| | + **enum_nonref_string_path** | Enum [success, failure, unclassified] | | + **enum_ref_string_path** | [**StringEnumRef**](.md)| | + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/Pet.md b/samples/client/echo_api/r/docs/Pet.md new file mode 100644 index 000000000000..72ff45a95587 --- /dev/null +++ b/samples/client/echo_api/r/docs/Pet.md @@ -0,0 +1,14 @@ +# openapi::Pet + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **integer** | | [optional] +**name** | **character** | | +**category** | [**Category**](Category.md) | | [optional] +**photoUrls** | **array[character]** | | +**tags** | [**array[Tag]**](Tag.md) | | [optional] +**status** | **character** | pet status in the store | [optional] [Enum: [available, pending, sold]] + + diff --git a/samples/client/echo_api/r/docs/Query.md b/samples/client/echo_api/r/docs/Query.md new file mode 100644 index 000000000000..6775cd084b85 --- /dev/null +++ b/samples/client/echo_api/r/docs/Query.md @@ -0,0 +1,10 @@ +# openapi::Query + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **integer** | Query | [optional] +**outcomes** | **array[character]** | | [optional] [default to ["SUCCESS","FAILURE"]] [Enum: ] + + diff --git a/samples/client/echo_api/r/docs/QueryApi.md b/samples/client/echo_api/r/docs/QueryApi.md new file mode 100644 index 000000000000..fda052d2b814 --- /dev/null +++ b/samples/client/echo_api/r/docs/QueryApi.md @@ -0,0 +1,402 @@ +# QueryApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**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) +[**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) + + +# **TestEnumRefString** +> character TestEnumRefString(enum_nonref_string_query = var.enum_nonref_string_query, enum_ref_string_query = var.enum_ref_string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_enum_nonref_string_query <- "enum_nonref_string_query_example" # character | (Optional) +var_enum_ref_string_query <- StringEnumRef$new() # StringEnumRef | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_querydata_file = "result.txt") +result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_query) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_nonref_string_query** | Enum [success, failure, unclassified] | | [optional] + **enum_ref_string_query** | [**StringEnumRef**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryDatetimeDateString** +> character TestQueryDatetimeDateString(datetime_query = var.datetime_query, date_query = var.date_query, string_query = var.string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_datetime_query <- "datetime_query_example" # character | (Optional) +var_date_query <- "date_query_example" # character | (Optional) +var_string_query <- "string_query_example" # character | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_querydata_file = "result.txt") +result <- api_instance$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_query) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **datetime_query** | **character**| | [optional] + **date_query** | **character**| | [optional] + **string_query** | **character**| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryIntegerBooleanString** +> character TestQueryIntegerBooleanString(integer_query = var.integer_query, boolean_query = var.boolean_query, string_query = var.string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_integer_query <- 56 # integer | (Optional) +var_boolean_query <- "boolean_query_example" # character | (Optional) +var_string_query <- "string_query_example" # character | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_querydata_file = "result.txt") +result <- api_instance$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_query) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_query** | **integer**| | [optional] + **boolean_query** | **character**| | [optional] + **string_query** | **character**| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryStyleDeepObjectExplodeTrueObject** +> character TestQueryStyleDeepObjectExplodeTrueObject(query_object = var.query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_query_object <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt") +result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_object) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**Pet**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryStyleDeepObjectExplodeTrueObjectAllOf** +> character TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var.query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_query_object <- test_query_style_deepObject_explode_true_object_allOf_query_object_parameter$new("size_example", "color_example", 123, "name_example") # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt") +result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_object) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryStyleFormExplodeTrueArrayString** +> character TestQueryStyleFormExplodeTrueArrayString(query_object = var.query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_query_object <- test_query_style_form_explode_true_array_string_query_object_parameter$new(c("values_example")) # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_objectdata_file = "result.txt") +result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_object) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryStyleFormExplodeTrueObject** +> character TestQueryStyleFormExplodeTrueObject(query_object = var.query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_query_object <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt") +result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_object) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**Pet**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + +# **TestQueryStyleFormExplodeTrueObjectAllOf** +> character TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var.query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```R +library(openapi) + +# Test query parameter(s) +# +# prepare function argument(s) +var_query_object <- DataQuery$new(123, c("SUCCESS"), "suffix_example", "text_example", "date_example") # DataQuery | (Optional) + +api_instance <- QueryApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt") +result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_object) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**DataQuery**](.md)| | [optional] + +### Return type + +**character** + +### 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 | - | + diff --git a/samples/client/echo_api/r/docs/StringEnumRef.md b/samples/client/echo_api/r/docs/StringEnumRef.md new file mode 100644 index 000000000000..fe51f9733128 --- /dev/null +++ b/samples/client/echo_api/r/docs/StringEnumRef.md @@ -0,0 +1,8 @@ +# openapi::StringEnumRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/echo_api/r/docs/Tag.md b/samples/client/echo_api/r/docs/Tag.md new file mode 100644 index 000000000000..85e1b2b9cdbd --- /dev/null +++ b/samples/client/echo_api/r/docs/Tag.md @@ -0,0 +1,10 @@ +# openapi::Tag + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **integer** | | [optional] +**name** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/r/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 000000000000..32a7afb36300 --- /dev/null +++ b/samples/client/echo_api/r/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,12 @@ +# openapi::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **character** | | [optional] +**color** | **character** | | [optional] +**id** | **integer** | | [optional] +**name** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/r/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..80ec524758b3 --- /dev/null +++ b/samples/client/echo_api/r/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,9 @@ +# openapi::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **array[character]** | | [optional] + + diff --git a/samples/client/echo_api/r/git_push.sh b/samples/client/echo_api/r/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/echo_api/r/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/echo_api/r/tests/testthat.R b/samples/client/echo_api/r/tests/testthat.R new file mode 100644 index 000000000000..b343a743aa8e --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(openapi) + +test_check("openapi") diff --git a/samples/client/echo_api/r/tests/testthat/test_auth_api.R b/samples/client/echo_api/r/tests/testthat/test_auth_api.R new file mode 100644 index 000000000000..c46f0a508093 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_auth_api.R @@ -0,0 +1,28 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test AuthApi") + +api_instance <- AuthApi$new() + +test_that("TestAuthHttpBasic", { + # tests for TestAuthHttpBasic + # base path: http://localhost:3000 + # To test HTTP basic authentication + # To test HTTP basic authentication + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestAuthHttpBearer", { + # tests for TestAuthHttpBearer + # base path: http://localhost:3000 + # To test HTTP bearer authentication + # To test HTTP bearer authentication + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_bird.R b/samples/client/echo_api/r/tests/testthat/test_bird.R new file mode 100644 index 000000000000..445fe63a4a7e --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_bird.R @@ -0,0 +1,20 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test Bird") + +model_instance <- Bird$new() + +test_that("size", { + # tests for the property `size` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`size`, "EXPECTED_RESULT") +}) + +test_that("color", { + # tests for the property `color` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`color`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_body_api.R b/samples/client/echo_api/r/tests/testthat/test_body_api.R new file mode 100644 index 000000000000..ff54935492fb --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_body_api.R @@ -0,0 +1,113 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test BodyApi") + +api_instance <- BodyApi$new() + +test_that("TestBinaryGif", { + # tests for TestBinaryGif + # base path: http://localhost:3000 + # Test binary (gif) response body + # Test binary (gif) response body + # @return [data.frame] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestBodyApplicationOctetstreamBinary", { + # tests for TestBodyApplicationOctetstreamBinary + # base path: http://localhost:3000 + # Test body parameter(s) + # Test body parameter(s) + # @param body data.frame (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestBodyMultipartFormdataArrayOfBinary", { + # tests for TestBodyMultipartFormdataArrayOfBinary + # base path: http://localhost:3000 + # Test array of binary in multipart mime + # Test array of binary in multipart mime + # @param files array[data.frame] + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestBodyMultipartFormdataSingleBinary", { + # tests for TestBodyMultipartFormdataSingleBinary + # base path: http://localhost:3000 + # Test single binary in multipart mime + # Test single binary in multipart mime + # @param my_file data.frame (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestEchoBodyAllOfPet", { + # tests for TestEchoBodyAllOfPet + # base path: http://localhost:3000 + # Test body parameter(s) + # Test body parameter(s) + # @param pet Pet Pet object that needs to be added to the store (optional) + # @return [Pet] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestEchoBodyFreeFormObjectResponseString", { + # tests for TestEchoBodyFreeFormObjectResponseString + # base path: http://localhost:3000 + # Test free form object + # Test free form object + # @param body object Free form object (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestEchoBodyPet", { + # tests for TestEchoBodyPet + # base path: http://localhost:3000 + # Test body parameter(s) + # Test body parameter(s) + # @param pet Pet Pet object that needs to be added to the store (optional) + # @return [Pet] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestEchoBodyPetResponseString", { + # tests for TestEchoBodyPetResponseString + # base path: http://localhost:3000 + # Test empty response body + # Test empty response body + # @param pet Pet Pet object that needs to be added to the store (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestEchoBodyTagResponseString", { + # tests for TestEchoBodyTagResponseString + # base path: http://localhost:3000 + # Test empty json (request body) + # Test empty json (request body) + # @param tag Tag Tag object (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_category.R b/samples/client/echo_api/r/tests/testthat/test_category.R new file mode 100644 index 000000000000..df2725e9cef7 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_category.R @@ -0,0 +1,20 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test Category") + +model_instance <- Category$new() + +test_that("id", { + # tests for the property `id` (integer) + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("name", { + # tests for the property `name` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`name`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_data_query.R b/samples/client/echo_api/r/tests/testthat/test_data_query.R new file mode 100644 index 000000000000..402d4fd0aca6 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_data_query.R @@ -0,0 +1,45 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test DataQuery") + +model_instance <- DataQuery$new() + +test_that("id", { + # tests for the property `id` (integer) + # Query + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("outcomes", { + # tests for the property `outcomes` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`outcomes`, "EXPECTED_RESULT") +}) + +test_that("suffix", { + # tests for the property `suffix` (character) + # test suffix + + # uncomment below to test the property + #expect_equal(model.instance$`suffix`, "EXPECTED_RESULT") +}) + +test_that("text", { + # tests for the property `text` (character) + # Some text containing white spaces + + # uncomment below to test the property + #expect_equal(model.instance$`text`, "EXPECTED_RESULT") +}) + +test_that("date", { + # tests for the property `date` (character) + # A date + + # uncomment below to test the property + #expect_equal(model.instance$`date`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_default_value.R b/samples/client/echo_api/r/tests/testthat/test_default_value.R new file mode 100644 index 000000000000..93d86ed67f90 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_default_value.R @@ -0,0 +1,62 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test DefaultValue") + +model_instance <- DefaultValue$new() + +test_that("array_string_enum_ref_default", { + # tests for the property `array_string_enum_ref_default` (array[StringEnumRef]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string_enum_ref_default`, "EXPECTED_RESULT") +}) + +test_that("array_string_enum_default", { + # tests for the property `array_string_enum_default` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string_enum_default`, "EXPECTED_RESULT") +}) + +test_that("array_string_default", { + # tests for the property `array_string_default` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string_default`, "EXPECTED_RESULT") +}) + +test_that("array_integer_default", { + # tests for the property `array_integer_default` (array[integer]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_integer_default`, "EXPECTED_RESULT") +}) + +test_that("array_string", { + # tests for the property `array_string` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string`, "EXPECTED_RESULT") +}) + +test_that("array_string_nullable", { + # tests for the property `array_string_nullable` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string_nullable`, "EXPECTED_RESULT") +}) + +test_that("array_string_extension_nullable", { + # tests for the property `array_string_extension_nullable` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`array_string_extension_nullable`, "EXPECTED_RESULT") +}) + +test_that("string_nullable", { + # tests for the property `string_nullable` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`string_nullable`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_form_api.R b/samples/client/echo_api/r/tests/testthat/test_form_api.R new file mode 100644 index 000000000000..a2b306f2d8d0 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_form_api.R @@ -0,0 +1,37 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test FormApi") + +api_instance <- FormApi$new() + +test_that("TestFormIntegerBooleanString", { + # tests for TestFormIntegerBooleanString + # base path: http://localhost:3000 + # Test form parameter(s) + # Test form parameter(s) + # @param integer_form integer (optional) + # @param boolean_form character (optional) + # @param string_form character (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestFormOneof", { + # tests for TestFormOneof + # base path: http://localhost:3000 + # Test form parameter(s) for oneOf schema + # Test form parameter(s) for oneOf schema + # @param form1 character (optional) + # @param form2 integer (optional) + # @param form3 character (optional) + # @param form4 character (optional) + # @param id integer (optional) + # @param name character (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_header_api.R b/samples/client/echo_api/r/tests/testthat/test_header_api.R new file mode 100644 index 000000000000..a74f92ef09c0 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_header_api.R @@ -0,0 +1,22 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test HeaderApi") + +api_instance <- HeaderApi$new() + +test_that("TestHeaderIntegerBooleanStringEnums", { + # tests for TestHeaderIntegerBooleanStringEnums + # base path: http://localhost:3000 + # Test header parameter(s) + # Test header parameter(s) + # @param integer_header integer (optional) + # @param boolean_header character (optional) + # @param string_header character (optional) + # @param enum_nonref_string_header character (optional) + # @param enum_ref_string_header StringEnumRef (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_number_properties_only.R b/samples/client/echo_api/r/tests/testthat/test_number_properties_only.R new file mode 100644 index 000000000000..fa81dfd408a3 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_number_properties_only.R @@ -0,0 +1,27 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test NumberPropertiesOnly") + +model_instance <- NumberPropertiesOnly$new() + +test_that("number", { + # tests for the property `number` (numeric) + + # uncomment below to test the property + #expect_equal(model.instance$`number`, "EXPECTED_RESULT") +}) + +test_that("float", { + # tests for the property `float` (numeric) + + # uncomment below to test the property + #expect_equal(model.instance$`float`, "EXPECTED_RESULT") +}) + +test_that("double", { + # tests for the property `double` (numeric) + + # uncomment below to test the property + #expect_equal(model.instance$`double`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_path_api.R b/samples/client/echo_api/r/tests/testthat/test_path_api.R new file mode 100644 index 000000000000..25b9c2499e97 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_path_api.R @@ -0,0 +1,21 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test PathApi") + +api_instance <- PathApi$new() + +test_that("TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", { + # tests for TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + # base path: http://localhost:3000 + # Test path parameter(s) + # Test path parameter(s) + # @param path_string character + # @param path_integer integer + # @param enum_nonref_string_path character + # @param enum_ref_string_path StringEnumRef + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_pet.R b/samples/client/echo_api/r/tests/testthat/test_pet.R new file mode 100644 index 000000000000..46ac351df851 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_pet.R @@ -0,0 +1,49 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test Pet") + +model_instance <- Pet$new() + +test_that("id", { + # tests for the property `id` (integer) + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("name", { + # tests for the property `name` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`name`, "EXPECTED_RESULT") +}) + +test_that("category", { + # tests for the property `category` (Category) + + # uncomment below to test the property + #expect_equal(model.instance$`category`, "EXPECTED_RESULT") +}) + +test_that("photoUrls", { + # tests for the property `photoUrls` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`photoUrls`, "EXPECTED_RESULT") +}) + +test_that("tags", { + # tests for the property `tags` (array[Tag]) + + # uncomment below to test the property + #expect_equal(model.instance$`tags`, "EXPECTED_RESULT") +}) + +test_that("status", { + # tests for the property `status` (character) + # pet status in the store + + # uncomment below to test the property + #expect_equal(model.instance$`status`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_query.R b/samples/client/echo_api/r/tests/testthat/test_query.R new file mode 100644 index 000000000000..ab164dbbf41b --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_query.R @@ -0,0 +1,21 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test Query") + +model_instance <- Query$new() + +test_that("id", { + # tests for the property `id` (integer) + # Query + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("outcomes", { + # tests for the property `outcomes` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`outcomes`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_query_api.R b/samples/client/echo_api/r/tests/testthat/test_query_api.R new file mode 100644 index 000000000000..202460c859ad --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_query_api.R @@ -0,0 +1,107 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test QueryApi") + +api_instance <- QueryApi$new() + +test_that("TestEnumRefString", { + # tests for TestEnumRefString + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param enum_nonref_string_query character (optional) + # @param enum_ref_string_query StringEnumRef (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryDatetimeDateString", { + # tests for TestQueryDatetimeDateString + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param datetime_query character (optional) + # @param date_query character (optional) + # @param string_query character (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryIntegerBooleanString", { + # tests for TestQueryIntegerBooleanString + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param integer_query integer (optional) + # @param boolean_query character (optional) + # @param string_query character (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryStyleDeepObjectExplodeTrueObject", { + # tests for TestQueryStyleDeepObjectExplodeTrueObject + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param query_object Pet (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryStyleDeepObjectExplodeTrueObjectAllOf", { + # tests for TestQueryStyleDeepObjectExplodeTrueObjectAllOf + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param query_object TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryStyleFormExplodeTrueArrayString", { + # tests for TestQueryStyleFormExplodeTrueArrayString + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param query_object TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryStyleFormExplodeTrueObject", { + # tests for TestQueryStyleFormExplodeTrueObject + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param query_object Pet (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) + +test_that("TestQueryStyleFormExplodeTrueObjectAllOf", { + # tests for TestQueryStyleFormExplodeTrueObjectAllOf + # base path: http://localhost:3000 + # Test query parameter(s) + # Test query parameter(s) + # @param query_object DataQuery (optional) + # @return [character] + + # uncomment below to test the operation + #expect_equal(result, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_string_enum_ref.R b/samples/client/echo_api/r/tests/testthat/test_string_enum_ref.R new file mode 100644 index 000000000000..69606755c1b9 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_string_enum_ref.R @@ -0,0 +1,4 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test StringEnumRef") diff --git a/samples/client/echo_api/r/tests/testthat/test_tag.R b/samples/client/echo_api/r/tests/testthat/test_tag.R new file mode 100644 index 000000000000..af8af7062cd4 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_tag.R @@ -0,0 +1,20 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test Tag") + +model_instance <- Tag$new() + +test_that("id", { + # tests for the property `id` (integer) + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("name", { + # tests for the property `name` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`name`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R b/samples/client/echo_api/r/tests/testthat/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R new file mode 100644 index 000000000000..cd240ba81631 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R @@ -0,0 +1,34 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter") + +model_instance <- TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$new() + +test_that("size", { + # tests for the property `size` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`size`, "EXPECTED_RESULT") +}) + +test_that("color", { + # tests for the property `color` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`color`, "EXPECTED_RESULT") +}) + +test_that("id", { + # tests for the property `id` (integer) + + # uncomment below to test the property + #expect_equal(model.instance$`id`, "EXPECTED_RESULT") +}) + +test_that("name", { + # tests for the property `name` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`name`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/r/tests/testthat/test_test_query_style_form_explode_true_array_string_query_object_parameter.R b/samples/client/echo_api/r/tests/testthat/test_test_query_style_form_explode_true_array_string_query_object_parameter.R new file mode 100644 index 000000000000..d6abe2299d66 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_test_query_style_form_explode_true_array_string_query_object_parameter.R @@ -0,0 +1,13 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter") + +model_instance <- TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$new() + +test_that("values", { + # tests for the property `values` (array[character]) + + # uncomment below to test the property + #expect_equal(model.instance$`values`, "EXPECTED_RESULT") +}) diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 999fe54e5946..cbe0318b9611 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -159,6 +159,7 @@ Class | Method | HTTP request | Description *UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session *UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user *ValuesApi* | [**getSomeValues**](docs/ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values +*ValuesApi* | [**internalOnlyGet**](docs/ValuesApi.md#internalOnlyGet) | **GET** /internal/only | internal only ## Documentation for Models diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index 6479fd9a5473..13cdc72e3d36 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -1316,6 +1316,23 @@ paths: tags: - values x-accepts: application/json + /internal/only: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Variable' + description: successful operation + "400": + description: Invalid Value + summary: internal only + tags: + - values + x-internal: true + x-accepts: application/json components: requestBodies: UserArray: @@ -2494,6 +2511,13 @@ components: type_: type: string type: object + x-internal: false + InteralOnly: + properties: + type: + type: string + type: object + x-internal: true AllOfModelArrayAnyOf: allOf: - $ref: '#/components/schemas/Category' diff --git a/samples/client/petstore/java/okhttp-gson/docs/ValuesApi.md b/samples/client/petstore/java/okhttp-gson/docs/ValuesApi.md index 4210bff03ec9..a607e93df06e 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/ValuesApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/ValuesApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| | [**getSomeValues**](ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values | +| [**internalOnlyGet**](ValuesApi.md#internalOnlyGet) | **GET** /internal/only | internal only | @@ -66,3 +67,62 @@ No authorization required | **200** | successful operation | - | | **400** | Invalid Value | - | + +# **internalOnlyGet** +> Variable internalOnlyGet() + +internal only + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.ValuesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + ValuesApi apiInstance = new ValuesApi(defaultClient); + try { + Variable result = apiInstance.internalOnlyGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ValuesApi#internalOnlyGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Variable**](Variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Value | - | + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/ValuesApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/ValuesApi.java index 79fe043970d5..327ccfafe4c1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/ValuesApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/ValuesApi.java @@ -189,4 +189,121 @@ public okhttp3.Call getSomeValuesAsync(final ApiCallback _callback) th localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for internalOnlyGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call internalOnlyGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/internal/only"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call internalOnlyGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return internalOnlyGetCall(_callback); + + } + + /** + * internal only + * + * @return Variable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public Variable internalOnlyGet() throws ApiException { + ApiResponse localVarResp = internalOnlyGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * internal only + * + * @return ApiResponse<Variable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public ApiResponse internalOnlyGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = internalOnlyGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * internal only (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call internalOnlyGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = internalOnlyGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/samples/client/petstore/perl/.openapi-generator/FILES b/samples/client/petstore/perl/.openapi-generator/FILES index 790e480f56da..a4c0c9025cb5 100644 --- a/samples/client/petstore/perl/.openapi-generator/FILES +++ b/samples/client/petstore/perl/.openapi-generator/FILES @@ -2,6 +2,7 @@ .travis.yml README.md bin/autodoc +cpanfile docs/AdditionalPropertiesClass.md docs/AllOfWithSingleRef.md docs/Animal.md diff --git a/samples/client/petstore/perl/cpanfile b/samples/client/petstore/perl/cpanfile new file mode 100644 index 000000000000..402fd48a247d --- /dev/null +++ b/samples/client/petstore/perl/cpanfile @@ -0,0 +1,11 @@ +requires 'Class::Accessor'; +requires 'Test::Exception'; +requires 'Test::More'; +requires 'Log::Any'; +requires 'LWP::UserAgent'; +requires 'URI::Query'; +requires 'Module::Runtime'; +requires 'DateTime'; +requires 'Module::Find'; +requires 'Moose::Role'; +requires 'JSON', '>= 2.00, < 2.80'; \ No newline at end of file diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 41591b813c3a..440d7f0e5506 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -407,7 +407,7 @@ use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); -my $request_body = WWW::OpenAPIClient::Object::HASH[string,AnyType]->new(); # HASH[string,AnyType] | request body +my $request_body = WWW::OpenAPIClient::Object::HASH[string,object]->new(); # HASH[string,object] | request body eval { $api_instance->test_additional_properties_reference(request_body => $request_body); @@ -421,7 +421,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **request_body** | [**HASH[string,AnyType]**](AnyType.md)| request body | + **request_body** | [**HASH[string,object]**](object.md)| request body | ### Return type diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm index 5282ac09acb9..bfaec929d1b2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm @@ -95,7 +95,7 @@ sub new { # class/static variables $p{http_timeout} //= 180; - $p{http_user_agent} //= 'OpenAPI-Generator/1.0.0/perl'; + $p{http_user_agent} //= 'OpenAPI-Generator/' . VERSION . '/perl'; # authentication setting $p{api_key} //= {}; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 1353b6f5b5a5..d2a79db97cf4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -539,11 +539,11 @@ sub fake_property_enum_integer_serialize { # # test referenced additionalProperties # -# @param HASH[string,AnyType] $request_body request body (required) +# @param HASH[string,object] $request_body request body (required) { my $params = { 'request_body' => { - data_type => 'HASH[string,AnyType]', + data_type => 'HASH[string,object]', description => 'request body', required => '1', }, diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TestInlineFreeformAdditionalPropertiesRequest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TestInlineFreeformAdditionalPropertiesRequest.pm index d412e6f6ed87..6e0263b26393 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TestInlineFreeformAdditionalPropertiesRequest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TestInlineFreeformAdditionalPropertiesRequest.pm @@ -30,7 +30,6 @@ use Log::Any qw($log); use Date::Parse; use DateTime; -use WWW::OpenAPIClient::Object::AnyType; use base ("Class::Accessor", "Class::Data::Inheritable"); diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t index 50c86cef1d36..e070bdb5a33b 100644 --- a/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t +++ b/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesClass'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesClass'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/AllOfWithSingleRefTest.t b/samples/client/petstore/perl/t/AllOfWithSingleRefTest.t index af22084b9639..57a3d195844e 100644 --- a/samples/client/petstore/perl/t/AllOfWithSingleRefTest.t +++ b/samples/client/petstore/perl/t/AllOfWithSingleRefTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::AllOfWithSingleRef'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::AllOfWithSingleRef'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/AnimalTest.t b/samples/client/petstore/perl/t/AnimalTest.t index da13cadf9d62..18cab8c463ea 100644 --- a/samples/client/petstore/perl/t/AnimalTest.t +++ b/samples/client/petstore/perl/t/AnimalTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Animal'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Animal'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/AnotherFakeApiTest.t b/samples/client/petstore/perl/t/AnotherFakeApiTest.t index 8efef9baceed..3ae9b65b77a3 100644 --- a/samples/client/petstore/perl/t/AnotherFakeApiTest.t +++ b/samples/client/petstore/perl/t/AnotherFakeApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -36,3 +36,5 @@ isa_ok($api, 'WWW::OpenAPIClient::AnotherFakeApi'); #my $call_123_test_special_tags_client = undef; # replace NULL with a proper value #my $call_123_test_special_tags_result = $api->call_123_test_special_tags(client => $call_123_test_special_tags_client); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ApiResponseTest.t b/samples/client/petstore/perl/t/ApiResponseTest.t index ba9e4fc212b6..c829836d8ee9 100644 --- a/samples/client/petstore/perl/t/ApiResponseTest.t +++ b/samples/client/petstore/perl/t/ApiResponseTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ApiResponse'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ApiResponse'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ArrayOfArrayOfNumberOnlyTest.t b/samples/client/petstore/perl/t/ArrayOfArrayOfNumberOnlyTest.t index 80ea0374e832..e0bd8ea4d8bb 100644 --- a/samples/client/petstore/perl/t/ArrayOfArrayOfNumberOnlyTest.t +++ b/samples/client/petstore/perl/t/ArrayOfArrayOfNumberOnlyTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ArrayOfArrayOfNumberOnly'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ArrayOfArrayOfNumberOnly'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ArrayOfNumberOnlyTest.t b/samples/client/petstore/perl/t/ArrayOfNumberOnlyTest.t index aa9c65709065..72d70684d129 100644 --- a/samples/client/petstore/perl/t/ArrayOfNumberOnlyTest.t +++ b/samples/client/petstore/perl/t/ArrayOfNumberOnlyTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ArrayOfNumberOnly'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ArrayOfNumberOnly'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ArrayTestTest.t b/samples/client/petstore/perl/t/ArrayTestTest.t index d2b1188f08ce..049602de00c6 100644 --- a/samples/client/petstore/perl/t/ArrayTestTest.t +++ b/samples/client/petstore/perl/t/ArrayTestTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ArrayTest'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ArrayTest'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/CapitalizationTest.t b/samples/client/petstore/perl/t/CapitalizationTest.t index b9809bd1aa78..72e016bc5006 100644 --- a/samples/client/petstore/perl/t/CapitalizationTest.t +++ b/samples/client/petstore/perl/t/CapitalizationTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Capitalization'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Capitalization'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/CatTest.t b/samples/client/petstore/perl/t/CatTest.t index 56df7dee63df..25f86073a471 100644 --- a/samples/client/petstore/perl/t/CatTest.t +++ b/samples/client/petstore/perl/t/CatTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Cat'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Cat'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/CategoryTest.t b/samples/client/petstore/perl/t/CategoryTest.t index bcb06e64554b..e4e949b1d9d4 100644 --- a/samples/client/petstore/perl/t/CategoryTest.t +++ b/samples/client/petstore/perl/t/CategoryTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Category'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Category'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ChildWithNullableTest.t b/samples/client/petstore/perl/t/ChildWithNullableTest.t index 2823fc4b3ccb..86e8d4352edc 100644 --- a/samples/client/petstore/perl/t/ChildWithNullableTest.t +++ b/samples/client/petstore/perl/t/ChildWithNullableTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ChildWithNullable'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ChildWithNullable'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ClassModelTest.t b/samples/client/petstore/perl/t/ClassModelTest.t index cdbae32e3ca3..6e6aa0364d95 100644 --- a/samples/client/petstore/perl/t/ClassModelTest.t +++ b/samples/client/petstore/perl/t/ClassModelTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ClassModel'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ClassModel'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ClientTest.t b/samples/client/petstore/perl/t/ClientTest.t index 6861bc971539..d46030b063c1 100644 --- a/samples/client/petstore/perl/t/ClientTest.t +++ b/samples/client/petstore/perl/t/ClientTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Client'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Client'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/DefaultApiTest.t b/samples/client/petstore/perl/t/DefaultApiTest.t index 16155a2d403a..9ff3f08a58e7 100644 --- a/samples/client/petstore/perl/t/DefaultApiTest.t +++ b/samples/client/petstore/perl/t/DefaultApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -35,3 +35,5 @@ isa_ok($api, 'WWW::OpenAPIClient::DefaultApi'); # uncomment below and update the test #my $foo_get_result = $api->foo_get(); + +done_testing(); diff --git a/samples/client/petstore/perl/t/DeprecatedModelTest.t b/samples/client/petstore/perl/t/DeprecatedModelTest.t index eae5d838bc99..f39c9912493f 100644 --- a/samples/client/petstore/perl/t/DeprecatedModelTest.t +++ b/samples/client/petstore/perl/t/DeprecatedModelTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::DeprecatedModel'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::DeprecatedModel'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/DeprecatedObjectTest.t b/samples/client/petstore/perl/t/DeprecatedObjectTest.t deleted file mode 100644 index 485a695b4bb2..000000000000 --- a/samples/client/petstore/perl/t/DeprecatedObjectTest.t +++ /dev/null @@ -1,34 +0,0 @@ -=begin comment - -OpenAPI Petstore - -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech - -=end comment - -=cut - -# -# NOTE: This class is auto generated by the OpenAPI Generator -# Please update the test cases below to test the model. -# Ref: https://openapi-generator.tech -# -use Test::More tests => 2; -use Test::Exception; - -use lib 'lib'; -use strict; -use warnings; - - -use_ok('WWW::OpenAPIClient::Object::DeprecatedObject'); - -# uncomment below and update the test -#my $instance = WWW::OpenAPIClient::Object::DeprecatedObject->new(); -# -#isa_ok($instance, 'WWW::OpenAPIClient::Object::DeprecatedObject'); - diff --git a/samples/client/petstore/perl/t/DogTest.t b/samples/client/petstore/perl/t/DogTest.t index 285ce98c7073..7f1c0785c3c0 100644 --- a/samples/client/petstore/perl/t/DogTest.t +++ b/samples/client/petstore/perl/t/DogTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Dog'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Dog'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/EnumArraysTest.t b/samples/client/petstore/perl/t/EnumArraysTest.t index 6be5ccb047b3..986587af0125 100644 --- a/samples/client/petstore/perl/t/EnumArraysTest.t +++ b/samples/client/petstore/perl/t/EnumArraysTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::EnumArrays'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::EnumArrays'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/EnumClassTest.t b/samples/client/petstore/perl/t/EnumClassTest.t index 4e22665ef6cc..d7995647816d 100644 --- a/samples/client/petstore/perl/t/EnumClassTest.t +++ b/samples/client/petstore/perl/t/EnumClassTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::EnumClass'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::EnumClass'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/EnumTestTest.t b/samples/client/petstore/perl/t/EnumTestTest.t index 8a84c3417d9b..22b745c32c0c 100644 --- a/samples/client/petstore/perl/t/EnumTestTest.t +++ b/samples/client/petstore/perl/t/EnumTestTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::EnumTest'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::EnumTest'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FakeApiTest.t b/samples/client/petstore/perl/t/FakeApiTest.t index 512767a782be..35d84c36f45c 100644 --- a/samples/client/petstore/perl/t/FakeApiTest.t +++ b/samples/client/petstore/perl/t/FakeApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -29,6 +29,12 @@ use_ok('WWW::OpenAPIClient::FakeApi'); my $api = WWW::OpenAPIClient::FakeApi->new(); isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); +# +# fake_big_decimal_map test +# +# uncomment below and update the test +#my $fake_big_decimal_map_result = $api->fake_big_decimal_map(); + # # fake_health_get test # @@ -79,6 +85,20 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); #my $fake_property_enum_integer_serialize_outer_object_with_enum_property = undef; # replace NULL with a proper value #my $fake_property_enum_integer_serialize_result = $api->fake_property_enum_integer_serialize(outer_object_with_enum_property => $fake_property_enum_integer_serialize_outer_object_with_enum_property); +# +# test_additional_properties_reference test +# +# uncomment below and update the test +#my $test_additional_properties_reference_request_body = undef; # replace NULL with a proper value +#my $test_additional_properties_reference_result = $api->test_additional_properties_reference(request_body => $test_additional_properties_reference_request_body); + +# +# test_body_with_binary test +# +# uncomment below and update the test +#my $test_body_with_binary_body = undef; # replace NULL with a proper value +#my $test_body_with_binary_result = $api->test_body_with_binary(body => $test_body_with_binary_body); + # # test_body_with_file_schema test # @@ -131,9 +151,10 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); #my $test_enum_parameters_enum_query_string = undef; # replace NULL with a proper value #my $test_enum_parameters_enum_query_integer = undef; # replace NULL with a proper value #my $test_enum_parameters_enum_query_double = undef; # replace NULL with a proper value +#my $test_enum_parameters_enum_query_model_array = undef; # replace NULL with a proper value #my $test_enum_parameters_enum_form_string_array = undef; # replace NULL with a proper value #my $test_enum_parameters_enum_form_string = undef; # replace NULL with a proper value -#my $test_enum_parameters_result = $api->test_enum_parameters(enum_header_string_array => $test_enum_parameters_enum_header_string_array, enum_header_string => $test_enum_parameters_enum_header_string, enum_query_string_array => $test_enum_parameters_enum_query_string_array, enum_query_string => $test_enum_parameters_enum_query_string, enum_query_integer => $test_enum_parameters_enum_query_integer, enum_query_double => $test_enum_parameters_enum_query_double, enum_form_string_array => $test_enum_parameters_enum_form_string_array, enum_form_string => $test_enum_parameters_enum_form_string); +#my $test_enum_parameters_result = $api->test_enum_parameters(enum_header_string_array => $test_enum_parameters_enum_header_string_array, enum_header_string => $test_enum_parameters_enum_header_string, enum_query_string_array => $test_enum_parameters_enum_query_string_array, enum_query_string => $test_enum_parameters_enum_query_string, enum_query_integer => $test_enum_parameters_enum_query_integer, enum_query_double => $test_enum_parameters_enum_query_double, enum_query_model_array => $test_enum_parameters_enum_query_model_array, enum_form_string_array => $test_enum_parameters_enum_form_string_array, enum_form_string => $test_enum_parameters_enum_form_string); # # test_group_parameters test @@ -154,6 +175,13 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); #my $test_inline_additional_properties_request_body = undef; # replace NULL with a proper value #my $test_inline_additional_properties_result = $api->test_inline_additional_properties(request_body => $test_inline_additional_properties_request_body); +# +# test_inline_freeform_additional_properties test +# +# uncomment below and update the test +#my $test_inline_freeform_additional_properties_test_inline_freeform_additional_properties_request = undef; # replace NULL with a proper value +#my $test_inline_freeform_additional_properties_result = $api->test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request => $test_inline_freeform_additional_properties_test_inline_freeform_additional_properties_request); + # # test_json_form_data test # @@ -162,6 +190,13 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); #my $test_json_form_data_param2 = undef; # replace NULL with a proper value #my $test_json_form_data_result = $api->test_json_form_data(param => $test_json_form_data_param, param2 => $test_json_form_data_param2); +# +# test_nullable test +# +# uncomment below and update the test +#my $test_nullable_child_with_nullable = undef; # replace NULL with a proper value +#my $test_nullable_result = $api->test_nullable(child_with_nullable => $test_nullable_child_with_nullable); + # # test_query_parameter_collection_format test # @@ -171,5 +206,9 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeApi'); #my $test_query_parameter_collection_format_http = undef; # replace NULL with a proper value #my $test_query_parameter_collection_format_url = undef; # replace NULL with a proper value #my $test_query_parameter_collection_format_context = undef; # replace NULL with a proper value -#my $test_query_parameter_collection_format_result = $api->test_query_parameter_collection_format(pipe => $test_query_parameter_collection_format_pipe, ioutil => $test_query_parameter_collection_format_ioutil, http => $test_query_parameter_collection_format_http, url => $test_query_parameter_collection_format_url, context => $test_query_parameter_collection_format_context); +#my $test_query_parameter_collection_format_allow_empty = undef; # replace NULL with a proper value +#my $test_query_parameter_collection_format_language = undef; # replace NULL with a proper value +#my $test_query_parameter_collection_format_result = $api->test_query_parameter_collection_format(pipe => $test_query_parameter_collection_format_pipe, ioutil => $test_query_parameter_collection_format_ioutil, http => $test_query_parameter_collection_format_http, url => $test_query_parameter_collection_format_url, context => $test_query_parameter_collection_format_context, allow_empty => $test_query_parameter_collection_format_allow_empty, language => $test_query_parameter_collection_format_language); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t b/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t index 49fa018db703..6eaeb38b7850 100644 --- a/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t +++ b/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t b/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t index 6bbbac594b8c..c406e3f10e12 100644 --- a/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t +++ b/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -36,3 +36,5 @@ isa_ok($api, 'WWW::OpenAPIClient::FakeClassnameTags123Api'); #my $test_classname_client = undef; # replace NULL with a proper value #my $test_classname_result = $api->test_classname(client => $test_classname_client); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FileSchemaTestClassTest.t b/samples/client/petstore/perl/t/FileSchemaTestClassTest.t index 040d6d955964..8d3a4ec7c16f 100644 --- a/samples/client/petstore/perl/t/FileSchemaTestClassTest.t +++ b/samples/client/petstore/perl/t/FileSchemaTestClassTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::FileSchemaTestClass'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::FileSchemaTestClass'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FileTest.t b/samples/client/petstore/perl/t/FileTest.t index 59a96f574cda..d23c43e7072d 100644 --- a/samples/client/petstore/perl/t/FileTest.t +++ b/samples/client/petstore/perl/t/FileTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::File'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::File'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t b/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t index 407f118a09f9..1ae981b99a94 100644 --- a/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t +++ b/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::FooGetDefaultResponse'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::FooGetDefaultResponse'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FooTest.t b/samples/client/petstore/perl/t/FooTest.t index 5ce9e8b66a4e..7c5fc34b0b34 100644 --- a/samples/client/petstore/perl/t/FooTest.t +++ b/samples/client/petstore/perl/t/FooTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Foo'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Foo'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/FormatTestTest.t b/samples/client/petstore/perl/t/FormatTestTest.t index 78bf3cafb1d3..28add9f02256 100644 --- a/samples/client/petstore/perl/t/FormatTestTest.t +++ b/samples/client/petstore/perl/t/FormatTestTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::FormatTest'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::FormatTest'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/HasOnlyReadOnlyTest.t b/samples/client/petstore/perl/t/HasOnlyReadOnlyTest.t index 8c4007b946a9..695dd3905856 100644 --- a/samples/client/petstore/perl/t/HasOnlyReadOnlyTest.t +++ b/samples/client/petstore/perl/t/HasOnlyReadOnlyTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::HasOnlyReadOnly'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::HasOnlyReadOnly'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/HealthCheckResultTest.t b/samples/client/petstore/perl/t/HealthCheckResultTest.t index 6e5e4b0f964c..cd900959db95 100644 --- a/samples/client/petstore/perl/t/HealthCheckResultTest.t +++ b/samples/client/petstore/perl/t/HealthCheckResultTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::HealthCheckResult'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::HealthCheckResult'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/InlineResponseDefaultTest.t b/samples/client/petstore/perl/t/InlineResponseDefaultTest.t deleted file mode 100644 index 2b3da22fde3e..000000000000 --- a/samples/client/petstore/perl/t/InlineResponseDefaultTest.t +++ /dev/null @@ -1,34 +0,0 @@ -=begin comment - -OpenAPI Petstore - -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech - -=end comment - -=cut - -# -# NOTE: This class is auto generated by the OpenAPI Generator -# Please update the test cases below to test the model. -# Ref: https://openapi-generator.tech -# -use Test::More tests => 2; -use Test::Exception; - -use lib 'lib'; -use strict; -use warnings; - - -use_ok('WWW::OpenAPIClient::Object::InlineResponseDefault'); - -# uncomment below and update the test -#my $instance = WWW::OpenAPIClient::Object::InlineResponseDefault->new(); -# -#isa_ok($instance, 'WWW::OpenAPIClient::Object::InlineResponseDefault'); - diff --git a/samples/client/petstore/perl/t/ListTest.t b/samples/client/petstore/perl/t/ListTest.t index 484f357bcb3a..8939200d1967 100644 --- a/samples/client/petstore/perl/t/ListTest.t +++ b/samples/client/petstore/perl/t/ListTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::List'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::List'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/MapTestTest.t b/samples/client/petstore/perl/t/MapTestTest.t index 08e0e76365e5..ad4289f0aca7 100644 --- a/samples/client/petstore/perl/t/MapTestTest.t +++ b/samples/client/petstore/perl/t/MapTestTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::MapTest'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::MapTest'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t b/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t index 32fc58f324e0..4f87f4e8a0ad 100644 --- a/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t +++ b/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass' # #isa_ok($instance, 'WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/Model200ResponseTest.t b/samples/client/petstore/perl/t/Model200ResponseTest.t index 603e1c1471cb..2e7a0b218e73 100644 --- a/samples/client/petstore/perl/t/Model200ResponseTest.t +++ b/samples/client/petstore/perl/t/Model200ResponseTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Model200Response'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Model200Response'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ModelReturnTest.t b/samples/client/petstore/perl/t/ModelReturnTest.t index 283ed51adae7..06b2e2e3865e 100644 --- a/samples/client/petstore/perl/t/ModelReturnTest.t +++ b/samples/client/petstore/perl/t/ModelReturnTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ModelReturn'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ModelReturn'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/NameTest.t b/samples/client/petstore/perl/t/NameTest.t index eb0f0e9bc887..318a4b2c0b7f 100644 --- a/samples/client/petstore/perl/t/NameTest.t +++ b/samples/client/petstore/perl/t/NameTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Name'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Name'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/NullableClassTest.t b/samples/client/petstore/perl/t/NullableClassTest.t index 932dfe3a950a..2841320be930 100644 --- a/samples/client/petstore/perl/t/NullableClassTest.t +++ b/samples/client/petstore/perl/t/NullableClassTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::NullableClass'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::NullableClass'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/NumberOnlyTest.t b/samples/client/petstore/perl/t/NumberOnlyTest.t index 710bddd63400..62c30491ddd1 100644 --- a/samples/client/petstore/perl/t/NumberOnlyTest.t +++ b/samples/client/petstore/perl/t/NumberOnlyTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::NumberOnly'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::NumberOnly'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ObjectWithDeprecatedFieldsTest.t b/samples/client/petstore/perl/t/ObjectWithDeprecatedFieldsTest.t index 008d6996ca73..430852006ba2 100644 --- a/samples/client/petstore/perl/t/ObjectWithDeprecatedFieldsTest.t +++ b/samples/client/petstore/perl/t/ObjectWithDeprecatedFieldsTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ObjectWithDeprecatedFields'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ObjectWithDeprecatedFields'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OrderTest.t b/samples/client/petstore/perl/t/OrderTest.t index 08499ad4d9c4..bff5005086d9 100644 --- a/samples/client/petstore/perl/t/OrderTest.t +++ b/samples/client/petstore/perl/t/OrderTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Order'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Order'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterCompositeTest.t b/samples/client/petstore/perl/t/OuterCompositeTest.t index 3e23fa93c337..37dbafbdafc4 100644 --- a/samples/client/petstore/perl/t/OuterCompositeTest.t +++ b/samples/client/petstore/perl/t/OuterCompositeTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterComposite'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterComposite'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t b/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t index 7b52c276fa02..329ebfbb577c 100644 --- a/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t +++ b/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterEnumDefaultValue'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumDefaultValue'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t b/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t index 56e114ab16a0..af7cd3c4632b 100644 --- a/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t +++ b/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterEnumIntegerTest.t b/samples/client/petstore/perl/t/OuterEnumIntegerTest.t index b10b2e69d45a..615a6d7935b1 100644 --- a/samples/client/petstore/perl/t/OuterEnumIntegerTest.t +++ b/samples/client/petstore/perl/t/OuterEnumIntegerTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterEnumInteger'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumInteger'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterEnumTest.t b/samples/client/petstore/perl/t/OuterEnumTest.t index 39fd44262814..2a50627284e2 100644 --- a/samples/client/petstore/perl/t/OuterEnumTest.t +++ b/samples/client/petstore/perl/t/OuterEnumTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterEnum'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnum'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t b/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t index b28dd8492b33..29a7add8357c 100644 --- a/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t +++ b/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ParentWithNullableTest.t b/samples/client/petstore/perl/t/ParentWithNullableTest.t index 8ee9800aa3c3..18e976dfc024 100644 --- a/samples/client/petstore/perl/t/ParentWithNullableTest.t +++ b/samples/client/petstore/perl/t/ParentWithNullableTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ParentWithNullable'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ParentWithNullable'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/PetApiTest.t b/samples/client/petstore/perl/t/PetApiTest.t index 479af7c718f1..666dc67c146e 100644 --- a/samples/client/petstore/perl/t/PetApiTest.t +++ b/samples/client/petstore/perl/t/PetApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -99,3 +99,5 @@ isa_ok($api, 'WWW::OpenAPIClient::PetApi'); #my $upload_file_with_required_file_additional_metadata = undef; # replace NULL with a proper value #my $upload_file_with_required_file_result = $api->upload_file_with_required_file(pet_id => $upload_file_with_required_file_pet_id, required_file => $upload_file_with_required_file_required_file, additional_metadata => $upload_file_with_required_file_additional_metadata); + +done_testing(); diff --git a/samples/client/petstore/perl/t/PetTest.t b/samples/client/petstore/perl/t/PetTest.t index 988648c4ed36..b2f3809fc3cc 100644 --- a/samples/client/petstore/perl/t/PetTest.t +++ b/samples/client/petstore/perl/t/PetTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Pet'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Pet'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/ReadOnlyFirstTest.t b/samples/client/petstore/perl/t/ReadOnlyFirstTest.t index cf1360392035..f6d7694aafe7 100644 --- a/samples/client/petstore/perl/t/ReadOnlyFirstTest.t +++ b/samples/client/petstore/perl/t/ReadOnlyFirstTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::ReadOnlyFirst'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::ReadOnlyFirst'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/SingleRefTypeTest.t b/samples/client/petstore/perl/t/SingleRefTypeTest.t index 652ac5797d0d..ecd3bf0547c0 100644 --- a/samples/client/petstore/perl/t/SingleRefTypeTest.t +++ b/samples/client/petstore/perl/t/SingleRefTypeTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::SingleRefType'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::SingleRefType'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/SpecialModelNameTest.t b/samples/client/petstore/perl/t/SpecialModelNameTest.t index 8048dd3ab302..a30bde97be5b 100644 --- a/samples/client/petstore/perl/t/SpecialModelNameTest.t +++ b/samples/client/petstore/perl/t/SpecialModelNameTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::SpecialModelName'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::SpecialModelName'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/StoreApiTest.t b/samples/client/petstore/perl/t/StoreApiTest.t index c2dcf8cd64b4..bf9d3db403ca 100644 --- a/samples/client/petstore/perl/t/StoreApiTest.t +++ b/samples/client/petstore/perl/t/StoreApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -56,3 +56,5 @@ isa_ok($api, 'WWW::OpenAPIClient::StoreApi'); #my $place_order_order = undef; # replace NULL with a proper value #my $place_order_result = $api->place_order(order => $place_order_order); + +done_testing(); diff --git a/samples/client/petstore/perl/t/TagTest.t b/samples/client/petstore/perl/t/TagTest.t index 1a5b2ee23aea..d2ddd0c304ed 100644 --- a/samples/client/petstore/perl/t/TagTest.t +++ b/samples/client/petstore/perl/t/TagTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::Tag'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::Tag'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/TestInlineFreeformAdditionalPropertiesRequestTest.t b/samples/client/petstore/perl/t/TestInlineFreeformAdditionalPropertiesRequestTest.t index 32d797e4c40f..76b05931eaaf 100644 --- a/samples/client/petstore/perl/t/TestInlineFreeformAdditionalPropertiesRequestTest.t +++ b/samples/client/petstore/perl/t/TestInlineFreeformAdditionalPropertiesRequestTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::TestInlineFreeformAdditionalPropertiesReques # #isa_ok($instance, 'WWW::OpenAPIClient::Object::TestInlineFreeformAdditionalPropertiesRequest'); + +done_testing(); diff --git a/samples/client/petstore/perl/t/UserApiTest.t b/samples/client/petstore/perl/t/UserApiTest.t index a79d1fc2570f..66f9e9ce6f7f 100644 --- a/samples/client/petstore/perl/t/UserApiTest.t +++ b/samples/client/petstore/perl/t/UserApiTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the API endpoints. # Ref: https://openapi-generator.tech # -use Test::More tests => 1; #TODO update number of test cases +use Test::More; use Test::Exception; use lib 'lib'; @@ -86,3 +86,5 @@ isa_ok($api, 'WWW::OpenAPIClient::UserApi'); #my $update_user_user = undef; # replace NULL with a proper value #my $update_user_result = $api->update_user(username => $update_user_username, user => $update_user_user); + +done_testing(); diff --git a/samples/client/petstore/perl/t/UserTest.t b/samples/client/petstore/perl/t/UserTest.t index 1e678b9efebd..35c464d75560 100644 --- a/samples/client/petstore/perl/t/UserTest.t +++ b/samples/client/petstore/perl/t/UserTest.t @@ -17,7 +17,7 @@ Generated by: https://openapi-generator.tech # Please update the test cases below to test the model. # Ref: https://openapi-generator.tech # -use Test::More tests => 2; +use Test::More; use Test::Exception; use lib 'lib'; @@ -32,3 +32,5 @@ use_ok('WWW::OpenAPIClient::Object::User'); # #isa_ok($instance, 'WWW::OpenAPIClient::Object::User'); + +done_testing(); diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs index 9c95d11a9e3d..23bea6cf2ff3 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs @@ -489,7 +489,7 @@ impl std::str::FromStr for AnyOfGet202Response { impl PartialEq for AnyOfGet202Response { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } } @@ -519,7 +519,7 @@ impl std::str::FromStr for AnyOfObject { impl PartialEq for AnyOfObject { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } } @@ -990,7 +990,7 @@ impl std::str::FromStr for Model12345AnyOfObject { impl PartialEq for Model12345AnyOfObject { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } } @@ -2293,7 +2293,7 @@ impl std::str::FromStr for OneOfGet200Response { impl PartialEq for OneOfGet200Response { fn eq(&self, other: &Self) -> bool { - self.0.get().eq(other.0.get()) + self.0.get() == other.0.get() } }