Merge remote-tracking branch 'origin/master' into 3.2.x

This commit is contained in:
William Cheng 2018-07-19 18:46:18 +08:00
commit 888da52181
102 changed files with 2398 additions and 1312 deletions

View File

@ -30,6 +30,6 @@ rm -rf samples/client/petstore/go/go-petstore-withXml
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore-withXml -DpackageName=petstore,withXml=true $@"
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore-withXml -DpackageName=petstore,withXml=true,withGoCodegenComment=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -29,6 +29,7 @@ sleep 5
./bin/typescript-fetch-petstore-all.sh > /dev/null 2>&1
./bin/typescript-node-petstore-all.sh > /dev/null 2>&1
./bin/typescript-inversify-petstore.sh > /dev/null 2>&1
./bin/rust-server-petstore.sh > /dev/null 2>&1
# Check:

View File

@ -56,6 +56,9 @@ public class CodegenConstants {
public static final String PYTHON_PACKAGE_NAME = "pythonPackageName";
public static final String PYTHON_PACKAGE_NAME_DESC = "package name for generated python code";
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs";
public static final String GROUP_ID = "groupId";
public static final String GROUP_ID_DESC = "groupId in generated pom.xml";

View File

@ -54,7 +54,7 @@ public class CodegenProperty implements Cloneable {
public boolean exclusiveMinimum;
public boolean exclusiveMaximum;
public boolean hasMore, required, secondaryParam;
public boolean hasMoreNonReadOnly; // for model constructor, true if next properyt is not readonly
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
public boolean isPrimitiveType, isContainer, isNotContainer;
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid;
public boolean isListContainer, isMapContainer;

View File

@ -37,6 +37,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGoCodegen.class);
protected boolean withGoCodegenComment = false;
protected boolean withXml = false;
protected String packageName = "openapi";
@ -584,6 +585,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
}
public void setWithGoCodegenComment(boolean withGoCodegenComment) {
this.withGoCodegenComment = withGoCodegenComment;
}
public void setWithXml(boolean withXml) {
this.withXml = withXml;
}

View File

@ -30,6 +30,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
protected String packageVersion = "1.0.0";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_XML = "withXml";
public GoClientCodegen() {
@ -49,8 +50,10 @@ public class GoClientCodegen extends AbstractGoCodegen {
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
.defaultValue("1.0.0"));
cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs"));
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
// option to change the order of form/body parameter
cliOptions.add(CliOption.newBoolean(
CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS,
@ -93,6 +96,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
supportingFiles.add(new SupportingFile("response.mustache", "", "response.go"));
supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) {
setWithGoCodegenComment(Boolean.parseBoolean(additionalProperties.get(WITH_GO_CODEGEN_COMMENT).toString()));
if (withGoCodegenComment) {
additionalProperties.put(WITH_GO_CODEGEN_COMMENT, "true");
}
}
if (additionalProperties.containsKey(WITH_XML)) {
setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
if (withXml) {

View File

@ -638,7 +638,7 @@ public class ApiClient {
for (Entry<String, String> defaultHeaderEnrty: defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(defaultHeaderEnrty.getKey())) {
String value = defaultHeaderEnrty.getKey();
String value = defaultHeaderEnrty.getValue();
if (value != null) {
invocationBuilder = invocationBuilder.header(defaultHeaderEnrty.getKey(), value);
}

View File

@ -117,8 +117,9 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.8"
jackson_version = "2.6.4"
swagger_annotations_version = "1.5.18"
jackson_version = "2.8.6"
threetenbp_version = "2.6.4"
jersey_version = "2.22.2"
resteasy_version = "3.1.3.Final"
{{^java8}}
@ -142,7 +143,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
{{#java8}}
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
{{/java8}}

View File

@ -9,17 +9,21 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.8",
"io.swagger" % "swagger-annotations" % "1.5.18",
"org.glassfish.jersey.core" % "jersey-client" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5",
"org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final",
"org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final",
"org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.6",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.6",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.6",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4",
{{#java8}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5",
{{/java8}}
{{^java8}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.6",
{{/java8}}
{{^java8}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5",
"joda-time" % "joda-time" % "2.9.4",
"com.brsanthu" % "migbase64" % "2.2",

View File

@ -247,7 +247,7 @@
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-version}</version>
<version>${threetenbp-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
@ -261,7 +261,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-core-version>1.5.18</swagger-core-version>
<resteasy-version>3.1.3.Final</resteasy-version>
<jackson-version>2.6.4</jackson-version>
<jackson-version>2.8.6</jackson-version>
<threetenbp-version>2.6.4</threetenbp-version>
{{^java8}}
<jodatime-version>2.9.9</jodatime-version>
{{/java8}}

View File

@ -13,5 +13,11 @@
{{#infoEmail}}
* Contact: {{{infoEmail}}}
{{/infoEmail}}
{{^withGoCodegenComment}}
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
{{/withGoCodegenComment}}
*/
{{#withGoCodegenComment}}
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
{{/withGoCodegenComment}}

View File

@ -19,6 +19,7 @@
namespace {{controllerPackage}};
use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use {{servicePackage}}\SerializerInterface;
@ -32,7 +33,7 @@ use {{servicePackage}}\ValidatorInterface;
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class Controller
class Controller extends BaseController
{
protected $validator;
protected $serializer;

View File

@ -65,26 +65,37 @@ fn into_base_path(input: &str, correct_scheme: Option<&'static str>) -> Result<S
}
/// A client that implements the API by making HTTP calls out to a server.
#[derive(Clone)]
pub struct Client {
hyper_client: Arc<Box<hyper::client::Service<Request=hyper::Request<hyper::Body>, Response=hyper::Response, Error=hyper::Error, Future=hyper::client::FutureResponse>>>,
pub struct Client<F> where
F: Future<Item=hyper::Response, Error=hyper::Error> + 'static {
client_service: Arc<Box<hyper::client::Service<Request=hyper::Request<hyper::Body>, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
base_path: String,
}
impl fmt::Debug for Client {
impl<F> fmt::Debug for Client<F> where
F: Future<Item=hyper::Response, Error=hyper::Error> + 'static {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Client {{ base_path: {} }}", self.base_path)
}
}
impl Client {
impl<F> Clone for Client<F> where
F: Future<Item=hyper::Response, Error=hyper::Error> + 'static {
fn clone(&self) -> Self {
Client {
client_service: self.client_service.clone(),
base_path: self.base_path.clone()
}
}
}
impl Client<hyper::client::FutureResponse> {
/// Create an HTTP client.
///
/// # Arguments
/// * `handle` - tokio reactor handle to use for execution
/// * `base_path` - base path of the client API, i.e. "www.my-api-implementation.com"
pub fn try_new_http(handle: Handle, base_path: &str) -> Result<Client, ClientInitError> {
pub fn try_new_http(handle: Handle, base_path: &str) -> Result<Client<hyper::client::FutureResponse>, ClientInitError> {
let http_connector = swagger::http_connector();
Self::try_new_with_connector::<hyper::client::HttpConnector>(
handle,
@ -104,7 +115,7 @@ impl Client {
handle: Handle,
base_path: &str,
ca_certificate: CA,
) -> Result<Client, ClientInitError>
) -> Result<Client<hyper::client::FutureResponse>, ClientInitError>
where
CA: AsRef<Path>,
{
@ -125,13 +136,13 @@ impl Client {
/// * `ca_certificate` - Path to CA certificate used to authenticate the server
/// * `client_key` - Path to the client private key
/// * `client_certificate` - Path to the client's public certificate associated with the private key
pub fn try_new_https_mutual<CA, K, C, T>(
pub fn try_new_https_mutual<CA, K, C>(
handle: Handle,
base_path: &str,
ca_certificate: CA,
client_key: K,
client_certificate: C,
) -> Result<Client, ClientInitError>
) -> Result<Client<hyper::client::FutureResponse>, ClientInitError>
where
CA: AsRef<Path>,
K: AsRef<Path>,
@ -168,17 +179,17 @@ impl Client {
base_path: &str,
protocol: Option<&'static str>,
connector_fn: Box<Fn(&Handle) -> C + Send + Sync>,
) -> Result<Client, ClientInitError>
) -> Result<Client<hyper::client::FutureResponse>, ClientInitError>
where
C: hyper::client::Connect + hyper::client::Service,
{
let connector = connector_fn(&handle);
let hyper_client = Box::new(hyper::Client::configure().connector(connector).build(
let client_service = Box::new(hyper::Client::configure().connector(connector).build(
&handle,
));
Ok(Client {
hyper_client: Arc::new(hyper_client),
client_service: Arc::new(client_service),
base_path: into_base_path(base_path, protocol)?,
})
}
@ -192,19 +203,41 @@ impl Client {
/// The reason for this function's existence is to support legacy test code, which did mocking at the hyper layer.
/// This is not a recommended way to write new tests. If other reasons are found for using this function, they
/// should be mentioned here.
pub fn try_new_with_hyper_client(hyper_client: Arc<Box<hyper::client::Service<Request=hyper::Request<hyper::Body>, Response=hyper::Response, Error=hyper::Error, Future=hyper::client::FutureResponse>>>,
handle: Handle,
base_path: &str)
-> Result<Client, ClientInitError>
#[deprecated(note="Use try_new_with_client_service instead")]
pub fn try_new_with_hyper_client(
hyper_client: Arc<Box<hyper::client::Service<Request=hyper::Request<hyper::Body>, Response=hyper::Response, Error=hyper::Error, Future=hyper::client::FutureResponse>>>,
handle: Handle,
base_path: &str
) -> Result<Client<hyper::client::FutureResponse>, ClientInitError>
{
Ok(Client {
hyper_client: hyper_client,
client_service: hyper_client,
base_path: into_base_path(base_path, None)?,
})
}
}
impl<C> Api<C> for Client where C: Has<XSpanIdString> {{#hasAuthMethods}}+ Has<Option<AuthData>>{{/hasAuthMethods}}{
impl<F> Client<F> where
F: Future<Item=hyper::Response, Error=hyper::Error> + 'static
{
/// Constructor for creating a `Client` by passing in a pre-made `hyper` client Service.
///
/// This allows adding custom wrappers around the underlying transport, for example for logging.
pub fn try_new_with_client_service(client_service: Arc<Box<hyper::client::Service<Request=hyper::Request<hyper::Body>, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
handle: Handle,
base_path: &str)
-> Result<Client<F>, ClientInitError>
{
Ok(Client {
client_service: client_service,
base_path: into_base_path(base_path, None)?,
})
}
}
impl<F, C> Api<C> for Client<F> where
F: Future<Item=hyper::Response, Error=hyper::Error> + 'static,
C: Has<XSpanIdString> {{#hasAuthMethods}}+ Has<Option<AuthData>>{{/hasAuthMethods}}{
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
fn {{#vendorExtensions}}{{operation_id}}{{/vendorExtensions}}(&self{{#allParams}}, param_{{paramName}}: {{^required}}{{#isFile}}Box<Future<Item={{/isFile}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{#isFile}}, Error=Error> + Send>{{/isFile}}{{/required}}{{/allParams}}, context: &C) -> Box<Future<Item={{operationId}}Response, Error=ApiError>> {
{{#queryParams}}{{#-first}}
@ -312,13 +345,13 @@ impl<C> Api<C> for Client where C: Has<XSpanIdString> {{#hasAuthMethods}}+ Has<O
request.set_body(body_string.into_bytes());
{{/hasFile}}{{/vendorExtensions}}
Box::new(self.hyper_client.call(request)
Box::new(self.client_service.call(request)
.map_err(|e| ApiError(format!("No response received: {}", e)))
.and_then(|mut response| {
match response.status().as_u16() {
{{#responses}}
{{code}} => {
{{#headers}} header! { (Response{{nameInCamelCase}}, "{{baseName}}") => [{{{dataType}}}] }
{{#headers}} header! { (Response{{nameInCamelCase}}, "{{baseName}}") => [{{{datatype}}}] }
let response_{{name}} = match response.headers().get::<Response{{nameInCamelCase}}>() {
Some(response_{{name}}) => response_{{name}}.0.clone(),
None => return Box::new(future::err(ApiError(String::from("Required response header {{baseName}} for response {{code}} was not found.")))) as Box<Future<Item=_, Error=_>>,

View File

@ -36,7 +36,7 @@ use std::io;
use std::collections::BTreeSet;
pub use swagger::auth::Authorization;
use swagger::{ApiError, XSpanId, XSpanIdString, Has};
use swagger::{ApiError, XSpanId, XSpanIdString, Has, RequestParser};
use swagger::auth::Scopes;
use {Api{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
@ -127,6 +127,9 @@ where
let api_impl = self.api_impl.clone();
let (method, uri, _, headers, body) = req.deconstruct();
let path = paths::GLOBAL_REGEX_SET.matches(uri.path());
// This match statement is duplicated below in `parse_operation_id()`.
// Please update both places if changing how this code is autogenerated.
match &method {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
// {{operationId}} - {{httpMethod}} {{path}}
@ -462,3 +465,18 @@ fn multipart_boundary<'a>(headers: &'a Headers) -> Option<&'a str> {
})
}
{{/apiHasFile}}
/// Request parser for `Api`.
pub struct ApiRequestParser;
impl RequestParser for ApiRequestParser {
fn parse_operation_id(request: &Request) -> Result<&'static str, ()> {
let path = paths::GLOBAL_REGEX_SET.matches(request.uri().path());
match request.method() {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
// {{operationId}} - {{httpMethod}} {{path}}
&hyper::Method::{{vendorExtensions.HttpMethod}} if path.matched(paths::ID_{{vendorExtensions.PATH_ID}}) => Ok("{{operationId}}"),
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} _ => Err(()),
}
}
}

View File

@ -44,7 +44,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
@ -61,7 +61,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}

View File

@ -6,7 +6,7 @@
export enum {{classname}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}

View File

@ -32,7 +32,7 @@ export namespace {{classname}} {
export enum {{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}

View File

@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig":{

View File

@ -56,7 +56,10 @@ export class {{classname}} {
* @param {{paramName}} {{description}}
{{/allParams}}
*/
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
let queryParameters: any = {};
@ -229,12 +232,15 @@ export class {{classname}} {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}

View File

@ -47,6 +47,8 @@ public class GoClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE);
times = 1;
clientCodegen.setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE);
times = 1;
clientCodegen.setWithXml(GoClientOptionsProvider.WITH_XML_VALUE);
times = 1;
clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));

View File

@ -28,6 +28,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
public static final String PACKAGE_VERSION_VALUE = "1.0.0";
public static final String PACKAGE_NAME_VALUE = "Go";
public static final boolean WITH_GO_CODEGEN_COMMENT_VALUE = true;
public static final boolean WITH_XML_VALUE = true;
public static final Boolean PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true;
@ -43,6 +44,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.WITH_GO_CODEGEN_COMMENT, "true")
.put(CodegenConstants.WITH_XML, "true")
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true")
.build();

View File

@ -15,6 +15,10 @@ pet_t *petApi_getPetById(apiClient_t *apiClient, long petId) {
apiClient_invoke(apiClient,
"pet",
petIdString,
NULL,
NULL,
NULL,
NULL,
NULL);
pet = pet_parseFromJSON(apiClient->dataReceived);
free(apiClient->dataReceived);
@ -38,7 +42,11 @@ void *petApi_addPet(apiClient_t *apiClient, pet_t *pet) {
apiClient_invoke(apiClient,
"pet",
NULL,
petJSONString);
NULL,
NULL,
NULL,
petJSONString,
"POST");
free(apiClient->dataReceived);
free(petJSONString);
cJSON_Delete(petJSONObject);

View File

@ -1,9 +1,11 @@
#ifndef INCLUDE_API_CLIENT_H
#define INCLUDE_API_CLIENT_H
#ifdef API_KEY
#include "list.h"
#endif // API_KEY
typedef int bool;
#define true 1
#define false 0
typedef struct apiClient_t {
char *basePath;
@ -25,6 +27,6 @@ typedef struct apiClient_t {
apiClient_t* apiClient_create();
void apiClient_free(apiClient_t *apiClient);
void apiClient_invoke(apiClient_t *apiClient, char* operationName, char* operationParameter, char *dataToPost);
void apiClient_invoke(apiClient_t *apiClient, char* operationName, char* operationParameter, list_t *queryParameters, list_t *headerParameters, list_t *formParameters, char *bodyParameters, char *requestType);
#endif // INCLUDE_API_CLIENT_H

View File

@ -0,0 +1,7 @@
typedef struct keyValuePair_t {
char* key;
char* value;
} keyValuePair_t;
keyValuePair_t *keyValuePair_create(char *key, char *value);
void keyValuePair_free(keyValuePair_t *keyValuePair);

View File

@ -3,10 +3,8 @@
#include <string.h>
#include "apiClient.h"
#include "pet.h"
#include "keyValuePair.h"
#ifdef API_KEY
#include "apiKey.h"
#endif
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp);
apiClient_t *apiClient_create() {
@ -28,25 +26,77 @@ void apiClient_free(apiClient_t *apiClient) {
curl_global_cleanup();
}
void replaceSpaceWithPlus(char *stringToProcess) {
for(int i = 0; i < strlen(stringToProcess); i++) {
if(stringToProcess[i] == ' ') {
stringToProcess[i] = '+';
}
}
}
char *assembleTargetUrl(char *basePath,
char *operationName,
char *operationParameter) {
char *operationParameter,
list_t *queryParameters) {
int neededBufferSizeForQueryParameters = 0;
listEntry_t *listEntry;
if(queryParameters != NULL) {
list_ForEach(listEntry, queryParameters) {
keyValuePair_t *pair = listEntry->data;
neededBufferSizeForQueryParameters +=
strlen(pair->key) + strlen(pair->value);
}
neededBufferSizeForQueryParameters +=
(queryParameters->count * 2); // each keyValuePair is separated by a = and a & except the last, but this makes up for the ? at the beginning
}
int operationParameterLength = 0;
int basePathLength = strlen(basePath);
bool slashNeedsToBeAppendedToBasePath = false;
if(operationParameter != NULL) {
operationParameterLength = (1 + strlen(operationParameter));
}
if(basePath[strlen(basePath) - 1] != '/') {
slashNeedsToBeAppendedToBasePath = true;
basePathLength++;
}
char *targetUrl =
malloc(strlen(operationName) + strlen(
basePath) +
((operationParameter == NULL) ? 1 : (2 + strlen(
operationParameter))));
malloc(strlen(
operationName) + neededBufferSizeForQueryParameters + basePathLength + operationParameterLength + 1
);
strcpy(targetUrl, basePath);
if(slashNeedsToBeAppendedToBasePath) {
strcat(targetUrl, "/");
}
strcat(targetUrl, operationName);
if(operationParameter != NULL) {
strcat(targetUrl, "/");
strcat(targetUrl, operationParameter);
}
if(queryParameters != NULL) {
strcat(targetUrl, "?");
list_ForEach(listEntry, queryParameters) {
keyValuePair_t *pair = listEntry->data;
replaceSpaceWithPlus(pair->key);
strcat(targetUrl, pair->key);
strcat(targetUrl, "=");
replaceSpaceWithPlus(pair->value);
strcat(targetUrl, pair->value);
if(listEntry->nextListEntry != NULL) {
strcat(targetUrl, "&");
}
}
}
return targetUrl;
}
char *assembleHeader(char *key, char *value) {
char *assembleHeaderField(char *key, char *value) {
char *header = malloc(strlen(key) + strlen(value) + 3);
strcpy(header, key),
@ -56,40 +106,83 @@ char *assembleHeader(char *key, char *value) {
return header;
}
void postData(CURL *handle, char *dataToPost) {
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, dataToPost);
void postData(CURL *handle, char *bodyParameters) {
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters);
curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE,
strlen(dataToPost));
curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "POST");
strlen(bodyParameters));
}
void apiClient_invoke(apiClient_t *apiClient,
char *operationName,
char *operationParameter,
char *dataToPost) {
list_t *queryParameters,
list_t *headerParameters,
list_t *formParameters,
char *bodyParameters,
char *requestType) {
CURL *handle = curl_easy_init();
CURLcode res;
if(handle) {
listEntry_t *listEntry;
curl_mime *mime = NULL;
struct curl_slist *headers = NULL;
headers =
curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers,
"Content-Type: application/json");
if(requestType != NULL) {
curl_easy_setopt(handle,
CURLOPT_CUSTOMREQUEST,
requestType);
}
if(formParameters != NULL) {
mime = curl_mime_init(handle);
list_ForEach(listEntry, formParameters) {
keyValuePair_t *keyValuePair = listEntry->data;
if((keyValuePair->key != NULL) &&
(keyValuePair->value != NULL) )
{
curl_mimepart *part = curl_mime_addpart(
mime);
curl_mime_data(part,
keyValuePair->key,
CURL_ZERO_TERMINATED);
curl_mime_name(part,
keyValuePair->value);
}
}
curl_easy_setopt(handle, CURLOPT_MIMEPOST, mime);
}
list_ForEach(listEntry, headerParameters) {
keyValuePair_t *keyValuePair = listEntry->data;
if((keyValuePair->key != NULL) &&
(keyValuePair->value != NULL) )
{
char *headerValueToWrite =
assembleHeaderField(
keyValuePair->key,
keyValuePair->value);
curl_slist_append(headers, headerValueToWrite);
free(headerValueToWrite);
}
}
// this would only be generated for apiKey authentication
#ifdef API_KEY
listEntry_t *listEntry;
list_ForEach(listEntry, apiClient->apiKeys) {
apiKey_t *apiKey = listEntry->data;
keyValuePair_t *apiKey = listEntry->data;
if((apiKey->key != NULL) &&
(apiKey->value != NULL) )
{
char *headerValueToWrite = assembleHeader(
apiKey->key,
apiKey->value);
char *headerValueToWrite =
assembleHeaderField(
apiKey->key,
apiKey->value);
curl_slist_append(headers, headerValueToWrite);
free(headerValueToWrite);
}
@ -99,7 +192,8 @@ void apiClient_invoke(apiClient_t *apiClient,
char *targetUrl =
assembleTargetUrl(apiClient->basePath,
operationName,
operationParameter);
operationParameter,
queryParameters);
curl_easy_setopt(handle, CURLOPT_URL, targetUrl);
curl_easy_setopt(handle,
@ -148,8 +242,8 @@ void apiClient_invoke(apiClient_t *apiClient,
#endif // BASIC_AUTH
if(dataToPost != NULL) {
postData(handle, dataToPost);
if(bodyParameters != NULL) {
postData(handle, bodyParameters);
}
res = curl_easy_perform(handle);
@ -170,6 +264,9 @@ void apiClient_invoke(apiClient_t *apiClient,
}
#endif // BASIC_AUTH
curl_easy_cleanup(handle);
if(formParameters != NULL) {
curl_mime_free(mime);
}
}
}

View File

@ -1,14 +1,14 @@
#include <stdlib.h>
#include "apiKey.h"
#include "keyValuePair.h"
apiKey_t *apiKey_create(char *key, char *value) {
apiKey_t *apiKey = malloc(sizeof(apiKey_t));
apiKey->key = key;
apiKey->value = value;
keyValuePair_t *keyValuePair_create(char *key, char *value) {
keyValuePair_t *keyValuePair = malloc(sizeof(keyValuePair_t));
keyValuePair->key = key;
keyValuePair->value = value;
return apiKey;
return keyValuePair;
}
void apiKey_free(apiKey_t *apiKey) {
free(apiKey);
void keyValuePair_free(keyValuePair_t *keyValuePair) {
free(keyValuePair);
}

View File

@ -1,6 +1,6 @@
#include "apiKey.h"
#include "keyValuePair.h"
int main() {
apiKey_t *apiKey = apiKey_create("key", "value");
apiKey_free(apiKey);
keyValuePair_t *keyValuePair = keyValuePair_create("key", "value");
keyValuePair_free(keyValuePair);
}

View File

@ -0,0 +1,68 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "apiClient.h"
#include "list.h"
#include "keyValuePair.h"
#define EXAMPLE_BASE_PATH "localhost"
#define EXAMPLE_OPERATION_NAME "pets"
#define OPERATION_PARAMETER "5"
#define EXAMPLE_KEY_1 "skin color"
#define EXAMPLE_VALUE_1 "red"
#define EXAMPLE_KEY_2 "legs"
#define EXAMPLE_VALUE_2 "4"
#define OUTPUT_URL_1 "localhost/pets/5?skin+color=red"
#define OUTPUT_URL_2 "localhost/pets/5?skin+color=red&legs=4"
char *assembleTargetUrl(char *basePath,
char *operationName,
char *operationParameter,
list_t *queryParameters);
int main() {
char *keyOne = malloc(strlen(EXAMPLE_KEY_1) + 1);
char *valueOne = malloc(strlen(EXAMPLE_VALUE_1) + 1);
strcpy(keyOne, EXAMPLE_KEY_1);
strcpy(valueOne, EXAMPLE_VALUE_1);
keyValuePair_t *keyValuePairOne = keyValuePair_create(keyOne, valueOne);
list_t *list = list_create();
list_addElement(list, keyValuePairOne);
char *exampleUrlOne = assembleTargetUrl(EXAMPLE_BASE_PATH,
EXAMPLE_OPERATION_NAME,
OPERATION_PARAMETER,
list);
assert(strcmp(exampleUrlOne, OUTPUT_URL_1) == 0);
char *keyTwo = malloc(strlen(EXAMPLE_KEY_2) + 1);
char *valueTwo = malloc(strlen(EXAMPLE_VALUE_2) + 1);
strcpy(keyTwo, EXAMPLE_KEY_2);
strcpy(valueTwo, EXAMPLE_VALUE_2);
keyValuePair_t *keyValuePairTwo = keyValuePair_create(keyTwo, valueTwo);
list_addElement(list, keyValuePairTwo);
char *exampleUrlTwo = assembleTargetUrl(EXAMPLE_BASE_PATH,
EXAMPLE_OPERATION_NAME,
OPERATION_PARAMETER,
list);
assert(strcmp(exampleUrlTwo, OUTPUT_URL_2) == 0);
free(keyOne);
free(keyTwo);
free(valueOne);
free(valueTwo);
free(exampleUrlOne);
free(exampleUrlTwo);
keyValuePair_free(keyValuePairOne);
keyValuePair_free(keyValuePairTwo);
list_free(list);
}

View File

@ -1,18 +1,21 @@
#include <stdlib.h>
#include <string.h>
#include "apiClient.h"
#include "cJSON.h"
#include "pet.h"
#ifdef API_KEY
#include "list.h"
#include "apiKey.h"
#endif // API_KEY
#include "keyValuePair.h"
#ifdef DEBUG
#include <stdio.h>
#endif // DEBUG
#define EXAMPLE_OPERATION_NAME "pet"
#define EXAMPLE_OPERATION_PARAMETER "3"
#define EXAMPLE_OPERATION_PARAMETER "5"
#define EXAMPLE_KEYNAME_1 "MyExampleKey"
#define EXAMPLE_VALUENAME_1 "MyExampleValue"
#define EXAMPLE_KEYNAME_2 "MyExampleKeyTwo"
#define EXAMPLE_VALUENAME_2 "MyExampleValueTwo"
int main() {
apiClient_t *apiClient = apiClient_create();
@ -21,13 +24,36 @@ int main() {
#endif // OAUTH2
#ifdef API_KEY
apiClient->apiKeys = list_create();
apiKey_t *apiKey = apiKey_create("X-API-Key", "abcdef12345");
keyValuePair_t *apiKey = apiKey_create("X-API-Key", "abcdef12345");
list_addElement(apiClient->apiKeys, apiKey);
#endif // API_KEY
list_t *customHeaderFields = list_create();
char *keyOne = malloc(strlen(EXAMPLE_KEYNAME_1) + 1);
char *valueOne = malloc(strlen(EXAMPLE_VALUENAME_1) + 1);
strcpy(keyOne, EXAMPLE_KEYNAME_1);
strcpy(valueOne, EXAMPLE_VALUENAME_1);
char *keyTwo = malloc(strlen(EXAMPLE_KEYNAME_2) + 1);
char *valueTwo = malloc(strlen(EXAMPLE_VALUENAME_2) + 1);
strcpy(keyTwo, EXAMPLE_KEYNAME_2);
strcpy(valueTwo, EXAMPLE_VALUENAME_2);
keyValuePair_t *firstCustomField =
keyValuePair_create(keyOne, valueOne);
keyValuePair_t *secondCustomField =
keyValuePair_create(keyTwo, valueTwo);
list_addElement(customHeaderFields, firstCustomField);
list_addElement(customHeaderFields, secondCustomField);
apiClient_invoke(apiClient,
EXAMPLE_OPERATION_NAME,
EXAMPLE_OPERATION_PARAMETER,
NULL,
customHeaderFields,
NULL,
NULL,
NULL);
pet_t *pet = pet_parseFromJSON(apiClient->dataReceived);
if(pet == NULL) {
@ -49,7 +75,13 @@ int main() {
free(apiKey);
list_free(apiClient->apiKeys);
#endif // API_KEY
free(keyOne);
free(valueOne);
free(keyTwo);
free(valueTwo);
keyValuePair_free(firstCustomField);
keyValuePair_free(secondCustomField);
list_free(customHeaderFields);
apiClient_free(apiClient);
pet_free(pet);
}

View File

@ -1 +1 @@
3.1.0-SNAPSHOT
3.1.1-SNAPSHOT

View File

@ -1008,12 +1008,12 @@ paths:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
requiredFile:
description: file to upload
format: binary
type: string
required:
- file
- requiredFile
required: true
responses:
200:
@ -1507,6 +1507,7 @@ components:
$ref: '#/components/schemas/Animal'
type: array
File:
description: Must be named `File` for test.
example:
sourceURI: sourceURI
properties:

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ To test special tags
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -66,7 +68,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie
}
// body params
localVarPostBody = &client
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -42,9 +43,10 @@ type FakeOuterBooleanSerializeOpts struct {
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue bool
)
@ -77,7 +79,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -138,9 +140,10 @@ type FakeOuterCompositeSerializeOpts struct {
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue OuterComposite
)
@ -177,7 +180,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
localVarPostBody = &localVarOptionalOuterComposite
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -238,9 +241,10 @@ type FakeOuterNumberSerializeOpts struct {
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue float32
)
@ -273,7 +277,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -334,9 +338,10 @@ type FakeOuterStringSerializeOpts struct {
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue string
)
@ -369,7 +374,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
localVarPostBody = localVarOptionals.Body.Value()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -423,9 +428,10 @@ For this test, the body for this request much reference a schema named &#x60;Fil
func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -454,7 +460,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT
}
// body params
localVarPostBody = &fileSchemaTestClass
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -490,9 +496,10 @@ FakeApiService
func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -522,7 +529,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -559,9 +566,10 @@ To test \&quot;client\&quot; model
func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -591,7 +599,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl
}
// body params
localVarPostBody = &client
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -673,9 +681,10 @@ type TestEndpointParametersOpts struct {
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -733,6 +742,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
}
localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, ""))
localVarFormParams.Add("byte", parameterToString(byte_, ""))
localVarFormFileName = "binary"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.Binary.IsSet() {
localVarFileOk := false
@ -759,7 +769,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
if localVarOptionals != nil && localVarOptionals.Callback.IsSet() {
localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -815,9 +825,10 @@ type TestEnumParametersOpts struct {
func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -868,7 +879,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() {
localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -903,9 +914,10 @@ FakeApiService test inline additionalProperties
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -934,7 +946,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req
}
// body params
localVarPostBody = &requestBody
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -970,9 +982,10 @@ FakeApiService test json serialization of form data
func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -1001,7 +1014,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
}
localVarFormParams.Add("param", parameterToString(param, ""))
localVarFormParams.Add("param2", parameterToString(param2, ""))
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ To test class name in snake case
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Client
)
@ -79,7 +81,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -35,9 +36,10 @@ PetApiService Add a new pet to the store
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -66,7 +68,7 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -108,9 +110,10 @@ type DeletePetOpts struct {
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -141,7 +144,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -178,9 +181,10 @@ Multiple status values can be provided with comma separated strings
func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Pet
)
@ -209,7 +213,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -264,9 +268,10 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Pet
)
@ -295,7 +300,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -350,9 +355,10 @@ Returns a single pet
func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Pet
)
@ -394,7 +400,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -447,9 +453,10 @@ PetApiService Update an existing pet
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -478,7 +485,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response,
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -522,9 +529,10 @@ type UpdatePetWithFormOpts struct {
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -558,7 +566,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -603,9 +611,10 @@ type UploadFileOpts struct {
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ApiResponse
)
@ -637,6 +646,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
}
localVarFormFileName = "file"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
localVarFileOk := false
@ -651,7 +661,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -700,7 +710,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
PetApiService uploads an image (required)
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param file file to upload
* @param requiredFile file to upload
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
@return ApiResponse
@ -710,12 +720,13 @@ type UploadFileWithRequiredFileOpts struct {
AdditionalMetadata optional.String
}
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, file *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ApiResponse
)
@ -747,14 +758,15 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
}
localVarFile := file
localVarFormFileName = "requiredFile"
localVarFile := requiredFile
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ For valid response try integer IDs with value &lt; 1000. Anything above 1000 or
func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -64,7 +66,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -100,9 +102,10 @@ Returns a map of status codes to quantities
func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]int32
)
@ -143,7 +146,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -198,9 +201,10 @@ For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other val
func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Order
)
@ -235,7 +239,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -289,9 +293,10 @@ StoreApiService Place an order for a pet
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Order
)
@ -321,7 +326,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *
}
// body params
localVarPostBody = &order
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -34,9 +35,10 @@ This can only be done by the logged in user.
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -65,7 +67,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -100,9 +102,10 @@ UserApiService Creates list of users with given input array
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -131,7 +134,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -166,9 +169,10 @@ UserApiService Creates list of users with given input array
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -197,7 +201,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -233,9 +237,10 @@ This can only be done by the logged in user.
func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -263,7 +268,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -299,9 +304,10 @@ UserApiService Get user by user name
func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue User
)
@ -330,7 +336,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -385,9 +391,10 @@ UserApiService Logs user into the system
func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue string
)
@ -417,7 +424,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
@ -469,9 +476,10 @@ UserApiService Logs out current logged in user session
func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -498,7 +506,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
@ -535,9 +543,10 @@ This can only be done by the logged in user.
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
@ -567,7 +576,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
@ -153,6 +154,8 @@ func parameterToString(obj interface{}, collectionFormat string) string {
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
} else if t, ok := obj.(time.Time); ok {
return t.Format(time.RFC3339)
}
return fmt.Sprintf("%v", obj)
@ -176,6 +179,7 @@ func (c *APIClient) prepareRequest(
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
formFileName string,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
@ -218,7 +222,7 @@ func (c *APIClient) prepareRequest(
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile("file", filepath.Base(fileName))
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
if err != nil {
return nil, err
}
@ -438,8 +442,9 @@ func CacheExpires(r *http.Response) time.Time {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
} else {
expires = now.Add(lifetime)
}
expires = now.Add(lifetime)
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (

View File

@ -259,7 +259,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **UploadFileWithRequiredFile**
> ApiResponse UploadFileWithRequiredFile(ctx, petId, file, optional)
> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
uploads an image (required)
### Required Parameters
@ -268,7 +268,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**file** | ***os.File*****os.File**| file to upload |
**requiredFile** | ***os.File*****os.File**| file to upload |
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
### Optional Parameters

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model name starting with number

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type AdditionalPropertiesClass struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Animal struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type AnimalFarm struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ApiResponse struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayOfArrayOfNumberOnly struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayOfNumberOnly struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ArrayTest struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Capitalization struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Cat struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Category struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model with \"_class\" property

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Client struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Dog struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumArrays struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumClass string

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type EnumTest struct {

View File

@ -4,11 +4,13 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Must be named `File` for test.
type File struct {
// Test capitalization
SourceURI string `json:"sourceURI,omitempty" xml:"sourceURI"`

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type FileSchemaTestClass struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"os"

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type HasOnlyReadOnly struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type List struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type MapTest struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"time"

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing model name same as property name

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type NumberOnly struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (
"time"

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type OuterComposite struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type OuterEnum string

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Pet struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type ReadOnlyFirst struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
// Model for testing reserved words

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type SpecialModelName struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type StringBooleanMap struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type Tag struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
type User struct {

View File

@ -4,9 +4,10 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package petstore
import (

View File

@ -93,8 +93,9 @@ if(hasProperty('target') && target == 'android') {
}
ext {
swagger_annotations_version = "1.5.8"
jackson_version = "2.6.4"
swagger_annotations_version = "1.5.18"
jackson_version = "2.8.6"
threetenbp_version = "2.6.4"
jersey_version = "2.22.2"
resteasy_version = "3.1.3.Final"
jodatime_version = "2.9.4"
@ -112,7 +113,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
compile "joda-time:joda-time:$jodatime_version"
compile "com.brsanthu:migbase64:2.2"

View File

@ -9,13 +9,17 @@ lazy val root = (project in file(".")).
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.8",
"io.swagger" % "swagger-annotations" % "1.5.18",
"org.glassfish.jersey.core" % "jersey-client" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5",
"org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final",
"org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final",
"org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.6",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.6",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.6",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5",
"joda-time" % "joda-time" % "2.9.4",
"com.brsanthu" % "migbase64" % "2.2",

View File

@ -203,7 +203,7 @@
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-version}</version>
<version>${threetenbp-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
@ -217,7 +217,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-core-version>1.5.18</swagger-core-version>
<resteasy-version>3.1.3.Final</resteasy-version>
<jackson-version>2.6.4</jackson-version>
<jackson-version>2.8.6</jackson-version>
<threetenbp-version>2.6.4</threetenbp-version>
<jodatime-version>2.9.9</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.12</junit-version>

View File

@ -633,7 +633,7 @@ public class ApiClient {
for (Entry<String, String> defaultHeaderEnrty: defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(defaultHeaderEnrty.getKey())) {
String value = defaultHeaderEnrty.getKey();
String value = defaultHeaderEnrty.getValue();
if (value != null) {
invocationBuilder = invocationBuilder.header(defaultHeaderEnrty.getKey(), value);
}

View File

@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}
@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

View File

@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}
@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

View File

@ -1,69 +0,0 @@
{
"name": "@swagger/typescript-fetch-petstore",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "8.10.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.19.tgz",
"integrity": "sha512-+PU57o6DtOSx0/algmxgCwWrmCiomwC/K+LPfXonT0tQMbNTjHEqVzwL9dFEhFoPmLFIiSWjRorLH6Z0hJMT+Q==",
"dev": true
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "~0.4.13"
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"portable-fetch": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/portable-fetch/-/portable-fetch-3.0.0.tgz",
"integrity": "sha1-PL9KptvFpXNLQcBBnJJzMTv9mtg=",
"requires": {
"node-fetch": "^1.0.1",
"whatwg-fetch": ">=0.10.0"
}
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"typescript": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
"dev": true
},
"whatwg-fetch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
}
}
}

View File

@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"

View File

@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}
@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

View File

@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}
@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

View File

@ -1,69 +0,0 @@
{
"name": "@swagger/typescript-fetch-petstore",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "8.10.19",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.19.tgz",
"integrity": "sha512-+PU57o6DtOSx0/algmxgCwWrmCiomwC/K+LPfXonT0tQMbNTjHEqVzwL9dFEhFoPmLFIiSWjRorLH6Z0hJMT+Q==",
"dev": true
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "~0.4.13"
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"portable-fetch": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/portable-fetch/-/portable-fetch-3.0.0.tgz",
"integrity": "sha1-PL9KptvFpXNLQcBBnJJzMTv9mtg=",
"requires": {
"node-fetch": "^1.0.1",
"whatwg-fetch": ">=0.10.0"
}
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"typescript": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
"dev": true
},
"whatwg-fetch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
}
}
}

View File

@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"

View File

@ -1,47 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/isomorphic-fetch@0.0.34":
version "0.0.34"
resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz#3c3483e606c041378438e951464f00e4e60706d6"
"@types/node@^8.0.9":
version "8.0.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.17.tgz#677bc8c118cfb76013febb62ede1f31d2c7222a1"
encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"
iconv-lite@~0.4.13:
version "0.4.18"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"
is-stream@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
isomorphic-fetch@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"
node-fetch@^1.0.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
typescript@^2.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"
whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,10 @@ export class PetApi {
* @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store
*/
public addPet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public addPet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
@ -107,12 +110,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -123,7 +129,10 @@ export class PetApi {
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public deletePet(petId: number, apiKey?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
@ -176,12 +185,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -191,7 +203,10 @@ export class PetApi {
* @summary Finds Pets by status
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: Array<models.Pet>; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};
@ -245,12 +260,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: Array<models.Pet>; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: Array<models.Pet>, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -260,7 +278,10 @@ export class PetApi {
* @summary Finds Pets by tags
* @param tags Tags to filter by
*/
public findPetsByTags(tags: Array<string>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
public findPetsByTags(tags: Array<string>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: Array<models.Pet>; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/findByTags';
let queryParameters: any = {};
@ -314,12 +335,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: Array<models.Pet>; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: Array<models.Pet>, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -329,7 +353,10 @@ export class PetApi {
* @summary Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Pet; }> {
public getPetById(petId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: models.Pet; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
@ -376,12 +403,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: models.Pet; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: models.Pet, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -391,7 +421,10 @@ export class PetApi {
* @summary Update an existing pet
* @param body Pet object that needs to be added to the store
*/
public updatePet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public updatePet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
@ -447,12 +480,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -464,7 +500,10 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
public updatePetWithForm(petId: number, name?: string, status?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public updatePetWithForm(petId: number, name?: string, status?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
@ -533,12 +572,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -550,7 +592,10 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.ApiResponse; }> {
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: models.ApiResponse; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
@ -617,12 +662,15 @@ export class PetApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: models.ApiResponse; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: models.ApiResponse, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}

View File

@ -51,7 +51,10 @@ export class StoreApi {
* @summary Delete purchase order by ID
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder(orderId: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public deleteOrder(orderId: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
@ -93,12 +96,15 @@ export class StoreApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -107,7 +113,10 @@ export class StoreApi {
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
*/
public getInventory(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: { [key: string]: number; }; }> {
public getInventory(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: { [key: string]: number; }; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/store/inventory';
let queryParameters: any = {};
@ -148,12 +157,15 @@ export class StoreApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: { [key: string]: number; }; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: { [key: string]: number; }, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -163,7 +175,10 @@ export class StoreApi {
* @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
public getOrderById(orderId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: models.Order; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
@ -205,12 +220,15 @@ export class StoreApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: models.Order; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: models.Order, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -220,7 +238,10 @@ export class StoreApi {
* @summary Place an order for a pet
* @param body order placed for purchasing the pet
*/
public placeOrder(body: models.Order, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
public placeOrder(body: models.Order, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: models.Order; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/store/order';
let queryParameters: any = {};
@ -265,12 +286,15 @@ export class StoreApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: models.Order; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: models.Order, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}

View File

@ -51,7 +51,10 @@ export class UserApi {
* @summary Create user
* @param body Created user object
*/
public createUser(body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public createUser(body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user';
let queryParameters: any = {};
@ -96,12 +99,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -111,7 +117,10 @@ export class UserApi {
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithArrayInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public createUsersWithArrayInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/createWithArray';
let queryParameters: any = {};
@ -156,12 +165,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -171,7 +183,10 @@ export class UserApi {
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithListInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public createUsersWithListInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/createWithList';
let queryParameters: any = {};
@ -216,12 +231,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -231,7 +249,10 @@ export class UserApi {
* @summary Delete user
* @param username The name that needs to be deleted
*/
public deleteUser(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public deleteUser(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
@ -273,12 +294,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -286,9 +310,12 @@ export class UserApi {
/**
*
* @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.User; }> {
public getUserByName(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: models.User; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
@ -330,12 +357,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: models.User; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: models.User, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -346,7 +376,10 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
public loginUser(username: string, password: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: string; }> {
public loginUser(username: string, password: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body: string; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/login';
let queryParameters: any = {};
@ -399,12 +432,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body: string; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: string, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -413,7 +449,10 @@ export class UserApi {
*
* @summary Logs out current logged in user session
*/
public logoutUser(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public logoutUser(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/logout';
let queryParameters: any = {};
@ -450,12 +489,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}
@ -466,7 +508,10 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUser(username: string, body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
public updateUser(username: string, body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQuery.Promise<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
@ -516,12 +561,15 @@ export class UserApi {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
let dfd = $.Deferred<
{ response: JQueryXHR; body?: any; },
{ response: JQueryXHR; errorThrown: string }
>();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
dfd.resolve({response: jqXHR, body: data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
dfd.reject({response: xhr, errorThrown: errorThrown})
);
return dfd.promise();
}

View File

@ -0,0 +1,26 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* some description
*/
export interface Amount {
/**
* some description
*/
value: number;
currency: models.Currency;
}

View File

@ -0,0 +1,19 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* some description
*/
export interface Currency {
}

View File

@ -1,5 +1,7 @@
export * from './Amount';
export * from './ApiResponse';
export * from './Category';
export * from './Currency';
export * from './Order';
export * from './Pet';
export * from './Tag';

View File

@ -29,6 +29,7 @@
namespace OpenAPI\Server\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use OpenAPI\Server\Service\SerializerInterface;
@ -42,7 +43,7 @@ use OpenAPI\Server\Service\ValidatorInterface;
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class Controller
class Controller extends BaseController
{
protected $validator;
protected $serializer;

View File

@ -1 +1 @@
3.1.1-SNAPSHOT
3.1.2-SNAPSHOT

View File

@ -27,7 +27,21 @@
<version>1.2.1</version>
<executions>
<execution>
<id>bundle-test</id>
<id>build</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cargo</executable>
<arguments>
<argument>build</argument>
<argument>--examples</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>

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