Fixes a handful of issues identified in https://github.com/OpenAPITools/openapi-generator/issues/802#issuecomment-617262139
List of changes
* Clean: Remove redundant cliOption definition
* Remove redundant directory structure in templates
If we need to have different index.ts files for the different
frameworks, we can mostly do that in the one mustache file. In the cases
where that is not possible, we can still add a new override file later.
* Use File.separator consistently
* Only export selected api type
* Simplify promise polyfill import
The behaviour should be the same, according to the es6-promise docs.
Previously tsc would report the error:
> error TS2307: Cannot find module 'es6-promise'.
* Import HttpFile in all models
* Export server configurations
* Use undefined as default body value
The empty string is not interpreted as "no body" by the browser fetch
api and thus leads to an exception during get requests
* Improve codestyle: prefer guards to nesting
* Remove verbose debug output
This should not be commited, because every developer has very different
requirements what debug information he needs to see.
* Fix: Use cleaned model names for imports
* Fix: do not call toString on undefined
* Fix typo in doc comment
* Introduce RequestBody type and remove method check
* [REQ][JAVA]: Add option to generate arrays with "uniqueItems" true as Sets rather than Lists
- Update Java code generation to use sets instead of lists when uniqueItems is set to true
- Add import resolution for sets
- Add tests and fix broke tests
resolve#5254
* Update Javascript, Perl, Python and Ruby to preserve current functionality.
* Switch set implementation to LinkedHashSet
* Fix missing import for uniqueItems used on param.
* Fix missing import and return type for responses with uniqueItems
* Fix default values for array of enum
* Update generated samples
* fix merge issue
* Update generated samples
Co-authored-by: William Cheng <wing328hk@gmail.com>
* Added support Retrofit2(RxJava/RxJava2/Coroutines) to Kotlin client code generator
* Added generated samples for Retrofit2(RxJava/RxJava2/Coroutines) on Kotlin
* Fixed generating retrofit2 without Rx/Coroutines
* Fixed MultipartBody template, remove redundant space after MultipartBody.Part annotation
* Fix documentation diff.
* Fix generating build.gradle file for samples.
Add dependencies for rxJava/rxJava2 and rx retrofit's adapter.
* Update generated sample with rx dependencies
* Update generated sample with coroutines
* Update generated sample with RxJava 2 dependencies
* Update and refactoring scripts for sample generation
* Update generated sample code
* revert changes by mistake
* revert changes by mistake #2
* Fix return type for first RxJava
* Add RxJavaCallAdapterFactory to ApiClient scheme for RxJava 1/2
* Fix script loggin
* Update generated code for RxJava 1/2
* Fix kotlin.md documentation by script export_docs_generators.sh
* Update Kotlin samples project in pom.xml
* Revert "Update Kotlin samples project in pom.xml"
This reverts commit 9de4d0ba
* Fixed "" wrapping number types for annotation value
Fixed generating polymorphic interfaces for Gson, interface fields can't be marked with @SerializedName annotation, it's enough to mark it in child model.
Fixed instantiationTypes(array, list, map) for Kotlin generator
* Update Kotlin samples project after last fixes
* Update Kotlin samples project for kotlin-jvm-*
* Update Kotlin readme.md documentations
* Update Kotlin client sample changes
* Fixed encoding braces for generics model
* Update Kotlin client sample changes
* Update Kotlin client sample after merge with master
* Fixed adding empty braces for inherit from Map/Array
* Update sample model after last fix with empty braces
* Revert adding @SerializedName to Kotlin interface fields through @get:SerializedName as for Jackson
* Update Kotlin client samples with adding @get:SerializedName
* Changes in mustache file to include new option
- New options `useSingleRequestParameter` to use a single param for the request, instead of one param per request param.
* Chanes in the documentation
Include new parameter `useSingleRequestParameter`.
Default value = `false` to keep compatibility with previous versions.
* Include script to generate samples
Also included script in the script that runs all
* Generate new samples
- Previous samples have a minor change (one line is deleted)
- New sample generated with the new parameter set to true
* Include scripts for windows
* Include new CLI option in codegenerator class
* Change the order for the new parameter in the docs
* add scaffolded new documentation generator files
* add openapi3 plantuml bin scripts
* change plantuml codegen to only generate a schemas.plantuml file
* initial plantuml schema diagram
* add item type to Lists
* add inheritance relationships
* add list one-to-many relationships
* add newline between model definitions and relationships
* add composition data type relationship
* remove allOf models and interface references
* add new entities data to SupportingFileData
* add List dataType support to entity fields
* remove composed types and remove allOf suffix from inline types
* add inheritances to supporting files data object
* add aggregation relationships to supporting file data
* add isList to compisition relationships
* refactor PlantumlDocumentationCodegenTest
* add property name to relationships
* remove old code form PlantumlDocumentationCodegen
* add plantuml generator sample output
* remove use of javafx.util.Pair
* fix casing of complex data type for fields
* add plantuml generator docs
* fix bug caused by assumption that inline _allOf types will always be unique but apparently they can be shared if they have identical properties!
* fix bug with missing relationships caused by shared identical _allOf schemas
Co-authored-by: Patrick.Burls <patrick.burls@bskyb.com>
* Minor changes to 2.1 templates to make them work or improve documentation
* Support for ASP.NET Core 3.0 and 3.1
* Update aspnetcore test scripts and results
* Update generated documentation
* update doc
* Update modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache
Co-Authored-By: Tatsuro Shibamura <me@shibayan.jp>
* Update modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache
Co-Authored-By: Tatsuro Shibamura <me@shibayan.jp>
Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
* Use string form of filename parameter
This works for the form-data library and is also compatible with the
browser FormData object.
* Add new option to select platform node or browser
When no platform is selected, a default is chosen by the framework
option and likewise the file data type option is implied by the
platform.
* Remove redundant import of node dns module
* Only use form-data library for node platform
* Generate npm package from npmName option
* Use method convertPropertyToBooleanAndWriteBack
* Generate typescript samples with ensure-up-to-date
* Remove unused supportsES6 field from codegen
* Add a new switch for RXJS
* Remove redundant npm dependency on rxjs4 types
* Fix return type of PromiseMiddleware methods
* Install webpack dependency to run jquery tests
* Update form-data to 2.5 which includes typings
* Add missing dependency on node typings
* Fix test artifact name typo
* Stub rxjs when it is not explicitly enabled
* Try decoding but don't bail on error
* Switch binary and ByteArray to bytes
* Read content type and parse appropriately
* Remove response parsing
* Remove response parsing and just return the data
* Update petshop examples w/ new generator code
* Fix copy/paste error with naming
* Update petstore examples
* Move response decoding to inside _preload_content block
* Update the clients again
* Use a raw string for the regex pattern
* Regenerate petstore clients
* Add bytes to python primitives as it's supported in 2.7 and 3
* Add bytes to the exports from model_utils
* Import bytes from model_utils
* Add conditional typing for regex pattern to match variable type
* Regenerate petstore clients
* Use read() instead of text() for asyncio
* Regenerate petstore clients
* Remove unused six import
* Regenerate petstore clients
* Add newline to kick Circle to re-run
* Remove whitespace from tox.ini
* Update more examples after ensure_updated
* Add sample updates that didn't run with the --batch flag
* Remove extra bracket in regex to remove warning
* Stop printing debug messages
* Add bytes examples to python doc generators
* Update generated FakeApi docs
* Regenerate api_client.py
* Remove print statements from generated clients
* Update bytes example in FakeApi.md. Again. I swear.
* Add yet another seemingly missing doc update
* Catch the error, decode the body, and re-throw
* Remove the updates now that the change is non-breaking
* Regenerate client
* Add bytes deserialization test
* Update exception parsing
* Add exception parsing for python-experimental
* Regenerate client with minor changes
* Revert test changes
* Regenerate model_utils.py
* Update confusing test name
* Remove bytes from mapping and examples
* Add back in the old binary/ByteArray to str mapping
* Update docs and api_client template
* Add experimental api_client changes
* Regenerate samples again
* Add Tornado handling to early return
* Try fixing Tornado python returns
* More documentation changes
* Re-generate the client code
* Remove bytes from test_format_test
* Remove more leftover bytes usages
* Switch bytes validation back to string
* Fix format_test template and regenerate
* Remove unused bytes var
* Remove bytes import from models and regenerate
* Remove bytes import from test_deserialization
* Reduce nested ifs
* Remove byte logic for now
* Regenerate client after latest changes
* Remove another bytes usage
* Regenerate after removing dangling byte string usage
* Reduce the scope of the try/catch in api_client
* Regenerate after try/catch cleanup
* Swap catch for except
* Regenerate Python client after api_client change
* Fix lint error on the generated api_client
* Add binary format test back in w/ string
* Add decoding to python-experimental and regenerate
* Import re into python-experimental api_client
* Ensure file upload json response is utf-8 encoded bytes
* Adds addComposedMappedModels and testComposedSchemaOneOfDiscriminatorMap
* Requires that discriminators be required properties
* Strengthens discriminaotr validation, adds better error messages, adds schema oneof samples
* Adds oneOf and anyOf invalidDiscriminator tests
* Updates incorrect addOneOfInterfaceModel invocation
* Runs ensure-up-to-date
* Adds updates from Sebastien Rosset
* Removes newlines
* Uses df.isString
* Fixes tests be correctly setting df.isString
* Updates discriminatorExplicitMappingVerbose description per PR feedback
* Adds description of how mappedModels is populated
* Adds the suggestion exception raising when a MappedModel mappingName is null
* Actually resolves merge conflicts
* Switches two methods to package private because they are needed for testing
* Allow nulls in MappedModel.getMappingName
* Updates CLI flag name to legacyDiscriminatorBehavior, default=true
Co-authored-by: William Cheng <wing328hk@gmail.com>
* add jersey2 experimental
* add new files
* add abstract one of class
* read the stream multiple times
* rename to getActualInstance
* update petstore
* fix jackon check
* test new java petstore in ci
* fix broken tests
* remove todo
* better exception message, primitive type handling
* add anyof support
* update samples
* add new files
* update all java client samples
* update doc, fix pom
* better null check for allOf
* add primitive types support in oneof, anyof
* better validation
* update python exp samples
* remove primitive type support in allOf
Some APIs have a model called "Index" which would create a file
"Index.ts" which would override "index.ts" on case-insensitive file
systems (e.g. macOS, some Windows versions). Make "Index" a reserved
word to prevent this clash.
* Add 'discriminatorCaseSensitive' property
* Discriminator value lookup should not be case insensitive
* fix typo
* run scripts
* execute ./bin/utils/export_docs_generators.sh
* fix discriminator mapping, add code comments
* Updating packages version (#5313)
* Add support to RestSharp version 106.10.1
Restsharp 106.10.1 needs the Content Lenght as a parameter to AddFile method
* Updating RestSharp Version
Updating RestSharp Version
* Update netcore_project.mustache
* Update netcore_testproject.mustache
* Update Project.mustache
* Updating packages version
Updating packages version
* Updating packages version
Updating packages version
* Updating packages version
Updating packages version
* Updating packages version
Updating packages version
* Updating packages version
Updating packages version
* Updating packages version
Updating packages version
* Execute task async obsolete
Use ExecuteAsync instead
* update csharp samples
Co-authored-by: William Cheng <wing328hk@gmail.com>
* [csharp] Library upgrade fix (#5848)
* On .net45 framework, Restsharp version is updated to 106.10.1 Otherwise, it stays on version 105.1.0
* Added additionalProperties for library versions and target frameworks
* Removed unused properties
* Added an additional property to test for a specific version of RestSharp
* Updated csharp samples
* Fixed nuspec.mustache to use library specific additional properties
* Updated csharp samples
* Updating CI/samples.ci csharp petstore test project file.
* Updated csharp.md
Co-authored-by: Olivier Leonard <oleonard@ankama.com>
* [csharp-client] Restored tests on csharp samples (#5879)
* Restored tests on csharp samples
* Restored a reference to the file used to test file uploads
Co-authored-by: Olivier Leonard <oleonard@ankama.com>
* update samples
Co-authored-by: Igor Quirino <iquirino91@gmail.com>
Co-authored-by: Bouillie <34162532+Bouillie@users.noreply.github.com>
Co-authored-by: Olivier Leonard <oleonard@ankama.com>
* python server: Add pythonSrcRoot option
This will allow the python project to be in a subdirectory (as specified
in pythonSrcRoot). That could mean following the src layout with sources
under src/ or lib/. Multi-language projects might use a sub directory
like python/, or whatever makes sense for the project.
By default, the pythonSrcRoot is "", meaning the existing behavior is
the default.
* python server: update template files to support pythonSrcRoot
* python server: update docs to add pythonSrcRoot option
* python server: add pythonSrcRoot sample script
* python server: build sample srclayout project
* [Python] copy test files preserving history
* [Python] Make a conflict to preserve file copy history
* [Python] customize pom.xml for src layout tests
* [Python] add python-aiohttp-srclayout tests
* [Python] Fix server tests by updating requirements
Reverts the PR that disabled python2 server tests:
https://github.com/OpenAPITools/openapi-generator/pull/4949
Reverts commits that disabled python3 server tests:
9adfedbfbb45c7059e64b3d9a285710bded4fb62
17ee990baaa80585242c7a07d64e2be4888fcfd0
Issue about the python 3 tests:
https://github.com/OpenAPITools/openapi-generator/issues/5235
I couldn't find an issue about the python2 tests being disabled.
I'm guessing build errors like the following were the trigger:
https://travis-ci.org/github/OpenAPITools/openapi-generator/builds/634238181
Let's see what breaks!
* [Python] Copy setup.py to python-aiohttp
* [Python] Save history while copying setup.py to python-aiohttp
* [Python] Add aiohttp server setup.py
* [Python] Fix python server tests with src layout
* [Python] bump Flask-Testing version
* [Python] Pin pyyaml for py2.7 flask server
* [Python] simplify flask server requirements
* consolidate server tests
* [Python] rebuild python server samples
* [Python] Fix python server requirements for older pythons
Documented minimum python version for our aiohttp server is 3.5.
Documented minimum python version for our flask server is 3.4.
Connexion 2.3 is the last version to support python 3.4 and 3.5, so fix
the version pinning to correctly select <=2.3 for these EOL python
versions. Newer pythons should get the latest if possible as there many
relevant bug fixes.
Werkzeug also needs to be pinned for these old versions in the aiohttp
server just like for the flask server.
3.4 and 3.5 are EOL. We really should increase the minimum supported
version, but that is for another PR to do.
* Scala akka-http server base implementation
* [scala-akka-http-server] petStore samples
* Improved the formatting of generated files
* Updated scala-akka-http server samples
* [scala-akka-http-server] the groupId, artifactId and artifactVersion default value are used as intended.
* Fixed the default operation not being correctly generated on parameterless operations
* Added build.sbt.mustache supporting file
* Updated scala-akka-http server samples
* ScalaAkkaHttpServer: Fixed a String.format call to use Locale.ROOT for locale
* [scala-akka-http-server] Fixed defaultValue being escaped during generation
* Added scala-akka-http.md
* Replaced all "⇒" character with "=>" to retain compatibility with scala 2.13
* [scala-akka-http] Added a config option akkaHttpVersion
It's set in the generated build.sbt.
* Updated scala-akka-http server samples
* [scala-akka-http] More accurate akkaHttpVersion parsing
* Updated scala-akka-http.md
* [scala-akka-http] Changed the akka-http version check to fix the generation of StringDirectives
* Updated scala-akka-http samples
* updated scala-akka-http.md
Co-authored-by: Olivier Leonard <oleonard@ankama.com>
* [cli] Some CLI improvements…
* Introduce --version
* Introduce --help
* Add --sha to version command for short SHA display
* Output Version and SHA details
* In new --version output, display repo and doc site
Additional cleanup to suppress warnings and code quality.
* [docker] Adds labels for metadata
This adds image labels to store metadata on the online and cli docker
images, using standard labels:
* org.opencontainers.image.created
* org.opencontainers.image.revision
* org.opencontainers.image.title
* org.opencontainers.image.version
These can be inspected via 'docker inspect IMAGE_NAME' and may be useful
in tooling/automation or bug reports submitted by users.
For more details on these labels, see:
https://github.com/opencontainers/image-spec/blob/master/annotations.md
* Include version --full for equiv to --version