* Closes#5863
The "dateLibrary" option for java, sadly, sets a mustache value "java8". This change updates this so that "java" in the mustache
libraries means what it should mean - use all java8 classes. In this case, there's no need for the third party Base64 library
as java8's JDK has this built in. In my view, the "dateLibrary" should be deprecated but that should be a separate PR.
* updated samples
* fixed tests for new CLI java8
* regenerated samples after master merge
* oops - left in an end tag after master merge
* rerun checks
* rerun checks
* updated versions
* match fix in 2.2.x branch
* updated with 73df07d64c
* regenerate pom.xml for jaxrs-cxf-petstore-server-annotated-base-path
* regenerate pom.xml for jaxrs-cxf-petstore-server-non-spring-application
* update dep for java jersey1, jersey2
* update sbt dependency for jersey2
* update dep for java okhttp-gson, resteasy, resttemplate
* update dep for java retrofit 1.x, 2.x
* update java petstore samples
* fix JS shell script, add log to show es version
* change CLI option default value for useES6
* fix shell script in JS ES6 promise
* fix windows batch files
* set useES6 to false
* add powershell generator (wip)
* minor fix to api template
* rename model files
* Powershell generator fix (#11)
* Fix typo
pacakge -> package
* Add missing `petstore` subfolder to $ClientPath
* Resolve $ClientPath to absolute path
Start-Process needs WorkingDirectory to be absolute
* Fix spaces in variable name
${ somevar } is a vairable that literally has spaces in name. We need to
temporarily redifine mustache delimiters so we can generate var. names
without spaces.
* Fix typo
Remove stray `r`
* Fix *.ps1 import in module
Directory structure has changed + we should export functions using
manifest.
* Remove erroneous file
* various fixes and enhancements
* remove nullable for string
* change function name based on feedback by beatcracker
* set index to start at 0
* fix file type
* Powershell generator fix 1 (#12)
* Add closing curly brace
* Fix duplicated '['
* Get FunctionsToExport using AST
Discussion: swagger-api/swagger-codegen#5789
* add guid option to powershell generator
* add test files, remove docs
* fix array of items
* clean up powershell comment, update model/api test files
* - Added Restbed Generator
* - Added Json processing functions to model
- Removed unnused code from restbed codegen class
- Added response header processing to api template
* Changed it to respect alphabetical order
* Made the string joining java 7 compatible
* Added samples
* First step in fixing the cpp rest template
regenerated new samples
TODO: Fix the other functions
* Updated samples
* Changing QBuffer to use a QByteArray solves the issue for me since there is no real use-case for using a QBuffer.
Documentation of QT5 states:
QBuffer::QBuffer(QByteArray *byteArray, QObject *parent = Q_NULLPTR)
Constructs a QBuffer that uses the QByteArray pointed to by byteArray as its internal buffer, and with the given parent. The caller is responsible for ensuring that byteArray remains valid until the QBuffer is destroyed, or until setBuffer() is called to change the buffer. QBuffer doesn't take ownership of the QByteArray.
Since the variable “request_content” is allocated on the stack, this is clearly wrong and a bug. The construction of QBuffer is designed this way so that whenever you write to the buffer, it is also written to the byte array that it is pointing to
* Add a retro-compatible solution based on QNetworkAccessManager SourceCode
* update samples
* added headers to makeRequest function for swift3 template
* Added configuration file to Swift3 template
* added comments about the value read only once
* added comments about the value read only once
* comments fix
* Added Configuration.swift to Project File
* swift 3 promisekit, rxswift updates
* adapt the resttemplate target for the threeten Time API
* add threeten dependencies to build.gradle
* fix missing dollar sign
* fix missing dollar sign
* Do not generate pom.xml and README.md when interfaceOnly=true #5542
* New swaggerDocketConfig option, to generate Spring configuration class for Swagger Docket bean. Ignored when interfaceOnly=false or library=spring-cloud #5542
* Updated tests running ./bin/spring-all-petstore.sh
* Run ./bin/spring-all-petstore.sh
* Fix for issue #3638
* Update tests for fix for issue #3638
* Fix bug when queryParams and collectionQueryParams are both specified
* Update tests
* Add certain tests back, address CI failures
* Update samples for several languages.
Just whitespace changes and some reordering where the order doesn't matter.
* Adding generated .swagger-codegen/VERSION files.
* [kotlin] support collectionFormat:multi
Adds "multi" support to collections.
Also changes generic lists (List<T>) to arrays. Generic lists and nested
lists can be problematic and require customized json factories. The
previous implement appeared to work because the results in the test were
LinkedHashMap with count greather than 0. The functional test has been
updated to force serialization and verify the results.
* [kotlin] Regenerate sample
* [kotlin] Update model test for Array changes
* [Swift3] Add lenientTypeCast option
When set to true, this generates a client JSON decoder
that will accept and cast mistyped values.
Here:
- String => Bool ("true" instead of true),
- String => Int ("123" instead of 123),
- NSNumber => String (123 instead of "123").
The point is to allow the same client code to handle several
server implementations that may (sadly) not be up to spec,
or still be "evolving".
The conversion is not guaranteed if the input
Not a perfect/complete solution, not sure if it should be
activated along other casts, so kept behind an option.
* Update Petstore client code
* Fix issue with buffered sink handling in okhttp
Fixes unexpected end of stream exceptions when using the okhttp-gson library
and making asynchronous calls.
* update petstore samples for okhttp-gson
$ ./bin/java-petstore-okhttp-gson.sh
$ ./bin/security/java-petstore-okhttp-gson.sh
* WIP: trigger ci
* add pod file for swift3
* skip pod install
* avoid pod install in swift3 petstore (promisekit,rxswift)
* use https instead of http for cocoapod spec
* avoid timeout in swift3 test
* enable travis CI tests for swift, objc, move some tests to circleci
* fix comment in xml file
* use xcode8.3
* use ruby 2.2.5
* fix objc core data pom.xml
* use cocoapods 1.2.1
* use xcpretty for clearer test results
* fix pom with relative path to script
* comment out objc test
* fix xcpretty exit code
* add && exit ${PIPESTATUS[0]} for swift3 xcodebuild script
* use xcode 8.2
* update promisekit version for swift 2x, 3x
* add pod repo update
* remove Pods directory
* update swift dependencies to the latest version
* update podfile.lock
* rollback Alamofire to 4.0 for swift3
* fix swift3 rxswift api cliiet
* fix testDeletePet test in Swift3 rxswift petstore
* update clojure petstore
* comment out clojure test in travis (already covered in circleci)
* run pestore server locally
* use wing328/swagger-samples to run petstore
* run petstore server in the background
* test ruby petstore client
* add /Users/travis/.cocoapods/repos/master to cache
* add back ruby test, use public pestore server
* add back bash client test
* add npm config set registry to avoid time out
* use docker branch in swagger samples
* remove bash test
* show go version, reorder
* debug go petstore client
* reinstall go
* comment out pod repo update
* uncomment pod repo update
* test go in circleci
* remove go from travis test
* brew install sbt
* [kotlin] Add model enum support
Model variables marked isEnum=true are nested class enums. Top-level
enums will not be isEnum=true, but rather have a datatype specific to
the enum's type.
* [kotlin] Regenerate client sample
* [csharp] refactor ApiClient and Configuration usage
* # This is a combination of 2 commits.
# The first commit's message is:
[csharp] refactor ApiClient and Configuration usage
[csharp] Regenerate sample
# This is the 2nd commit message:
[csharp] Simplify setting apikey/prefix/headers
* # This is a combination of 2 commits.
# The first commit's message is:
[csharp] refactor ApiClient and Configuration usage
* Simplify setting apikey/prefix/headers
* Regenerate sample
# This is the 2nd commit message:
[csharp] Pass-through configuration timeout to client
* [csharp] refactor ApiClient and Configuration usage
* Simplify setting apikey/prefix/headers
* Regenerate sample
* [csharp] Regenerate all client samples
* [csharp] regenerate .net standard/core samples
* [csharp] Fix Timeout diff between netstandard and non-netstandard
* [csharp] Resolve additional netStandard issues after merge
* [csharp] Update doc for Configuration usage
* [kotlin] array->List instead of Array
Serialization to/from primitive arrays can cause issues with valid
responses. This commit considers swagger 'array' types as 'List' which,
although not as memory efficient should provide a cleaner interface for
users (and avoid serialization issues).
Also, updates README.md to list new generator and excludes
folder at samples/client/kotlin/bin/, which is not used.
* [kotlin] Move sample under conventional directory
samples/client/kotlin/ -> samples/client/petstore/kotlin/
Updated new.sh to generate client/server/docs into similar structure.
Current documentation generators (cwiki, html, html.md, html2) aren't
following a convention like client/server generators.
This commit adds Api/Model/Auth documentation to the generated
README.md. Because auth support is not yet fully implemented (users can
manually set default headers globally), there aren't examples for helper
auth methods.
Models with inline enums document allowed values rather than pointing to
a generated enum class.
Two global additionalProperties were added (generateApiDocs,
generateModelDocs) to allow templates to conditionally display
documentatoin depending on these mutually exclusive settings. All
current generators supporting docs will attempt to link to generated
models when only api docs are specified.
This also moves the $@ bash parameter in bin/kotlin-client-petstore.sh
to the end of the args variable. This is because $@ can only be used to
pass System properties like -DdebugModels, can can already be passed as:
JAVA_OPTS="$JAVA_OPTS -DdebugModels" ./bin/kotlin-client-petstore.sh
By moving the $@ to the end of the args, it allows us to pass additional
properties and other switches directly to the script.
* [Ruby] Modify file download to be written in chunks in order to handle large files. #5704
* [Ruby] Update Ruby Petstore with file download improvement. #5704
* Added mustache file for namedCredentials
* Removed Basic and OAuth from Apex API in favor of NamedCredentials
* Moved old README to README for ant deployment
* Added SFDX OSS descriptor
* Removed remoteSite mustache
* Changed package.xml from RemoteSite to NamedCredential
* Update ApexClientCodegen to support SFDX and namedCredentials
* Created initial README for Salesforce DX
* Ran Petstore test for Apex commit
* Fixed error in README mustache
* Updates http-client dependency to one that correctly handles certificates
This is important as amazon AWS gateway and several other types of certificates will not work correctly due to the old java library used by the 2.0.0 version of http-client.
* Runs the petstore updates switch for clojure
* Runs the petstore updates switch for clojure
* remove trailing space in cpprest, update samples
* remove unused pom.xml in go pestore
* fix broken links in php api doc by fixing baseType
* fix csharp api doc
* fix php examples
* fix examples for abstract php generator
* gh-4044: Added useES6 as an option for javascript templates
* gh-4044: Enabled ES6 in `javascript/api.mustache`
* gh-4044: Enabled ES6 in `javascript/ApiClient.mustache`
* gh-4044: Enabled ES6 in `javascript/enumClass.mustache`
* gh-4044: Added useES6 cli option to `javascript` clients and updated the test cases
* gh-4044: Enabled ES6 in `javascript/index.mustache`
* gh-4044: Enabled ES6 in `javascript` model templates
* `javascript/model.mustache`
* `javascript/partial_model_generic.mustache`
* `javascript/partial_model_enum_class.mustache`
* `javascript/partial_model_inner_enum.mustache`
* gh-4044: Separated `javascript-es6` templates to another folder
* gh-4044: Updated `javascript-es6/index.mustache`
* gh-4044: Enabled ES6 in `javascript-es6/api_doc.mustache`
* gh-4044: Added required dependencies for ES6
* gh-4044: Updated Supportig files for ES6 and non ES6
* gh-4044: Added test scripts to verify `javascript` useEs6 option
* gh-4044: Commented `javascript-es6` scripts due to the permission issues.
* Implement generating interfaces option for api resources, closesswagger-api/swagger-codegen#5453.
This commit introduces another _system property_ for typescript-angular2, called `withInterfaces` that is default to `false`. You can activate this flag by:
```
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
-i http://petstore.swagger.io/v2/swagger.json \
-l typescript-angular2 -o samples/server/petstore/springboot/typescript-angular2 \
-D withInterfaces=true
```
If set to `true`, generated api resource classes will be implemented with their interfaces in separate files.
This change should not break and change the behaviour even though `withInterfaces` flag set to `true`. You are also welcome to create your own custom resource class by implementing those generated interfaces as they support defining new attributes with `[others: string]: any;` signature.
* Fix unit test for typescript/angular2 client options for "withInterfaces"
* Use double quote to follow coding standard
* Respect interface naming convention for typescript/angular2
Create respectful interface names that ends with `Interface` suffix, instead of prefixing with `I` according to typescript naming convention. This is also consistent with their file names that also ends with `Interface.ts`.
Also fixes the merge conflicts.
* Have better explanation for the `withInterfaces` system config
* ignore .vscode
* fixed test case for models requiring mandatory attributes. added deserialize test for enum class
* construct model with mandatory attributes. improve class reflection (e.g. deserialize). disable generated empty model unit test for further FIXME
* rebuilt samples
* FIXME comment
* FIXME comment
* fix deserialization enum test
* Disable Jackson FAIL_ON_INVALID_SUBTYPE in feign
With this change, Jackson does not fail even if it doesn't recognize a
discriminator type name. This is helpful when upgrading a microservice with
a new subtype while keeping compatibility with its old clients. The instance
is returned as null instead of throwing an exception deep in the feign
framework, allowing clients to gracefully degrade.
* Disable FAIL_ON_INVALID_SUBTYPE for all Jackson-based projects
With this change, users providing custom configuration must provide an exported Configuration factory, rather than just an object. This is needed to be Angular AoT compatible.
Example use:
import * as api from '../api';
/** Configuration settings for the backend API */
export function backendConfigurationFactory(): api.Configuration {
return new api.Configuration({basePath: '/api'});
}
@NgModule({
imports: [api.ApiModule.forConfig(backendConfigurationFactory)],
...
* Add overloads on signals.
The overload adds the NetworkError and the error string to the signal. Both signal will be emitted. Clients are supposed to subscribe to only one of the overloads.
* refactor generated code alignement
* Do not use method overload for signals. Instead, have another naming convention for signal that carries Error information.
Why ? Because signal overloading and QT5 connector with method referencing do not mix well (see http://stackoverflow.com/questions/16794695/connecting-overloaded-signals-and-slots-in-qt-5). It would need to specify exactly which overload to take. That is cumbersome to write AND is a breaking change for the consumer of the generated code.
* update qt5 sample files
* Added code to templates to ensure generation of code for Swift3 that builds on both Apple platforms and Linux. Fixed a bug in the Model decoders that prevented code from building for Linux
* Ran the script to generate the PetStore API
* Added PowerShell module. See #4320
MVP PowerShell module to serve as a template for a PowerShell generator.
* Fixed function name
* Removed module manifest
It should be generated by the build script
* Ignore module manifests
* Removed binding from prop. name for Pet
This is the result of
- `$ git checkout master`
- `$ bin/run-all-petstore`
No change was made to the code, just ran the aggregate sample generation
script.
query_params is a list of tuple, so defined it as a list by
default instead of a dict.
This fix below issue on the client side.
Traceback (most recent call last):
File "test.py", line 13, in <module>
api_response = api_instance.seek("the")
File "python-client/swagger_client/apis/seek_api.py", line 168, in seek
(data) = self.seek_with_http_info(recherche, **kwargs)
File "python-client/swagger_client/apis/seek_api.py", line 245, in seek_with_http_info
collection_formats=collection_formats)
File "python-client/swagger_client/api_client.py", line 323, in call_api
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
File "python-client/swagger_client/api_client.py", line 135, in __call_api
self.update_params_for_auth(header_params, query_params, auth_settings)
File "python-client/swagger_client/api_client.py", line 512, in update_params_for_auth
querys.append((auth_setting['key'], auth_setting['value']))
AttributeError: 'dict' object has no attribute 'append'
Signed-off-by: Gregory Herrero <gregory.herrero@gmail.com>
* add withCredentials to the configuration
1. `withCredentials` in Request is `false` default
2. if want to set the `withCredentials` as `true` (for CORS request),
instance `Configuration` object and set the `withCredentials` as `true`.
* simplify the code according to the code review
* remove trailing space in cpprest, update samples
* add android batch files, better code format, sync petstore.json with
petstore.yaml
* restore petstore.json and sync it to petstore.yaml
* update circleci pom.xml
* add new android files
* add new android files
* Converting to constructor based injection
* Correcting spelling mistake
* Adding the bean for ObjectMapper
* Adding files modified by running the petstore scripts
* Adding final qualifier to objectMapper variable in apiController mustache
* Add support to UUID type
* Simplify and use a simple QString instead of a QUuid.
Work for using a QUuid is way larger than supporting QString (imply modifying multiple c++ templates).
Current needs are fullfill with the use of a simple QString, so I let the use of QUuid for future enhancement.
* - add windows executable for generating qt5 security samples
- update sample clients
PS : some modifications on the samples are not related to the patch I applied. Were the samples up-to-date ?
* [JAVA/] jaxrs/jersey2 (Issue: 4662) Made java8-date codegeneration to work with jersey2
* Ran shellscripts for jaxrs-jersey-petstore-server and java8-petstore-jersey2 to update petstore samples
* Updated the Petstore samples
* This change uses std::stringstream for string conversions instead of std::to_string(). Android doesn't yet support std::to_string(). This should fix#4632
* Add support for Spring's RestTemplate in Java client codegen
Resolves#1176
* Update all Java samples to include change for Jackson enums
Currently enums are deserialized from a String value with an
explicit @JsonCreator. However, they are not being serialized with
this String value. This change introduces the @JsonValue annotation
on the toString() method of enums, so they will be serialized as a
String with the correct value.
* Rewrite of Go Client
* Revert to older version of context.Context
* Clean and bulk up concurrency test.
* Correct {{path}} to {{{path}}}
* change custom date type to string.
* Add APIKey authentication
* Correct missing line from resolving conflicts.
Correct missing line from resolving conflicts.
* use py3 instead of py34
* fixed test to test invalid enum
* ADDED: assign variable in the ctor with property setter to check validity if possible. CHANGE: move required property check to proper place. CHANGE: remove double quotes from allowed_values for none-string enum property
* rebuilt samples
* comment for improvement
* ADDED: post process enum model for python.
* comment
* rebuilt samples
* rebuilt samples
The generation code was ignoring top-level aliases for any language config that
contained "java", which included "javascript", a completely different language.
Changed this to be those configs based on the JavaAbstractGenerator class.
When a spec defines a Model at the top level that is a non-aggretate type (such
as string, number or boolean), it essentially represents an alias for the simple
type. For example, the following spec snippet creates an alias of the boolean
type that for all intents and purposes acts just like a regular boolean.
definitions:
JustABoolean:
type: boolean
This can be modeled in some languages through built-in mechanisms, such as
typedefs in C++. Java, however, just not have a clean way of representing this.
This change introduces an internal mechanism for representing aliases. It
maintains a map in DefaultCodegen that tracks these types of definitions, and
wherever it sees the "JustABoolean" type in the spec, it generates code that
uses the built-in "Boolean" instead.
This functionality currenlty only applies to Java, but could be extended to
other languages later.
The change adds a few examples of this to the fake endpoint spec for testing,
which means all of the samples change as well.
* Fixed classFilename in typescript-angular and recreated samples
* Changed classname to classFilename in ts-angular2/models.mustache
Also recreated ts-angular2 sample
Commit e3d04ee01 (issue #5240) introduced unsafe add/put methods for optional
list/map parameters. This change maintains the spirit of issue #5240 (optional
containers are null by default) while still making add/put calls safe. It does
this by checking for null first and, if so, initializing it with an empty
container.
Also updated the affected samples using the various scripts in bin/.
* set list to null in java if not required
* update petstore sample for java server stub
* update sample for msf4j
* add null assignment to new list/map in java
* reimplemented basic requests with httpplug
* added returning headers
* added query params support
* removed constant reference to model class
* some extra @throws; form params
* form and query params encoding
* file upload / form multipart
* added missing response headers in WithHttpInfo calls
* removed Store test From PetApiTest class
* removed configuration overriding test as its now task of client adapters
* updated store tests with new client initialization code
* updated composer.json template
* not using json_decode if response is string
* renamed some variables to camelCase
* removed ApiClient and Configuration classes
* added HeaderSelector template
* added ObjectSerializer injection
* regenerated all samples
* added AuthConfig and readded support for custom api keys
* readded support for oauth tokens
* readded basic auth; moved auth tests to separate test class
* readded header params
* readded support for collections in paths
* readded config option; readded exception handling
* file downloading; readded some Configuration properties removed earlier
* readded default headers
* made responses and return types work same way as earlier
* made all methods static in ObjectSerializer
* updated test.php, replaced autoload.php with composer's autoloader
* updated api doc template
* removed classes used for testing; regenerated Fake_classname_tags123Api
* replaced httplug with guzzle6
* updated required php version to 5.5
* clean up
* readded missing userAgent feature; removed default headers from Configuration
* updated test.php
* downgraded phpunit back to 4.8 to work with php5.5; fixed client initialization in some tests
* Add async support to scala client.
* Format api endpoints.
* Modify build.sbt.
* Change date format and pass StoreApis tests.
* Add StringReader and StringWriter to support string serialization/deserialization.
* update petstore samples for scala clients
* Update maven and gradle dependency. Update tests to pass compilation.
* [Swift3] Fix bug where non-camel-case path params didn't work.
* [Swift3] Fix bug where int enums generated non-compiling code. Swift3 integration tests now pass.
* [Swift3] Add a non-camel-case path parameter to petstore-with-fake-endpoints-models-for-testing. This would have caused the Swift3 tests to be broken before 7387e49fef56a624045aa52b65ffb9c19b3853ec.