[BUG][CLI][GENERATOR] NullPointer when not setting outputDir (updated) (#3752)

* Fixes NPE when no outputDir is set

* Fix behaviors of default values for values not provided by user

* Easier handling of default behavior in settings.

* Fixes for dynamic config deserialization (specifically, ruby client sample fix)

* Tests for WorkflowSettings (defaults, modified defaults, nulls)

* Test modification of WorkflowSettings defaults for both class constructor and builder
This commit is contained in:
Jim Schubert
2019-08-25 19:19:52 -04:00
committed by GitHub
parent 136c1407ac
commit ee7c8a82e8
76 changed files with 583 additions and 230 deletions

View File

@@ -2,5 +2,6 @@
"gemName": "petstore", "gemName": "petstore",
"moduleName": "Petstore", "moduleName": "Petstore",
"library": "faraday", "library": "faraday",
"gemVersion": "1.0.0" "gemVersion": "1.0.0",
"strictSpecBehavior": false
} }

View File

@@ -2,5 +2,6 @@
"gemName": "petstore", "gemName": "petstore",
"library": "typhoeus", "library": "typhoeus",
"moduleName": "Petstore", "moduleName": "Petstore",
"gemVersion": "1.0.0" "gemVersion": "1.0.0",
"strictSpecBehavior": false
} }

View File

@@ -421,13 +421,27 @@ public final class GeneratorSettings implements Serializable {
builder.artifactId = copy.getArtifactId(); builder.artifactId = copy.getArtifactId();
builder.artifactVersion = copy.getArtifactVersion(); builder.artifactVersion = copy.getArtifactVersion();
builder.library = copy.getLibrary(); builder.library = copy.getLibrary();
builder.instantiationTypes = new HashMap<>(copy.getInstantiationTypes()); if (copy.getInstantiationTypes() != null) {
builder.typeMappings = new HashMap<>(copy.getTypeMappings()); builder.instantiationTypes.putAll(copy.getInstantiationTypes());
builder.additionalProperties = new HashMap<>(copy.getAdditionalProperties()); }
builder.importMappings = new HashMap<>(copy.getImportMappings()); if (copy.getTypeMappings() != null) {
builder.languageSpecificPrimitives = new HashSet<>(copy.getLanguageSpecificPrimitives()); builder.typeMappings.putAll(copy.getTypeMappings());
builder.reservedWordMappings = new HashMap<>(copy.getReservedWordMappings()); }
builder.serverVariables = new HashMap<>(copy.getServerVariables()); if (copy.getAdditionalProperties() != null) {
builder.additionalProperties.putAll(copy.getAdditionalProperties());
}
if (copy.getImportMappings() != null) {
builder.importMappings.putAll(copy.getImportMappings());
}
if (copy.getLanguageSpecificPrimitives() != null) {
builder.languageSpecificPrimitives.addAll(copy.getLanguageSpecificPrimitives());
}
if (copy.getReservedWordMappings() != null) {
builder.reservedWordMappings.putAll(copy.getReservedWordMappings());
}
if (copy.getServerVariables() != null) {
builder.serverVariables.putAll(copy.getServerVariables());
}
builder.gitUserId = copy.getGitUserId(); builder.gitUserId = copy.getGitUserId();
builder.gitRepoId = copy.getGitRepoId(); builder.gitRepoId = copy.getGitRepoId();
builder.releaseNote = copy.getReleaseNote(); builder.releaseNote = copy.getReleaseNote();

View File

@@ -33,38 +33,48 @@ import java.util.Objects;
public class WorkflowSettings { public class WorkflowSettings {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class); private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class);
public static final String DEFAULT_OUTPUT_DIR = ".";
public static final boolean DEFAULT_VERBOSE = false;
public static final boolean DEFAULT_SKIP_OVERWRITE = false;
public static final boolean DEFAULT_REMOVE_OPERATION_ID_PREFIX = false;
public static final boolean DEFAULT_LOG_TO_STDERR = false;
public static final boolean DEFAULT_VALIDATE_SPEC = true;
public static final boolean DEFAULT_ENABLE_POST_PROCESS_FILE = false;
public static final boolean DEFAULT_ENABLE_MINIMAL_UPDATE = false;
public static final boolean DEFAULT_STRICT_SPEC_BEHAVIOR = true;
public static final String DEFAULT_TEMPLATING_ENGINE_NAME = "mustache";
public static final ImmutableMap<String, String> DEFAULT_SYSTEM_PROPERTIES = ImmutableMap.of();
private String inputSpec; private String inputSpec;
private String outputDir; private String outputDir = DEFAULT_OUTPUT_DIR;
private boolean verbose; private boolean verbose = DEFAULT_VERBOSE;
private boolean skipOverwrite; private boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
private boolean removeOperationIdPrefix; private boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
private boolean logToStderr; private boolean logToStderr = DEFAULT_LOG_TO_STDERR;
private boolean validateSpec; private boolean validateSpec = DEFAULT_VALIDATE_SPEC;
private boolean enablePostProcessFile; private boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
private boolean enableMinimalUpdate; private boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
private boolean strictSpecBehavior; private boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
private String templateDir; private String templateDir;
private String templatingEngineName; private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride; private String ignoreFileOverride;
private ImmutableMap<String, String> systemProperties; private ImmutableMap<String, String> systemProperties = DEFAULT_SYSTEM_PROPERTIES;
private WorkflowSettings(Builder builder) { private WorkflowSettings(Builder builder) {
setDefaults(); this.inputSpec = builder.inputSpec;
inputSpec = builder.inputSpec; this.outputDir = builder.outputDir;
outputDir = builder.outputDir; this.verbose = builder.verbose;
verbose = builder.verbose; this.skipOverwrite = builder.skipOverwrite;
skipOverwrite = builder.skipOverwrite; this.removeOperationIdPrefix = builder.removeOperationIdPrefix;
removeOperationIdPrefix = builder.removeOperationIdPrefix; this.logToStderr = builder.logToStderr;
logToStderr = builder.logToStderr; this.validateSpec = builder.validateSpec;
validateSpec = builder.validateSpec; this.enablePostProcessFile = builder.enablePostProcessFile;
enablePostProcessFile = builder.enablePostProcessFile; this.enableMinimalUpdate = builder.enableMinimalUpdate;
enableMinimalUpdate = builder.enableMinimalUpdate; this.strictSpecBehavior = builder.strictSpecBehavior;
strictSpecBehavior = builder.strictSpecBehavior; this.templateDir = builder.templateDir;
templateDir = builder.templateDir; this.templatingEngineName = builder.templatingEngineName;
templatingEngineName = builder.templatingEngineName; this.ignoreFileOverride = builder.ignoreFileOverride;
ignoreFileOverride = builder.ignoreFileOverride; this.systemProperties = ImmutableMap.copyOf(builder.systemProperties);
systemProperties = ImmutableMap.copyOf(builder.systemProperties);
} }
/** /**
@@ -72,14 +82,7 @@ public class WorkflowSettings {
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public WorkflowSettings() { public WorkflowSettings() {
setDefaults();
systemProperties = ImmutableMap.of();
}
private void setDefaults(){
validateSpec = true;
strictSpecBehavior = true;
outputDir = ".";
} }
public static Builder newBuilder() { public static Builder newBuilder() {
@@ -87,7 +90,7 @@ public class WorkflowSettings {
} }
public static Builder newBuilder(WorkflowSettings copy) { public static Builder newBuilder(WorkflowSettings copy) {
Builder builder = new Builder(); Builder builder = newBuilder();
builder.inputSpec = copy.getInputSpec(); builder.inputSpec = copy.getInputSpec();
builder.outputDir = copy.getOutputDir(); builder.outputDir = copy.getOutputDir();
builder.verbose = copy.isVerbose(); builder.verbose = copy.isVerbose();
@@ -257,24 +260,24 @@ public class WorkflowSettings {
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static final class Builder { public static final class Builder {
private String inputSpec; private String inputSpec;
private String outputDir; private String outputDir = DEFAULT_OUTPUT_DIR;
private boolean verbose; private Boolean verbose = DEFAULT_VERBOSE;
private boolean skipOverwrite; private Boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
private boolean removeOperationIdPrefix; private Boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
private boolean logToStderr; private Boolean logToStderr = DEFAULT_LOG_TO_STDERR;
private boolean validateSpec; private Boolean validateSpec = DEFAULT_VALIDATE_SPEC;
private boolean enablePostProcessFile; private Boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
private boolean enableMinimalUpdate; private Boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
private boolean strictSpecBehavior; private Boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
private String templateDir; private String templateDir;
private String templatingEngineName; private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride; private String ignoreFileOverride;
private Map<String, String> systemProperties; private Map<String, String> systemProperties = new HashMap<>();;
private Builder() { private Builder() {
systemProperties = new HashMap<>();
} }
/** /**
* Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together. * Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together.
* *
@@ -282,7 +285,9 @@ public class WorkflowSettings {
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withInputSpec(String inputSpec) { public Builder withInputSpec(String inputSpec) {
this.inputSpec = inputSpec; if (inputSpec != null) {
this.inputSpec = inputSpec;
}
return this; return this;
} }
@@ -293,7 +298,11 @@ public class WorkflowSettings {
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withOutputDir(String outputDir) { public Builder withOutputDir(String outputDir) {
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();; if (outputDir != null ) {
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();
} else {
this.outputDir = DEFAULT_OUTPUT_DIR;
}
return this; return this;
} }
@@ -303,8 +312,8 @@ public class WorkflowSettings {
* @param verbose the {@code verbose} to set * @param verbose the {@code verbose} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withVerbose(boolean verbose) { public Builder withVerbose(Boolean verbose) {
this.verbose = verbose; this.verbose = verbose != null ? verbose : Boolean.valueOf(DEFAULT_VERBOSE);
return this; return this;
} }
@@ -314,8 +323,8 @@ public class WorkflowSettings {
* @param skipOverwrite the {@code skipOverwrite} to set * @param skipOverwrite the {@code skipOverwrite} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withSkipOverwrite(boolean skipOverwrite) { public Builder withSkipOverwrite(Boolean skipOverwrite) {
this.skipOverwrite = skipOverwrite; this.skipOverwrite = skipOverwrite != null ? skipOverwrite : Boolean.valueOf(DEFAULT_SKIP_OVERWRITE);
return this; return this;
} }
@@ -325,8 +334,8 @@ public class WorkflowSettings {
* @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set * @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { public Builder withRemoveOperationIdPrefix(Boolean removeOperationIdPrefix) {
this.removeOperationIdPrefix = removeOperationIdPrefix; this.removeOperationIdPrefix = removeOperationIdPrefix != null ? removeOperationIdPrefix : Boolean.valueOf(DEFAULT_REMOVE_OPERATION_ID_PREFIX);
return this; return this;
} }
@@ -336,8 +345,8 @@ public class WorkflowSettings {
* @param logToStderr the {@code logToStderr} to set * @param logToStderr the {@code logToStderr} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withLogToStderr(boolean logToStderr) { public Builder withLogToStderr(Boolean logToStderr) {
this.logToStderr = logToStderr; this.logToStderr = logToStderr != null ? logToStderr : Boolean.valueOf(DEFAULT_LOG_TO_STDERR);
return this; return this;
} }
@@ -347,8 +356,8 @@ public class WorkflowSettings {
* @param validateSpec the {@code validateSpec} to set * @param validateSpec the {@code validateSpec} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withValidateSpec(boolean validateSpec) { public Builder withValidateSpec(Boolean validateSpec) {
this.validateSpec = validateSpec; this.validateSpec = validateSpec != null ? validateSpec : Boolean.valueOf(DEFAULT_VALIDATE_SPEC);
return this; return this;
} }
@@ -358,8 +367,8 @@ public class WorkflowSettings {
* @param enablePostProcessFile the {@code enablePostProcessFile} to set * @param enablePostProcessFile the {@code enablePostProcessFile} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withEnablePostProcessFile(boolean enablePostProcessFile) { public Builder withEnablePostProcessFile(Boolean enablePostProcessFile) {
this.enablePostProcessFile = enablePostProcessFile; this.enablePostProcessFile = enablePostProcessFile != null ? enablePostProcessFile : Boolean.valueOf(DEFAULT_ENABLE_POST_PROCESS_FILE);
return this; return this;
} }
@@ -369,8 +378,8 @@ public class WorkflowSettings {
* @param enableMinimalUpdate the {@code enableMinimalUpdate} to set * @param enableMinimalUpdate the {@code enableMinimalUpdate} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withEnableMinimalUpdate(boolean enableMinimalUpdate) { public Builder withEnableMinimalUpdate(Boolean enableMinimalUpdate) {
this.enableMinimalUpdate = enableMinimalUpdate; this.enableMinimalUpdate = enableMinimalUpdate != null ? enableMinimalUpdate : Boolean.valueOf(DEFAULT_ENABLE_MINIMAL_UPDATE);
return this; return this;
} }
@@ -380,8 +389,8 @@ public class WorkflowSettings {
* @param strictSpecBehavior the {@code strictSpecBehavior} to set * @param strictSpecBehavior the {@code strictSpecBehavior} to set
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withStrictSpecBehavior(boolean strictSpecBehavior) { public Builder withStrictSpecBehavior(Boolean strictSpecBehavior) {
this.strictSpecBehavior = strictSpecBehavior; this.strictSpecBehavior = strictSpecBehavior != null ? strictSpecBehavior : Boolean.valueOf(DEFAULT_STRICT_SPEC_BEHAVIOR);
return this; return this;
} }
@@ -392,9 +401,7 @@ public class WorkflowSettings {
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withTemplateDir(String templateDir) { public Builder withTemplateDir(String templateDir) {
if (templateDir == null) { if (templateDir != null) {
this.templateDir = null;
} else {
File f = new File(templateDir); File f = new File(templateDir);
// check to see if the folder exists // check to see if the folder exists
@@ -416,7 +423,7 @@ public class WorkflowSettings {
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withTemplatingEngineName(String templatingEngineName) { public Builder withTemplatingEngineName(String templatingEngineName) {
this.templatingEngineName = templatingEngineName; this.templatingEngineName = templatingEngineName != null ? templatingEngineName : DEFAULT_TEMPLATING_ENGINE_NAME;
return this; return this;
} }
@@ -438,7 +445,9 @@ public class WorkflowSettings {
* @return a reference to this Builder * @return a reference to this Builder
*/ */
public Builder withSystemProperties(Map<String, String> systemProperties) { public Builder withSystemProperties(Map<String, String> systemProperties) {
this.systemProperties = systemProperties; if (systemProperties != null) {
this.systemProperties = systemProperties;
}
return this; return this;
} }

View File

@@ -0,0 +1,103 @@
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.config;
import org.testng.annotations.Test;
import java.nio.file.Paths;
import static org.testng.Assert.*;
public class WorkflowSettingsTest {
@Test
public void defaultValuesNotOverriddenByNulls(){
WorkflowSettings settings = WorkflowSettings.newBuilder()
.withOutputDir(null)
.withVerbose(null)
.withSkipOverwrite(null)
.withRemoveOperationIdPrefix(null)
.withLogToStderr(null)
.withValidateSpec(null)
.withEnablePostProcessFile(null)
.withEnableMinimalUpdate(null)
.withStrictSpecBehavior(null)
.build();
assertEquals(settings.getOutputDir(), ".");
assertFalse(settings.isVerbose());
assertFalse(settings.isSkipOverwrite());
assertFalse(settings.isRemoveOperationIdPrefix());
assertFalse(settings.isLogToStderr());
assertTrue(settings.isValidateSpec());
assertFalse(settings.isEnablePostProcessFile());
assertFalse(settings.isEnableMinimalUpdate());
assertTrue(settings.isStrictSpecBehavior());
}
private void assertOnChangesToDefaults(WorkflowSettings defaults) {
WorkflowSettings settings = WorkflowSettings.newBuilder()
.withOutputDir("output")
.withVerbose(true)
.withSkipOverwrite(true)
.withRemoveOperationIdPrefix(true)
.withLogToStderr(true)
.withValidateSpec(false)
.withEnablePostProcessFile(true)
.withEnableMinimalUpdate(true)
.withStrictSpecBehavior(false)
.build();
assertNotEquals(defaults.getOutputDir(), settings.getOutputDir());
assertEquals(settings.getOutputDir(), Paths.get("output").toAbsolutePath().toString());
assertNotEquals(defaults.isVerbose(), settings.isVerbose());
assertTrue(settings.isVerbose());
assertNotEquals(defaults.isSkipOverwrite(), settings.isSkipOverwrite());
assertTrue(settings.isSkipOverwrite());
assertNotEquals(defaults.isRemoveOperationIdPrefix(), settings.isRemoveOperationIdPrefix());
assertTrue(settings.isRemoveOperationIdPrefix());
assertNotEquals(defaults.isLogToStderr(), settings.isLogToStderr());
assertTrue(settings.isLogToStderr());
assertNotEquals(defaults.isValidateSpec(), settings.isValidateSpec());
assertFalse(settings.isValidateSpec());
assertNotEquals(defaults.isEnablePostProcessFile(), settings.isEnablePostProcessFile());
assertTrue(settings.isEnablePostProcessFile());
assertNotEquals(defaults.isEnableMinimalUpdate(), settings.isEnableMinimalUpdate());
assertTrue(settings.isEnableMinimalUpdate());
assertNotEquals(defaults.isStrictSpecBehavior(), settings.isStrictSpecBehavior());
assertFalse(settings.isStrictSpecBehavior());
}
@Test
public void defaultValuesCanBeChangedClassConstructor(){
WorkflowSettings defaults = new WorkflowSettings();
assertOnChangesToDefaults(defaults);
}
@Test
public void defaultValuesCanBeChangedBuilder(){
WorkflowSettings defaults = WorkflowSettings.newBuilder().build();
assertOnChangesToDefaults(defaults);
}
}

View File

@@ -91,6 +91,7 @@ public class CodegenConfigurator {
DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class); DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class);
CodegenConfigurator configurator = new CodegenConfigurator(); CodegenConfigurator configurator = new CodegenConfigurator();
configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings()); configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings());
configurator.workflowSettingsBuilder = WorkflowSettings.newBuilder(settings.getWorkflowSettings());
return configurator; return configurator;
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.error("Unable to deserialize config file: " + configFile, ex); LOGGER.error("Unable to deserialize config file: " + configFile, ex);

View File

@@ -1 +1 @@
4.1.0-SNAPSHOT 4.1.1-SNAPSHOT

View File

@@ -89,6 +89,7 @@ Class | Method | HTTP request | Description
*Petstore::FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) *Petstore::FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*Petstore::FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties *Petstore::FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*Petstore::FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data *Petstore::FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
*Petstore::FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
*Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *Petstore::FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
*Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet

View File

@@ -17,6 +17,7 @@ Method | HTTP request | Description
[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) [**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties [**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
@@ -684,3 +685,56 @@ No authorization required
- **Content-Type**: application/x-www-form-urlencoded - **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined - **Accept**: Not defined
## test_query_parameter_collection_format
> test_query_parameter_collection_format(pipe, ioutil, http, url, context)
To test the collection format in query parameters
### Example
```ruby
# load the gem
require 'petstore'
api_instance = Petstore::FakeApi.new
pipe = ['pipe_example'] # Array<String> |
ioutil = ['ioutil_example'] # Array<String> |
http = ['http_example'] # Array<String> |
url = ['url_example'] # Array<String> |
context = ['context_example'] # Array<String> |
begin
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_query_parameter_collection_format: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pipe** | [**Array&lt;String&gt;**](String.md)| |
**ioutil** | [**Array&lt;String&gt;**](String.md)| |
**http** | [**Array&lt;String&gt;**](String.md)| |
**url** | [**Array&lt;String&gt;**](String.md)| |
**context** | [**Array&lt;String&gt;**](String.md)| |
### Return type
nil (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end
@@ -985,5 +985,92 @@ module Petstore
end end
return data, status_code, headers return data, status_code, headers
end end
# To test the collection format in query parameters
# @param pipe [Array<String>]
# @param ioutil [Array<String>]
# @param http [Array<String>]
# @param url [Array<String>]
# @param context [Array<String>]
# @param [Hash] opts the optional parameters
# @return [nil]
def test_query_parameter_collection_format(pipe, ioutil, http, url, context, opts = {})
test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, opts)
nil
end
# To test the collection format in query parameters
# @param pipe [Array<String>]
# @param ioutil [Array<String>]
# @param http [Array<String>]
# @param url [Array<String>]
# @param context [Array<String>]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_query_parameter_collection_format ...'
end
# verify the required parameter 'pipe' is set
if @api_client.config.client_side_validation && pipe.nil?
fail ArgumentError, "Missing the required parameter 'pipe' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'ioutil' is set
if @api_client.config.client_side_validation && ioutil.nil?
fail ArgumentError, "Missing the required parameter 'ioutil' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'http' is set
if @api_client.config.client_side_validation && http.nil?
fail ArgumentError, "Missing the required parameter 'http' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'url' is set
if @api_client.config.client_side_validation && url.nil?
fail ArgumentError, "Missing the required parameter 'url' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'context' is set
if @api_client.config.client_side_validation && context.nil?
fail ArgumentError, "Missing the required parameter 'context' when calling FakeApi.test_query_parameter_collection_format"
end
# resource path
local_var_path = '/fake/test-query-paramters'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pipe'] = @api_client.build_collection_param(pipe, :csv)
query_params[:'ioutil'] = @api_client.build_collection_param(ioutil, :csv)
query_params[:'http'] = @api_client.build_collection_param(http, :space)
query_params[:'url'] = @api_client.build_collection_param(url, :csv)
query_params[:'context'] = @api_client.build_collection_param(context, :multi)
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || []
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end end
end end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,15 +6,15 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end
require 'date' require 'date'
require 'faraday'
require 'json' require 'json'
require 'logger' require 'logger'
require 'tempfile' require 'tempfile'
require 'faraday'
module Petstore module Petstore
class ApiClient class ApiClient
@@ -46,37 +46,46 @@ module Petstore
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
# the data deserialized from response body (could be nil), response status code and response headers. # the data deserialized from response body (could be nil), response status code and response headers.
def call_api(http_method, path, opts = {}) def call_api(http_method, path, opts = {})
connection = Faraday.new(:url => config.base_url) do |conn| ssl_options = {
:ca_file => @config.ssl_ca_file,
:verify => @config.ssl_verify,
:verify_mode => @config.ssl_verify_mode,
:client_cert => @config.ssl_client_cert,
:client_key => @config.ssl_client_key
}
connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
conn.basic_auth(config.username, config.password) conn.basic_auth(config.username, config.password)
if opts[:header_params]["Content-Type"] == "multipart/form-data" if opts[:header_params]["Content-Type"] == "multipart/form-data"
conn.request :multipart conn.request :multipart
conn.request :url_encoded conn.request :url_encoded
end end
conn.adapter(Faraday.default_adapter) conn.adapter(Faraday.default_adapter)
end end
begin begin
response = connection.public_send(http_method.to_sym.downcase) do |req| response = connection.public_send(http_method.to_sym.downcase) do |req|
build_request(http_method, path, req, opts) build_request(http_method, path, req, opts)
end end
if @config.debugging if @config.debugging
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
end end
unless response.success? unless response.success?
if response.status == 0 if response.status == 0
# Errors from libcurl will be made visible here # Errors from libcurl will be made visible here
fail ApiError.new(:code => 0, fail ApiError.new(:code => 0,
:message => response.return_message) :message => response.return_message)
else else
fail ApiError.new(:code => response.status, fail ApiError.new(:code => response.status,
:response_headers => response.headers, :response_headers => response.headers,
:response_body => response.body), :response_body => response.body),
response.reason_phrase response.reason_phrase
end
end end
end
rescue Faraday::TimeoutError rescue Faraday::TimeoutError
fail ApiError.new('Connection timed out') fail ApiError.new('Connection timed out')
end end
if opts[:return_type] if opts[:return_type]
@@ -106,25 +115,15 @@ module Petstore
update_params_for_auth! header_params, query_params, opts[:auth_names] update_params_for_auth! header_params, query_params, opts[:auth_names]
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
req_opts = { req_opts = {
:method => http_method, :method => http_method,
:headers => header_params, :headers => header_params,
:params => query_params, :params => query_params,
:params_encoding => @config.params_encoding, :params_encoding => @config.params_encoding,
:timeout => @config.timeout, :timeout => @config.timeout,
:ssl_verifypeer => @config.verify_ssl,
:ssl_verifyhost => _verify_ssl_host,
:sslcert => @config.cert_file,
:sslkey => @config.key_file,
:verbose => @config.debugging :verbose => @config.debugging
} }
# set custom cert, if provided
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
if [:post, :patch, :put, :delete].include?(http_method) if [:post, :patch, :put, :delete].include?(http_method)
req_body = build_request_body(header_params, form_params, opts[:body]) req_body = build_request_body(header_params, form_params, opts[:body])
req_opts.update :body => req_body req_opts.update :body => req_body
@@ -134,12 +133,44 @@ module Petstore
end end
request.headers = header_params request.headers = header_params
request.body = req_body request.body = req_body
request.url path request.url url
request.params = query_params request.params = query_params
download_file(request) if opts[:return_type] == 'File' download_file(request) if opts[:return_type] == 'File'
request request
end end
# Builds the HTTP request body
#
# @param [Hash] header_params Header parameters
# @param [Hash] form_params Query parameters
# @param [Object] body HTTP body (JSON/XML)
# @return [String] HTTP body data in the form of string
def build_request_body(header_params, form_params, body)
# http form
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
data = URI.encode_www_form(form_params)
elsif header_params['Content-Type'] == 'multipart/form-data'
data = {}
form_params.each do |key, value|
case value
when ::File, ::Tempfile
# TODO hardcode to application/octet-stream, need better way to detect content type
data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
when ::Array, nil
# let Faraday handle Array and nil parameters
data[key] = value
else
data[key] = value.to_s
end
end
elsif body
data = body.is_a?(String) ? body : body.to_json
else
data = nil
end
data
end
# Check if the given MIME is a JSON MIME. # Check if the given MIME is a JSON MIME.
# JSON MIME examples: # JSON MIME examples:
# application/json # application/json
@@ -277,36 +308,6 @@ module Petstore
@config.base_url + path @config.base_url + path
end end
# Builds the HTTP request body
#
# @param [Hash] header_params Header parameters
# @param [Hash] form_params Query parameters
# @param [Object] body HTTP body (JSON/XML)
# @return [String] HTTP body data in the form of string
def build_request_body(header_params, form_params, body)
# http form
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
header_params['Content-Type'] == 'multipart/form-data'
data = {}
form_params.each do |key, value|
case value
when ::File, ::Tempfile
data[key] = Faraday::UploadIO.new(value.path, '')
when ::Array, nil
# let Faraday handle Array and nil parameters
data[key] = value
else
data[key] = value.to_s
end
end
elsif body
data = body.is_a?(String) ? body : body.to_json
else
data = nil
end
data
end
# Update hearder and query params based on authentication settings. # Update hearder and query params based on authentication settings.
# #
# @param [Hash] header_params Header parameters # @param [Hash] header_params Header parameters

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end
@@ -86,33 +86,28 @@ module Petstore
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
# #
# @return [true, false] # @return [true, false]
attr_accessor :verify_ssl attr_accessor :ssl_verify
### TLS/SSL setting ### TLS/SSL setting
# Set this to false to skip verifying SSL host name # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
# Default to true.
# #
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
# #
# @return [true, false] attr_accessor :ssl_verify_mode
attr_accessor :verify_ssl_host
### TLS/SSL setting ### TLS/SSL setting
# Set this to customize the certificate file to verify the peer. # Set this to customize the certificate file to verify the peer.
# #
# @return [String] the path to the certificate file # @return [String] the path to the certificate file
# attr_accessor :ssl_ca_file
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
attr_accessor :ssl_ca_cert
### TLS/SSL setting ### TLS/SSL setting
# Client certificate file (for client certificate) # Client certificate file (for client certificate)
attr_accessor :cert_file attr_accessor :ssl_client_cert
### TLS/SSL setting ### TLS/SSL setting
# Client private key file (for client certificate) # Client private key file (for client certificate)
attr_accessor :key_file attr_accessor :ssl_client_key
# Set this to customize parameters encoding of array parameter with multi collectionFormat. # Set this to customize parameters encoding of array parameter with multi collectionFormat.
# Default to nil. # Default to nil.
@@ -133,11 +128,11 @@ module Petstore
@api_key_prefix = {} @api_key_prefix = {}
@timeout = 0 @timeout = 0
@client_side_validation = true @client_side_validation = true
@verify_ssl = true @ssl_verify = true
@verify_ssl_host = true @ssl_verify_mode = nil
@params_encoding = nil @ssl_ca_file = nil
@cert_file = nil @ssl_client_cert = nil
@key_file = nil @ssl_client_key = nil
@debugging = false @debugging = false
@inject_format = false @inject_format = false
@force_ending_format = false @force_ending_format = false

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end

View File

@@ -8,7 +8,7 @@
The version of the OpenAPI document: 1.0.0 The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.1.0-SNAPSHOT OpenAPI Generator version: 4.1.1-SNAPSHOT
=end =end
@@ -31,8 +31,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
s.test_files = `find spec/*`.split("\n") s.test_files = `find spec/*`.split("\n")

View File

@@ -1 +1 @@
4.1.0-SNAPSHOT 4.1.1-SNAPSHOT

View File

@@ -0,0 +1,12 @@
# InlineObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Updated name of the pet | [optional]
**status** | **String** | Updated status of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,12 @@
# InlineObject1
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**additional_metadata** | **String** | Additional data to pass to server | [optional]
**file** | [***std::path::PathBuf**](std::path::PathBuf.md) | file to upload | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,32 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct InlineObject {
/// Updated name of the pet
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Updated status of the pet
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
impl InlineObject {
pub fn new() -> InlineObject {
InlineObject {
name: None,
status: None,
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct InlineObject1 {
/// Additional data to pass to server
#[serde(rename = "additionalMetadata", skip_serializing_if = "Option::is_none")]
pub additional_metadata: Option<String>,
/// file to upload
#[serde(rename = "file", skip_serializing_if = "Option::is_none")]
pub file: Option<std::path::PathBuf>,
}
impl InlineObject1 {
pub fn new() -> InlineObject1 {
InlineObject1 {
additional_metadata: None,
file: None,
}
}
}

View File

@@ -31,7 +31,7 @@ setup(
url="", url="",
keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"], keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"],
install_requires=REQUIRES, install_requires=REQUIRES,
packages=find_packages(), packages=find_packages(exclude=["test", "tests"]),
include_package_data=True, include_package_data=True,
long_description="""\ long_description="""\
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ # noqa: E501 This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ # noqa: E501

View File

@@ -103,7 +103,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet"
end end
# resource path # resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -290,7 +290,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id" fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id"
end end
# resource path # resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -414,7 +414,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form" fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form"
end end
# resource path # resource path
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -480,7 +480,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file"
end end
# resource path # resource path
local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -552,7 +552,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file" fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file"
end end
# resource path # resource path
local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}

View File

@@ -43,7 +43,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order" fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order"
end end
# resource path # resource path
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -167,7 +167,7 @@ module Petstore
end end
# resource path # resource path
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}

View File

@@ -225,7 +225,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user"
end end
# resource path # resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -283,7 +283,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name"
end end
# resource path # resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}
@@ -471,7 +471,7 @@ module Petstore
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user" fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user"
end end
# resource path # resource path
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
# query parameters # query parameters
query_params = opts[:query_params] || {} query_params = opts[:query_params] || {}