Update default value, fix example value (#370)

* fix python flask NPE with oas3

* update perl default value, fix example value

* update android sample, fix example value

* restore x-swagger-router-controller for nodejs server generator

* update default value for bash client, fix example value, invalid tag

* update default value for objc

* update objc pestore core data
This commit is contained in:
William Cheng 2018-05-08 19:51:15 +08:00 committed by GitHub
parent fd3b883e80
commit 0d20f75afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 475 additions and 571 deletions

View File

@ -27,6 +27,6 @@ fi
# 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/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -l objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -D appName=PetstoreClient"
ags="$@ generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -l objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -c bin/objc-petstore.json"
java $JAVA_OPTS -jar $executable $ags

4
bin/objc-petstore.json Normal file
View File

@ -0,0 +1,4 @@
{
"classPrefix": "SWG",
"podName": "SwaggerClient"
}

View File

@ -27,6 +27,6 @@ fi
# 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/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc/default -D appName=PetstoreClient $@"
ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc/default -c ./bin/objc-petstore.json $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -0,0 +1,5 @@
#!/bin/sh
./bin/openapi3/android-petstore-httpclient.sh
./bin/openapi3/android-petstore-volley.sh

View File

@ -0,0 +1,34 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# 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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion-python2 -DsupportPython2=true"
ags="$@ generate -t modules/openapi-generator/src/main/resources/flaskConnexion -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion-python2 -c bin/supportPython2.json -D service"
rm -rf samples/server/petstore/flaskConnexion-python2/*
java $JAVA_OPTS -jar $executable $ags

View File

@ -0,0 +1,33 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# 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/flaskConnexion -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion -Dservice $@"
rm -rf samples/server/petstore/flaskConnexion/*
java $JAVA_OPTS -jar $executable $ags

View File

@ -4240,7 +4240,6 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.paramName = toParamName(codegenParameter.baseName);
codegenParameter.items = codegenProperty.items;
codegenParameter.dataType = getTypeDeclaration(schema);
LOGGER.info("debugging inline map: " + codegenParameter.dataType);
codegenParameter.baseType = getSchemaType(inner);
codegenParameter.isContainer = Boolean.TRUE;
codegenParameter.isMapContainer = Boolean.TRUE;

View File

@ -289,7 +289,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@ -691,7 +691,8 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@ -393,8 +393,8 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
operation.setOperationId(getOrGenerateOperationId(operation, pathname, method.toString()));
}
if (operation.getExtensions() == null ||
operation.getExtensions().get("x-openapi-router-controller") == null) {
operation.addExtension("x-openapi-router-controller", sanitizeTag(tag));
operation.getExtensions().get("x-swagger-router-controller") == null) {
operation.addExtension("x-swagger-router-controller", sanitizeTag(tag));
}
}
}

View File

@ -56,7 +56,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
protected Set<String> foundationClasses = new HashSet<String>();
protected String podName = "OpenAPIClient";
protected String podVersion = "1.0.0";
protected String classPrefix = "SWG";
protected String classPrefix = "OAI";
protected String authorName = "OpenAPI";
protected String authorEmail = "team@openapitools.org";
protected String license = DEFAULT_LICENSE;
@ -141,7 +141,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("List", "NSArray");
typeMapping.put("object", "NSObject");
typeMapping.put("file", "NSURL");
typeMapping.put("binary", "NSData");
typeMapping.put("binary", "NSURL");
typeMapping.put("bytearray", "NSData");
typeMapping.put("byte", "NSData");
typeMapping.put("uuid", "NSString");
@ -189,7 +189,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
cliOptions.clear();
cliOptions.add(new CliOption(CORE_DATA, "Should generate core data models").defaultValue("false"));
cliOptions.add(new CliOption(CLASS_PREFIX, "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`).`")
.defaultValue("SWG"));
.defaultValue("OAI"));
cliOptions.add(new CliOption(POD_NAME, "cocoapods package name (convention: CameCase).")
.defaultValue("OpenAPIClient"));
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "cocoapods package version.")
@ -698,7 +698,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@ -400,7 +400,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@ -330,7 +330,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
operationId = getOrGenerateOperationId(operation, pathname, method.toString());
}
operation.setOperationId(toOperationId(operationId));
if (operation.getExtensions().get("x-openapi-router-controller") == null) {
if (operation.getExtensions() == null || operation.getExtensions().get("x-openapi-router-controller") == null) {
operation.addExtension(
"x-openapi-router-controller",
controllerPackage + "." + toApiFilename(tag)
@ -526,7 +526,8 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@ -1,221 +0,0 @@
# Bash script generator for Swagger Codegen
## Overview
This is a Bash client script codegen.
The codegen creates a standalone, single-file Bash script client to quickly test and access Swagger annotated REST services. The generated script uses underneath [cURL](https://curl.haxx.se) to make actual REST calls.
The generated Bash script has only 2 dependencies:
- Bash (>= 4.3)
- cURL
## Features
- Fully automatic generation of a client Bash script to access any Swagger-defined REST service
- Generation of Bash and Zsh completion scripts
- All valid cURL options can be passed directly
- Preview of cURL commands to execute each operation using `--dry-run` option
- Complete help for entire service as well as for each operation
- No external dependencies besides Bash and cURL
## Usage
### Generating Bash client for REST service
Get the sources:
```shell
$ git clone https://github.com/swagger-api/swagger-codegen
```
Build the codegen:
```shell
$ mvn package
```
Define custom codegen properties in a Json file, e.g.:
```shell
{
"processMarkdown": true,
"curlOptions": "-sS --tlsv1.2",
"scriptName": "petstore-cli",
"generateBashCompletion": true,
"generateZshCompletion": true,
"hostEnvironmentVariable": "PETSTORE_HOST",
"basicAuthEnvironmentVariable": "PETSTORE_BASIC_AUTH",
"apiKeyAuthEnvironmentVariable": "PETSTORE_API_KEY"
}
```
Generate the client:
```shell
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l bash -o generated/bash/petstore -c modules/openapi-generator/src/test/resources/2_0/bash-config.json
$ chmod +x generated/bash/petstore/petstore-cli
```
Enjoy:
```shell
$ cd generated/bash/petstore
$ ./petstore-cli -h
Swagger Petstore command line client (API version 1.0.0)
Usage
petstore-cli [-h|--help] [-V|--version] [--about] [<curl-options>]
[-ac|--accept <mime-type>] [-ct,--content-type <mime-type>]
[--host <url>] [--dry-run] <operation> [-h|--help] [<headers>]
[<parameters>] [<body-parameters>]
- <url> - endpoint of the REST service without basepath
Can also be specified in PETSTORE_HOST environment variable.
- <curl-options> - any valid cURL options can be passed before <operation>
- <mime-type> - either full mime-type or one of supported abbreviations:
(text, html, md, csv, css, rtf, json, xml, yaml, js, bin,
rdf, jpg, png, gif, bmp, tiff)
- <headers> - HTTP headers can be passed in the form HEADER:VALUE
- <parameters> - REST operation parameters can be passed in the following
forms:
* KEY=VALUE - path or query parameters
- <body-parameters> - simple JSON body content (first level only) can be build
using the following arguments:
* KEY==VALUE - body parameters which will be added to body
JSON as '{ ..., "KEY": "VALUE", ... }'
* KEY:=VALUE - body parameters which will be added to body
JSON as '{ ..., "KEY": VALUE, ... }'
Authentication methods
- Api-key - add 'api_key:<api-key>' after <operation>
or export PETSTORE_API_KEY='<api-key>'
- OAuth2 (flow: implicit)
Authorization URL:
* http://petstore.swagger.io/oauth/dialog
Scopes:
* write:pets - modify pets in your account
* read:pets - read your pets
Operations (grouped by tags)
[pet]
addPet Add a new pet to the store
deletePet Deletes a pet
findPetsByStatus Finds Pets by status
findPetsByTags Finds Pets by tags
getPetById Find pet by ID
updatePet Update an existing pet
updatePetWithForm Updates a pet in the store with form data
uploadFile uploads an image
[store]
deleteOrder Delete purchase order by ID
getInventory Returns pet inventories by status
getOrderById Find purchase order by ID
placeOrder Place an order for a pet
[user]
createUser Create user
createUsersWithArrayInput Creates list of users with given input array
createUsersWithListInput Creates list of users with given input array
deleteUser Delete user
getUserByName Get user by user name
loginUser Logs user into the system
logoutUser Logs out current logged in user session
updateUser Updated user
Options
-h,--help Print this help
-V,--version Print API version
--about Print the information about service
--host <url> Specify the host URL
(e.g. 'https://petstore.swagger.io')
--force Force command invocation in spite of missing
required parameters or wrong content type
--dry-run Print out the cURL command without
executing it
-ac,--accept <mime-type> Set the 'Accept' header in the request
-ct,--content-type <mime-type> Set the 'Content-type' header in
the request
```
Client generator takes several specific configuration options:
* *processMarkdown* - [boolean] if set to `true`, all text (descriptions) in the Swagger specification will be treated as Markdown and converted to terminal formatting commands,
* *curlOptions* - [string] a list of default cURL options that will be added to each command
* *scriptName* - [string] the name of the target script, necessary when building Bash completion script
* *generateBashCompletion* - [boolean] if set to `true` the Bash completion script will be generated
* *generateZshCompletion* - [boolean] if set to `true` the Bash completion script will be generated
* *hostEnvironmentVariable* - [string] the name of environment variable to search for default host
* *basicAuthEnvironmentVariable* - [string] the name of environment variable to search for default basic auth credentials
* *apiKeyAuthEnvironmentVariable* - [string] the name of environment variable to search for default api key
These options can be specified in a Json file used when running the codegen using option `-c` (see [example](resources/example-config.json)).
### Using the generated Bash script
```shell
# Print the list of operations available on the service
$ petstore-cli --help
# Print the service description
$ petstore-cli --about
# Print detailed information about specific operation
$ petstore-cli addPet --help
# Call REST API operation
$ echo '{"id":891,"name":"lucky","status":"available"}' | petstore-cli --host http://petstore.swagger.io --content-type json addPet -
{"id":891,"name":"lucky","photoUrls":[],"tags":[],"status":"available"}
# The above is equivalent to
$ petstore-cli --host http://petstore.swagger.io --content-type json --accept xml addPet id:=891 name==lucky status==available
<xml version="1.0" encoding="UTF-8" standalone="yes"?><Pet><id>891</id><name>lucky</name><photoUrls/><status>available</status><tags/></Pet>
# Preview the cURL command without actually executing it
# The above is equivalent to
$ petstore-cli --host http://petstore.swagger.io --content-type json --dry-run addPet id:=891 name==lucky status==available
curl -sS --tlsv1.2 -H 'Content-type: application/json' -X POST -d '{"name": "lucky", "status": "available", "id": 891}' "http://petstore.swagger.io/v2/pet"
```
## Shell completion
### Bash
The generated bash-completion script can be either directly loaded to the current Bash session using:
```shell
source output/petstore-cli.bash-completion
```
Alternatively, the script can be copied to the `/etc/bash-completion.d` (or on OSX with Homebrew to `/usr/local/etc/bash-completion.d`):
```shell
sudo cp output/petstore-cli.bash-completion /etc/bash-completion.d/petstore-cli
```
#### OS X
On OSX you might need to install bash-completion using Homebrew:
```shell
brew install bash-completion
```
and add the following to the `~/.bashrc`:
```shell
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
```
### Zsh
In Zsh, the generated `_{{scriptName}}` file (e.g. _petstore-cli) must be copied to one of the folders under `$fpath` variable.
## TODO
- [ ] Add enum values for parameters shell completion
- [ ] Wrap handling of errors returned by the service, using comments defined in the Swagger specification
- [ ] Improve `--help` and `--about` formatting
- [ ] Add support to bash 4.0-4.2 (currently must be >= 4.3)
- [ ] Add manpage generation
- [ ] Add support for form data
- [ ] Move todos to Github issues

View File

@ -532,7 +532,7 @@ build_request_path() {
print_help() {
cat <<EOF
${BOLD}${WHITE}{{appName}} command line client (API version {{#swagger}}{{#info}}{{version}}{{/info}}{{/swagger}})${OFF}
${BOLD}${WHITE}{{appName}} command line client (API version {{#openAPI}}{{#info}}{{version}}{{/info}}{{/openAPI}})${OFF}
${BOLD}${WHITE}Usage${OFF}
@ -611,10 +611,10 @@ echo " $ops" | column -t -s ';'
echo -e " -V,--version\\t\\t\\t\\tPrint API version"
echo -e " --about\\t\\t\\t\\tPrint the information about service"
echo -e " --host ${CYAN}<url>${OFF}\\t\\t\\t\\tSpecify the host URL "
{{#swagger}}
{{#openAPI}}
{{#host}}echo -e " \\t\\t\\t\\t(e.g. 'https://{{host}}')"{{/host}}
{{^host}}echo -e " \\t\\t\\t\\t(e.g. 'https://127.0.0.1:8080')"{{/host}}
{{/swagger}}
{{/openAPI}}
echo -e " --force\\t\\t\\t\\tForce command invocation in spite of missing"
echo -e " \\t\\t\\t\\trequired parameters or wrong content type"
echo -e " --dry-run\\t\\t\\t\\tPrint out the cURL command without"
@ -634,10 +634,10 @@ echo " $ops" | column -t -s ';'
##############################################################################
print_about() {
echo ""
echo -e "${BOLD}${WHITE}{{appName}} command line client (API version {{#swagger}}{{#info}}{{version}}{{/info}}{{/swagger}})${OFF}"
echo -e "${BOLD}${WHITE}{{appName}} command line client (API version {{#openAPI}}{{#info}}{{version}}{{/info}}{{/openAPI}})${OFF}"
echo ""
echo -e "License: {{#swagger}}{{#info}}{{#license}}{{name}}{{/license}}{{/info}}{{/swagger}}"
echo -e "Contact: {{#swagger}}{{#info}}{{#contact}}{{email}}{{/contact}}{{/info}}{{/swagger}}"
echo -e "License: {{#openAPI}}{{#info}}{{#license}}{{name}}{{/license}}{{/info}}{{/openAPI}}"
echo -e "Contact: {{#openAPI}}{{#info}}{{#contact}}{{email}}{{/contact}}{{/info}}{{/openAPI}}"
echo ""
read -r -d '' appdescription <<EOF
{{#x-bash-codegen-app-description}}{{{x-bash-codegen-app-description}}}{{/x-bash-codegen-app-description}}
@ -654,7 +654,7 @@ echo "$appdescription" | paste -sd' ' | fold -sw 80
##############################################################################
print_version() {
echo ""
echo -e "${BOLD}{{appName}} command line client (API version {{#swagger}}{{#info}}{{version}}{{/info}}{{/swagger}})${OFF}"
echo -e "${BOLD}{{appName}} command line client (API version {{#openAPI}}{{#info}}{{version}}{{/info}}{{/openAPI}})${OFF}"
echo ""
}

View File

@ -5,7 +5,7 @@
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -44,8 +44,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);

View File

@ -180,7 +180,7 @@ Your library files will be built under `WWW::MyProjectName`.
$ cd openapi-generator
$ mvn package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i [URL or file path to JSON swagger API spec] \
-i [URL or file path to JSON OpenAPI API spec] \
-l perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
@ -210,7 +210,7 @@ namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger
Additional documentation for each class and method may be provided by the OpenAPI
spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes:

View File

@ -286,7 +286,7 @@ Your library files will be built under C<WWW::MyProjectName>.
$ cd openapi-generator
$ mvn package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i [URL or file path to JSON swagger API spec] \
-i [URL or file path to JSON OpenAPI API spec] \
-l perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
@ -315,7 +315,7 @@ namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger
Additional documentation for each class and method may be provided by the OpenAPI
spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes:

View File

@ -52,7 +52,7 @@ __PACKAGE__->method_documentation({
{{/vars}}
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
{{/hasMore}}{{/vars}}
} );

View File

@ -51,7 +51,7 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
@ -79,7 +79,7 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 3);
Assert.assertEquals(cm.discriminator.getMapping().get("test"),"test");
@ -129,7 +129,7 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 2);
@ -168,7 +168,7 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
@ -193,15 +193,15 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.datatype, "SWGChildren*");
Assert.assertEquals(property1.datatype, "OAIChildren*");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "SWGChildren");
Assert.assertEquals(property1.baseType, "OAIChildren");
Assert.assertFalse(property1.required);
Assert.assertTrue(property1.isNotContainer);
}
@ -216,14 +216,14 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "SWGChildren");
Assert.assertEquals(property1.datatype, "NSArray<SWGChildren>*");
Assert.assertEquals(property1.complexType, "OAIChildren");
Assert.assertEquals(property1.datatype, "NSArray<OAIChildren>*");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "NSArray");
Assert.assertEquals(property1.containerType, "array");
@ -241,15 +241,15 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("SWGChildren")).size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("OAIChildren")).size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "SWGChildren");
Assert.assertEquals(property1.datatype, "NSDictionary<SWGChildren>*");
Assert.assertEquals(property1.complexType, "OAIChildren");
Assert.assertEquals(property1.datatype, "NSDictionary<OAIChildren>*");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "NSDictionary");
Assert.assertEquals(property1.containerType, "map");
@ -267,12 +267,12 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "SWGSample");
Assert.assertEquals(cm.classname, "OAISample");
Assert.assertEquals(cm.description, "an array model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "NSMutableArray");
Assert.assertEquals(cm.imports.size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("SWGChildren")).size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("OAIChildren")).size(), 1);
}
@Test(description = "convert an map model")
@ -284,12 +284,12 @@ public class ObjcModelTest {
final CodegenModel cm = codegen.fromModel("map_model", model);
Assert.assertEquals(cm.name, "map_model");
Assert.assertEquals(cm.classname, "SWGMapModel");
Assert.assertEquals(cm.classname, "OAIMapModel");
Assert.assertEquals(cm.description, "a map model for testing ObjC generator");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "NSMutableDictionary");
Assert.assertEquals(cm.imports.size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("SWGChildren")).size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("OAIChildren")).size(), 1);
}
@Test(description = "test udid")
@ -325,7 +325,7 @@ public class ObjcModelTest {
final CodegenModel codegenModel = codegen.fromModel("AnimalFarm",definition);
Assert.assertEquals(codegenModel.isArrayModel, true);
Assert.assertEquals(codegenModel.arrayModelType,"SWGAnimal");
Assert.assertEquals(codegenModel.arrayModelType,"OAIAnimal");
}
@ -355,7 +355,7 @@ public class ObjcModelTest {
final CodegenOperation animalCo = codegen.fromOperation("/animals", "POST", animalOps.getPost(), model.getComponents().getSchemas());
Assert.assertEquals(animalCo.imports.size(), 1);
Assert.assertTrue(animalCo.imports.contains("SWGAnimal"));
Assert.assertTrue(animalCo.imports.contains("OAIAnimal"));
final Map<String, PathItem> insectPaths = model.getPaths();
final PathItem insectOps = insectPaths.get("/insects");
@ -363,6 +363,6 @@ public class ObjcModelTest {
final CodegenOperation insectCo = codegen.fromOperation("/insects", "POST", insectOps.getPost(), model.getComponents().getSchemas());
Assert.assertEquals(insectCo.imports.size(), 1);
Assert.assertTrue(insectCo.imports.contains("SWGInsect"));
Assert.assertTrue(insectCo.imports.contains("OAIInsect"));
}
}

View File

@ -24,7 +24,7 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/openapitools/openapi-generator"
s.license = "Proprietary"
s.source = { :git => "https://github.com/openapitools/openapi-generator.git", :tag => "#{s.version}" }
s.author = { "Swagger" => "team@openapitools.org" }
s.author = { "OpenAPI" => "team@openapitools.org" }
s.source_files = 'SwaggerClient/**/*.{m,h}'
s.public_header_files = 'SwaggerClient/**/*.h'

View File

@ -0,0 +1,37 @@
#
# Be sure to run `pod lib lint OpenAPIClient.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "OpenAPIClient"
s.version = "1.0.0"
s.summary = "OpenAPI Petstore"
s.description = <<-DESC
This is a sample server Petstore server. For this sample, you can use the api key \"special-key\" to test the authorization filters
DESC
s.platform = :ios, '7.0'
s.requires_arc = true
s.framework = 'SystemConfiguration'
s.homepage = "https://github.com/openapitools/openapi-generator"
s.license = "Proprietary"
s.source = { :git => "https://github.com/openapitools/openapi-generator.git", :tag => "#{s.version}" }
s.author = { "OpenAPI" => "team@openapitools.org" }
s.source_files = 'OpenAPIClient/**/*.{m,h}'
s.public_header_files = 'OpenAPIClient/**/*.h'
s.dependency 'AFNetworking', '~> 3'
s.dependency 'JSONModel', '~> 1.2'
s.dependency 'ISO8601', '~> 0.6'
end

View File

@ -24,7 +24,7 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/openapitools/openapi-generator"
s.license = "Proprietary"
s.source = { :git => "https://github.com/openapitools/openapi-generator.git", :tag => "#{s.version}" }
s.author = { "Swagger" => "team@openapitools.org" }
s.author = { "OpenAPI" => "team@openapitools.org" }
s.source_files = 'SwaggerClient/**/*.{m,h}'
s.public_header_files = 'SwaggerClient/**/*.h'

View File

@ -174,7 +174,7 @@ Your library files will be built under `WWW::MyProjectName`.
$ cd openapi-generator
$ mvn package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i [URL or file path to JSON swagger API spec] \
-i [URL or file path to JSON OpenAPI API spec] \
-l perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
@ -204,7 +204,7 @@ namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger
Additional documentation for each class and method may be provided by the OpenAPI
spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes:

View File

@ -386,13 +386,13 @@ my $api_instance = WWW::OpenAPIClient::FakeApi->new(
);
my $enum_header_string_array = [("'$'")]; # ARRAY[string] | Header parameter enum test (string array)
my $enum_header_string = "'-efg'"; # string | Header parameter enum test (string)
my $enum_header_string = '-efg'; # string | Header parameter enum test (string)
my $enum_query_string_array = [("'$'")]; # ARRAY[string] | Query parameter enum test (string array)
my $enum_query_string = "'-efg'"; # string | Query parameter enum test (string)
my $enum_query_string = '-efg'; # string | Query parameter enum test (string)
my $enum_query_integer = 56; # int | Query parameter enum test (double)
my $enum_query_double = 3.4; # double | Query parameter enum test (double)
my $enum_form_string_array = ["'$'"]; # ARRAY[string] | Form parameter enum test (string array)
my $enum_form_string = "'-efg'"; # string | Form parameter enum test (string)
my $enum_form_string_array = ['$']; # ARRAY[string] | Form parameter enum test (string array)
my $enum_form_string = '-efg'; # string | Form parameter enum test (string)
eval {
$api_instance->test_enum_parameters(enum_header_string_array => $enum_header_string_array, enum_header_string => $enum_header_string, enum_query_string_array => $enum_query_string_array, enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double, enum_form_string_array => $enum_form_string_array, enum_form_string => $enum_form_string);

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'map_property' => 'HASH[string,string]',
'map_of_map_property' => 'HASH[string,HASH[string,string]]'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'class_name' => 'string',
'color' => 'string'
} );

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -146,7 +146,7 @@ __PACKAGE__->class_documentation({description => '',
__PACKAGE__->method_documentation({
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -166,7 +166,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'code' => 'int',
'type' => 'string',
'message' => 'string'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'array_array_number' => 'ARRAY[ARRAY[double]]'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'array_number' => 'ARRAY[double]'
} );

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -167,7 +167,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'array_of_string' => 'ARRAY[string]',
'array_array_of_integer' => 'ARRAY[ARRAY[int]]',
'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -187,7 +187,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'small_camel' => 'string',
'capital_camel' => 'string',
'small_snake' => 'string',

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -167,7 +167,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'class_name' => 'string',
'color' => 'string',
'declawed' => 'boolean'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'id' => 'int',
'name' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'_class' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'client' => 'string'
} );

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -167,7 +167,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'class_name' => 'string',
'color' => 'string',
'breed' => 'string'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'just_symbol' => 'string',
'array_enum' => 'ARRAY[string]'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -145,7 +145,7 @@ __PACKAGE__->class_documentation({description => '',
__PACKAGE__->method_documentation({
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
} );

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -181,7 +181,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'enum_string' => 'string',
'enum_string_required' => 'string',
'enum_integer' => 'int',

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -236,7 +236,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'integer' => 'int',
'int32' => 'int',
'int64' => 'int',

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'bar' => 'string',
'foo' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'_123_list' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'map_map_of_string' => 'HASH[string,HASH[string,string]]',
'map_of_enum_string' => 'HASH[string,string]'
} );

View File

@ -62,7 +62,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -101,8 +101,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -167,7 +167,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'uuid' => 'string',
'date_time' => 'DateTime',
'map' => 'HASH[string,Animal]'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'name' => 'int',
'class' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'return' => 'int'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -173,7 +173,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'name' => 'int',
'snake_case' => 'int',
'property' => 'string',

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'just_number' => 'double'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -187,7 +187,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'id' => 'int',
'pet_id' => 'int',
'quantity' => 'int',

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -166,7 +166,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'my_number' => 'double',
'my_string' => 'string',
'my_boolean' => 'boolean'

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -145,7 +145,7 @@ __PACKAGE__->class_documentation({description => '',
__PACKAGE__->method_documentation({
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
} );

View File

@ -63,7 +63,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -102,8 +102,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -189,7 +189,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'id' => 'int',
'category' => 'Category',
'name' => 'string',

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'bar' => 'string',
'baz' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -152,7 +152,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'__special[property/name]' => 'int'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -159,7 +159,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'id' => 'int',
'name' => 'string'
} );

View File

@ -61,7 +61,7 @@ Generated by: https://openapi-generator.tech
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
@ -100,8 +100,8 @@ sub TO_JSON {
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
# loop through attributes and use openapi_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
@ -201,7 +201,7 @@ __PACKAGE__->method_documentation({
},
});
__PACKAGE__->swagger_types( {
__PACKAGE__->openapi_types( {
'id' => 'int',
'username' => 'string',
'first_name' => 'string',

View File

@ -291,7 +291,7 @@ Your library files will be built under C<WWW::MyProjectName>.
$ cd openapi-generator
$ mvn package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i [URL or file path to JSON swagger API spec] \
-i [URL or file path to JSON OpenAPI API spec] \
-l perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
@ -320,7 +320,7 @@ namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger
Additional documentation for each class and method may be provided by the OpenAPI
spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes:

View File

@ -1,4 +1,4 @@
openapi: 3.0.1
openapi: 3.0.0
info:
title: OpenAPI Petstore
description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
@ -6,6 +6,9 @@ info:
name: Apache-2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://petstore.swagger.io/v2
tags:
@ -23,25 +26,14 @@ paths:
summary: Update an existing pet
operationId: update_pet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
$ref: '#/components/requestBodies/Pet'
responses:
400:
description: Invalid ID supplied
content: {}
404:
description: Pet not found
content: {}
405:
description: Validation exception
content: {}
security:
- petstore_auth:
- write:pets
@ -53,19 +45,10 @@ paths:
summary: Add a new pet to the store
operationId: add_pet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
$ref: '#/components/requestBodies/Pet'
responses:
405:
description: Invalid input
content: {}
security:
- petstore_auth:
- write:pets
@ -83,6 +66,7 @@ paths:
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: false
schema:
type: array
@ -109,7 +93,6 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid status value
content: {}
security:
- petstore_auth:
- write:pets
@ -127,6 +110,7 @@ paths:
in: query
description: Tags to filter by
required: true
style: form
explode: false
schema:
type: array
@ -148,7 +132,6 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid tag value
content: {}
deprecated: true
security:
- petstore_auth:
@ -167,6 +150,8 @@ paths:
in: path
description: ID of pet to return
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -182,10 +167,8 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid ID supplied
content: {}
404:
description: Pet not found
content: {}
security:
- api_key: []
x-openapi-router-controller: openapi_server.controllers.pet_controller
@ -199,6 +182,8 @@ paths:
in: path
description: ID of pet that needs to be updated
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -206,17 +191,10 @@ paths:
content:
application/x-www-form-urlencoded:
schema:
properties:
name:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
$ref: '#/components/schemas/body'
responses:
405:
description: Invalid input
content: {}
security:
- petstore_auth:
- write:pets
@ -230,19 +208,23 @@ paths:
parameters:
- name: api_key
in: header
required: false
style: simple
explode: false
schema:
type: string
- name: petId
in: path
description: Pet id to delete
required: true
style: simple
explode: false
schema:
type: integer
format: int64
responses:
400:
description: Invalid pet value
content: {}
security:
- petstore_auth:
- write:pets
@ -259,6 +241,8 @@ paths:
in: path
description: ID of pet to update
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -266,14 +250,7 @@ paths:
content:
multipart/form-data:
schema:
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
$ref: '#/components/schemas/body_1'
responses:
200:
description: successful operation
@ -315,7 +292,7 @@ paths:
requestBody:
description: order placed for purchasing the pet
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/Order'
required: true
@ -331,7 +308,6 @@ paths:
$ref: '#/components/schemas/Order'
400:
description: Invalid Order
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
/store/order/{orderId}:
get:
@ -345,6 +321,8 @@ paths:
in: path
description: ID of pet that needs to be fetched
required: true
style: simple
explode: false
schema:
maximum: 5
minimum: 1
@ -362,10 +340,8 @@ paths:
$ref: '#/components/schemas/Order'
400:
description: Invalid ID supplied
content: {}
404:
description: Order not found
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
delete:
tags:
@ -378,15 +354,15 @@ paths:
in: path
description: ID of the order that needs to be deleted
required: true
style: simple
explode: false
schema:
type: string
responses:
400:
description: Invalid ID supplied
content: {}
404:
description: Order not found
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
/user:
post:
@ -398,14 +374,13 @@ paths:
requestBody:
description: Created user object
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/createWithArray:
post:
@ -414,18 +389,10 @@ paths:
summary: Creates list of users with given input array
operationId: create_users_with_array_input
requestBody:
description: List of user object
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/createWithList:
post:
@ -434,18 +401,10 @@ paths:
summary: Creates list of users with given input array
operationId: create_users_with_list_input
requestBody:
description: List of user object
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/login:
get:
@ -458,12 +417,16 @@ paths:
in: query
description: The user name for login
required: true
style: form
explode: true
schema:
type: string
- name: password
in: query
description: The password for login in clear text
required: true
style: form
explode: true
schema:
type: string
responses:
@ -472,11 +435,15 @@ paths:
headers:
X-Rate-Limit:
description: calls per hour allowed by the user
style: simple
explode: false
schema:
type: integer
format: int32
X-Expires-After:
description: date in UTC when toekn expires
style: simple
explode: false
schema:
type: string
format: date-time
@ -489,7 +456,6 @@ paths:
type: string
400:
description: Invalid username/password supplied
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/logout:
get:
@ -500,7 +466,6 @@ paths:
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/{username}:
get:
@ -513,6 +478,8 @@ paths:
in: path
description: The name that needs to be fetched. Use user1 for testing.
required: true
style: simple
explode: false
schema:
type: string
responses:
@ -527,10 +494,8 @@ paths:
$ref: '#/components/schemas/User'
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
put:
tags:
@ -543,22 +508,22 @@ paths:
in: path
description: name that need to be deleted
required: true
style: simple
explode: false
schema:
type: string
requestBody:
description: Updated user object
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
400:
description: Invalid user supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
delete:
tags:
@ -571,15 +536,15 @@ paths:
in: path
description: The name that needs to be deleted
required: true
style: simple
explode: false
schema:
type: string
responses:
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
components:
schemas:
@ -754,6 +719,45 @@ components:
code: 0
type: type
message: message
body:
type: object
properties:
name:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
body_1:
type: object
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
requestBodies:
UserArray:
description: List of user object
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
Pet:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
securitySchemes:
petstore_auth:
type: oauth2

View File

@ -1,4 +1,4 @@
openapi: 3.0.1
openapi: 3.0.0
info:
title: OpenAPI Petstore
description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
@ -6,6 +6,9 @@ info:
name: Apache-2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://petstore.swagger.io/v2
tags:
@ -23,25 +26,14 @@ paths:
summary: Update an existing pet
operationId: update_pet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
$ref: '#/components/requestBodies/Pet'
responses:
400:
description: Invalid ID supplied
content: {}
404:
description: Pet not found
content: {}
405:
description: Validation exception
content: {}
security:
- petstore_auth:
- write:pets
@ -53,19 +45,10 @@ paths:
summary: Add a new pet to the store
operationId: add_pet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
$ref: '#/components/requestBodies/Pet'
responses:
405:
description: Invalid input
content: {}
security:
- petstore_auth:
- write:pets
@ -83,6 +66,7 @@ paths:
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: false
schema:
type: array
@ -109,7 +93,6 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid status value
content: {}
security:
- petstore_auth:
- write:pets
@ -127,6 +110,7 @@ paths:
in: query
description: Tags to filter by
required: true
style: form
explode: false
schema:
type: array
@ -148,7 +132,6 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid tag value
content: {}
deprecated: true
security:
- petstore_auth:
@ -167,6 +150,8 @@ paths:
in: path
description: ID of pet to return
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -182,10 +167,8 @@ paths:
$ref: '#/components/schemas/Pet'
400:
description: Invalid ID supplied
content: {}
404:
description: Pet not found
content: {}
security:
- api_key: []
x-openapi-router-controller: openapi_server.controllers.pet_controller
@ -199,6 +182,8 @@ paths:
in: path
description: ID of pet that needs to be updated
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -206,17 +191,10 @@ paths:
content:
application/x-www-form-urlencoded:
schema:
properties:
name:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
$ref: '#/components/schemas/body'
responses:
405:
description: Invalid input
content: {}
security:
- petstore_auth:
- write:pets
@ -230,19 +208,23 @@ paths:
parameters:
- name: api_key
in: header
required: false
style: simple
explode: false
schema:
type: string
- name: petId
in: path
description: Pet id to delete
required: true
style: simple
explode: false
schema:
type: integer
format: int64
responses:
400:
description: Invalid pet value
content: {}
security:
- petstore_auth:
- write:pets
@ -259,6 +241,8 @@ paths:
in: path
description: ID of pet to update
required: true
style: simple
explode: false
schema:
type: integer
format: int64
@ -266,14 +250,7 @@ paths:
content:
multipart/form-data:
schema:
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
$ref: '#/components/schemas/body_1'
responses:
200:
description: successful operation
@ -315,7 +292,7 @@ paths:
requestBody:
description: order placed for purchasing the pet
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/Order'
required: true
@ -331,7 +308,6 @@ paths:
$ref: '#/components/schemas/Order'
400:
description: Invalid Order
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
/store/order/{orderId}:
get:
@ -345,6 +321,8 @@ paths:
in: path
description: ID of pet that needs to be fetched
required: true
style: simple
explode: false
schema:
maximum: 5
minimum: 1
@ -362,10 +340,8 @@ paths:
$ref: '#/components/schemas/Order'
400:
description: Invalid ID supplied
content: {}
404:
description: Order not found
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
delete:
tags:
@ -378,15 +354,15 @@ paths:
in: path
description: ID of the order that needs to be deleted
required: true
style: simple
explode: false
schema:
type: string
responses:
400:
description: Invalid ID supplied
content: {}
404:
description: Order not found
content: {}
x-openapi-router-controller: openapi_server.controllers.store_controller
/user:
post:
@ -398,14 +374,13 @@ paths:
requestBody:
description: Created user object
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/createWithArray:
post:
@ -414,18 +389,10 @@ paths:
summary: Creates list of users with given input array
operationId: create_users_with_array_input
requestBody:
description: List of user object
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/createWithList:
post:
@ -434,18 +401,10 @@ paths:
summary: Creates list of users with given input array
operationId: create_users_with_list_input
requestBody:
description: List of user object
content:
'*/*':
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/login:
get:
@ -458,12 +417,16 @@ paths:
in: query
description: The user name for login
required: true
style: form
explode: true
schema:
type: string
- name: password
in: query
description: The password for login in clear text
required: true
style: form
explode: true
schema:
type: string
responses:
@ -472,11 +435,15 @@ paths:
headers:
X-Rate-Limit:
description: calls per hour allowed by the user
style: simple
explode: false
schema:
type: integer
format: int32
X-Expires-After:
description: date in UTC when toekn expires
style: simple
explode: false
schema:
type: string
format: date-time
@ -489,7 +456,6 @@ paths:
type: string
400:
description: Invalid username/password supplied
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/logout:
get:
@ -500,7 +466,6 @@ paths:
responses:
default:
description: successful operation
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
/user/{username}:
get:
@ -513,6 +478,8 @@ paths:
in: path
description: The name that needs to be fetched. Use user1 for testing.
required: true
style: simple
explode: false
schema:
type: string
responses:
@ -527,10 +494,8 @@ paths:
$ref: '#/components/schemas/User'
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
put:
tags:
@ -543,22 +508,22 @@ paths:
in: path
description: name that need to be deleted
required: true
style: simple
explode: false
schema:
type: string
requestBody:
description: Updated user object
content:
'*/*':
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
400:
description: Invalid user supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
delete:
tags:
@ -571,15 +536,15 @@ paths:
in: path
description: The name that needs to be deleted
required: true
style: simple
explode: false
schema:
type: string
responses:
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
x-openapi-router-controller: openapi_server.controllers.user_controller
components:
schemas:
@ -754,6 +719,45 @@ components:
code: 0
type: type
message: message
body:
type: object
properties:
name:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
body_1:
type: object
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
requestBodies:
UserArray:
description: List of user object
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
required: true
Pet:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
securitySchemes:
petstore_auth:
type: oauth2