forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
bfa18a0ce8
@ -46,7 +46,6 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected boolean swiftUseApiNamespace;
|
||||
protected String[] responseAs = new String[0];
|
||||
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
|
||||
private static final Pattern PATH_PARAM_PATTERN = Pattern.compile("\\{[a-zA-Z_]+\\}");
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
@ -454,40 +453,6 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
|
||||
path = normalizePath(path); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
// issue 3914 - removed logic designed to remove any parameter of type HeaderParameter
|
||||
return super.fromOperation(path, httpMethod, operation, definitions, swagger);
|
||||
}
|
||||
|
||||
private static String normalizePath(String path) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
int cursor = 0;
|
||||
Matcher matcher = PATH_PARAM_PATTERN.matcher(path);
|
||||
boolean found = matcher.find();
|
||||
while (found) {
|
||||
String stringBeforeMatch = path.substring(cursor, matcher.start());
|
||||
builder.append(stringBeforeMatch);
|
||||
|
||||
String group = matcher.group().substring(1, matcher.group().length() - 1);
|
||||
group = camelize(group, true);
|
||||
builder
|
||||
.append("{")
|
||||
.append(group)
|
||||
.append("}");
|
||||
|
||||
cursor = matcher.end();
|
||||
found = matcher.find();
|
||||
}
|
||||
|
||||
String stringAfterMatch = path.substring(cursor);
|
||||
builder.append(stringAfterMatch);
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
"{{baseName}}": {{paramName}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}.rawValue{{/isContainer}}{{/isEnum}}{{#isDate}}{{^required}}?{{/required}}.encodeToJSON(){{/isDate}}{{#isDateTime}}{{^required}}?{{/required}}.encodeToJSON(){{/isDateTime}}
|
||||
"{{baseName}}": {{paramName}}{{^isEnum}}{{#isInteger}}{{^required}}?{{/required}}.encodeToJSON(){{/isInteger}}{{#isLong}}{{^required}}?{{/required}}.encodeToJSON(){{/isLong}}{{/isEnum}}{{#isEnum}}{{^isContainer}}{{^required}}?{{/required}}.rawValue{{/isContainer}}{{/isEnum}}{{#isDate}}{{^required}}?{{/required}}.encodeToJSON(){{/isDate}}{{#isDateTime}}{{^required}}?{{/required}}.encodeToJSON(){{/isDateTime}}
|
@ -279,7 +279,7 @@ export enum {{classname}}ApiKeys {
|
||||
}
|
||||
|
||||
export class {{classname}} {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -326,6 +326,14 @@ export class {{classname}} {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: {{classname}}ApiKeys, value: string) {
|
||||
this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ paths:
|
||||
$ref: '#/definitions/Order'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
'/store/order/{orderId}':
|
||||
'/store/order/{order_id}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
@ -335,7 +335,7 @@ paths:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
- name: order_id
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
@ -362,7 +362,7 @@ paths:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
- name: order_id
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
|
@ -27,6 +27,7 @@ import java.io.InputStream;
|
||||
|
||||
{{^supportJava6}}
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -581,7 +582,7 @@ public class ApiClient {
|
||||
try {
|
||||
File file = prepareDownloadFile(response);
|
||||
{{^supportJava6}}
|
||||
Files.copy(response.readEntity(InputStream.class), file.toPath());
|
||||
Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
// Java6 falls back to commons.io for file copying
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -49,8 +49,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -126,8 +126,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -4,9 +4,9 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
|
@ -49,8 +49,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
@ -126,8 +126,8 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/store/order/{orderId}"
|
||||
.replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
String localVarPath = "/store/order/{order_id}"
|
||||
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
|
@ -249,7 +249,7 @@ open class FakeAPI: APIBase {
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems(values:[
|
||||
"enum_query_string_array": enumQueryStringArray,
|
||||
"enum_query_string": enumQueryString?.rawValue,
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue
|
||||
"enum_query_integer": enumQueryInteger?.rawValue
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
|
@ -34,7 +34,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
@ -138,7 +138,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -321,7 +321,7 @@ open class FakeAPI: APIBase {
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems(values:[
|
||||
"enum_query_string_array": enumQueryStringArray,
|
||||
"enum_query_string": enumQueryString?.rawValue,
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue
|
||||
"enum_query_integer": enumQueryInteger?.rawValue
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
|
@ -52,7 +52,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
@ -189,7 +189,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
|
@ -327,7 +327,7 @@ open class FakeAPI: APIBase {
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems(values:[
|
||||
"enum_query_string_array": enumQueryStringArray,
|
||||
"enum_query_string": enumQueryString?.rawValue,
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue
|
||||
"enum_query_integer": enumQueryInteger?.rawValue
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
|
@ -54,7 +54,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
@ -195,7 +195,7 @@ open class StoreAPI: APIBase {
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{orderId}"
|
||||
path = path.replacingOccurrences(of: "{orderId}", with: "\(orderId)", options: .literal, range: nil)
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
|
@ -427,7 +427,7 @@ export enum PetApiApiKeys {
|
||||
}
|
||||
|
||||
export class PetApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -454,6 +454,14 @@ export class PetApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: PetApiApiKeys, value: string) {
|
||||
this.authentications[PetApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -706,10 +714,10 @@ export class PetApi {
|
||||
json: true,
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
if (Object.keys(formParams).length) {
|
||||
@ -921,7 +929,7 @@ export enum StoreApiApiKeys {
|
||||
}
|
||||
|
||||
export class StoreApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -948,6 +956,14 @@ export class StoreApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: StoreApiApiKeys, value: string) {
|
||||
this.authentications[StoreApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -1166,7 +1182,7 @@ export enum UserApiApiKeys {
|
||||
}
|
||||
|
||||
export class UserApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -1193,6 +1209,14 @@ export class UserApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: UserApiApiKeys, value: string) {
|
||||
this.authentications[UserApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ export enum PetApiApiKeys {
|
||||
}
|
||||
|
||||
export class PetApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -454,6 +454,14 @@ export class PetApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: PetApiApiKeys, value: string) {
|
||||
this.authentications[PetApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -706,10 +714,10 @@ export class PetApi {
|
||||
json: true,
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
if (Object.keys(formParams).length) {
|
||||
@ -921,7 +929,7 @@ export enum StoreApiApiKeys {
|
||||
}
|
||||
|
||||
export class StoreApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -948,6 +956,14 @@ export class StoreApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: StoreApiApiKeys, value: string) {
|
||||
this.authentications[StoreApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -1166,7 +1182,7 @@ export enum UserApiApiKeys {
|
||||
}
|
||||
|
||||
export class UserApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected _basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
@ -1193,6 +1209,14 @@ export class UserApi {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
set basePath(basePath: string) {
|
||||
this._basePath = basePath;
|
||||
}
|
||||
|
||||
get basePath() {
|
||||
return this._basePath;
|
||||
}
|
||||
|
||||
public setApiKey(key: UserApiApiKeys, value: string) {
|
||||
this.authentications[UserApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user