1458 Commits

Author SHA1 Message Date
Januson
c49d8fda8e
[M][REQ][JAVA]: Add option to generate arrays with "uniqueItems" true as Sets rather than Lists (#5466)
* [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>
2020-05-21 13:27:57 +08:00
Natan Laverde
40a329f0f7
[BUG] [Server: C++] [Qt5] Fix missing headers and wrong status code (#6345)
Change helper method '''writeResponseHeaders''' implementation to just set the headers, instead of write them, and also rename the method to '''setSocketResponseHeaders''', to maintain the new semantic.
The implementation of '''QHttpEngine::Socket::write''' or '''QHttpEngine::Socket::writeJson''' implementations will call '''Socket::writeData''' that writes the Headers and Status Code before write the content if they are not already written.
If these methods are not called (e.g.: empty reply), we could set the headers just before close the socket.
2020-05-20 11:12:13 +08:00
Natan Laverde
f8a144bdc1
[C++] [Qt5] [Server] read json (#6343)
* [C++] [Qt5] [Server] [Bug] fixed Incomplete Read JSON

Emit signal requestReceived only after request content is entirely received.

* [C++] [Qt5] [Server] [Bug] fixed Incomplete Read JSON

Emit signal requestReceived only after request content is entirely received.
2020-05-18 11:32:13 +02:00
William Cheng
654e94c645
Migrate Erlang samples to use OAS 3 spec (#6297)
* erlang samples switch to oas3 spec

* add new files

* update samples
2020-05-15 11:24:37 +08:00
Andrei Chugunov
ae2b693ccc
[BUG] Failed to add required=false (#2062) (#5573) 2020-05-14 21:10:12 +08:00
William Cheng
15794f8026
Fix build failure due to flake8 (#6265)
* fix flake8 folder

* fix flake8 folder in python2

* comment out flake8

* comment out flake8

* comment out flake8

* comment out flake8

* comment out flake8
2020-05-12 21:41:55 +08:00
William Cheng
4effa739eb
Add AnyType support to Java generators (#6246)
* add anytype support to java

* fix test

* fix primitive type

* update tests

* update samples
2020-05-11 15:27:03 +08:00
William Cheng
6ed9bd8f29
minor fix to aspnetcore scripts (#6250) 2020-05-11 14:28:46 +08:00
William Cheng
6ae61e2dfd update java inflector samples 2020-05-09 22:03:32 +08:00
William Cheng
d6d241bdab
remove web.config (#6214) 2020-05-08 22:47:16 +08:00
William Cheng
b23ec9a7dd
map any type in rust server generator (#6209) 2020-05-08 10:11:58 +08:00
William Cheng
98e54f0cc1 Merge remote-tracking branch 'origin/5.0.x' 2020-05-07 14:27:56 +08:00
Richard Whitehouse
046b4acdff
[Rust Server] Support boolean headers, and fix panic handling headers (#6056)
* [Rust Server] Support headers containing booleans

* [Rust Server] Fix panic handling headers

* [Rust Server] Fix issue with Results

* Update samples
2020-05-06 19:27:52 +01:00
William Cheng
4beea9d90d update samples 2020-05-07 00:30:12 +08:00
William Cheng
1d606499ee Merge remote-tracking branch 'origin/5.0.x' 2020-05-06 22:51:05 +08:00
William Cheng
9afa154a5e
[aspnetcore] test petstore samples in drone.io (#6148)
* test aspnetcore 3.0/3.1 in drone.io

* switch images

* trigger build failure

* Revert "trigger build failure"

This reverts commit f5c2c1578db1a0e7b90a668f095e1d6eb1766fca.
2020-05-04 15:09:28 +08:00
Paul Hatcher
e4cbaa721b
Implement Asp.Net Core 3.0/3.1 generator (#6009) (#6025)
* 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>
2020-05-03 16:32:26 +08:00
Artem
0032e04530
[php-symfony] Fix return type in model setters. (#6085)
* Fix return type in model setters.
Previously return type was same, as method arguments. It`s wrong, and cause errors like
"Return value of Foo::setSuccess() must be of the type bool, object returned"
We cant use self and current {{classname}} as return type, because that can break class inheritance. So, better remove type hint on setters, until PHP-devs dont make realization for return static

* Add return self type hint for setters

* Revert "Add return self type hint for setters"

This reverts commit 07dd9715
2020-04-30 22:03:05 +03:00
Artem
3e2c933dec
[php-symfony] Fix problem with clients, that put charset in content type header. (#6078)
* Fix problem with clients, that put charset in content type header.

With this fix header "Content-Type: application/json; charset=utf-8" working same as "Content-Type: application/json" for parse input data

* Fix code style, add $consumes length check.

* Add isContentTypeAllowed static method and tests

* Fix old tests

Right now serializer doesn't support anything beside json and xml.
Call tests with application/json instead of form data.

Co-authored-by: Yuriy Belenko <yura-bely@mail.ru>
2020-04-30 12:22:44 +03:00
William Cheng
46216cd796 Merge remote-tracking branch 'origin/master' into 5.0.x 2020-04-28 20:35:28 +08:00
William Cheng
588023686a
Add HTTP signature authentication support to Java (jersey2-experimental) (#6058)
* add fmt-maven-plugin to jersey2 exp

* update samples

* add http signature auth template

* minor fix

* fix http beaer auth, update sample

* fix http signature auth

* fix http signature auth

* header support

* add query string to path

* undo changes in default codegen

* ignore fake test

* add serialize to string method

* add serialzie to string method

* add get mapper

* auto format java source code

* remove plugin

* update pom.xml

* change back AbstractOpenApiSchema to T

* skip mvn code formatter in bin script

* undo changes to spec

* update samples

* add back HttpSignatureAuth.java
2020-04-28 00:09:30 +08:00
Justin Niessner
db5941379f
[Python] Fix Python UTF-8 Encoding Issue (#5679)
* 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
2020-04-26 13:33:42 -07:00
Richard Whitehouse
f36a319316
[Rust Server] Rust 2018 Edition (#5942)
* [Rust Server] Rust 2018 Edition
* [Rust Server] Fix unused warning
* Update samples
2020-04-26 12:00:46 +01:00
William Cheng
cef5470ea8
Add Http signature authentication test to fake petstore spec (#6054)
* add endpoint to test http signature

* update plugin version
2020-04-25 23:39:41 +08:00
sunn
649daed9a9
Export valid and set status of properties (#6020) 2020-04-24 14:44:48 +02:00
Andy.Yang.cn
d911fd73bd
[Rust Server] Bugfix #5948 (Generated client code "Disabled because there's no example") (#5949)
* [Rust Server] Fix RustServerCodegen type: object example "Disabled because there's no example" issue.

* [Rust Server] Add test case yaml with "Disabled because there's no example" issue.

* [Rust Server] Fix example-client-main param.example character escaping issue with raw string.

* [Rust Server] Add test case yaml new generated code after fix.
2020-04-24 11:04:36 +08:00
Andy.Yang.cn
38dfed4104
[Rust Server] Fix #5947 multi tag generate multi method issue. (#5928)
* [Rust Server] Fix issue with multiple tags on an operation generating duplicate methods.

* [Rust Server] Add test case yaml with multiple tags on a single operation.
2020-04-22 18:00:21 +01:00
William Cheng
47a9294a99 Merge remote-tracking branch 'origin/master' into 5.0.x-sync-master4 2020-04-22 12:15:45 +08:00
William Cheng
5ae783aac5 update jaxrs cxf samples 2020-04-22 10:58:31 +08:00
William Cheng
ac5de91b97 update jaxrs cxf version 2020-04-22 00:17:58 +08:00
William Cheng
bf4c5298fd fix port in sample 2020-04-21 18:13:21 +08:00
William Cheng
98ea048d46 fix port in pom.xml 2020-04-21 15:59:39 +08:00
William Cheng
fc7dda8db9 update more samples 2020-04-21 10:04:42 +08:00
William Cheng
5a9b0fcf9e update samples 2020-04-21 02:22:55 +08:00
Richard Whitehouse
2cd5bc45da Update samples 2020-04-20 18:43:19 +01:00
Bouillie
cb50ad590f
[scala-akka-http-server] Fix a generation problem on operations with empty responses (#5868)
* [scala-akka-http-server] When expecting an empty response, a response with an empty text/plain content is not produced anymore

* Updated scala-akka-http-server samples

Co-authored-by: Olivier Leonard <oleonard@ankama.com>
2020-04-18 01:22:24 +08:00
William Cheng
faf6f197be Merge remote-tracking branch 'origin/master' into 5.0-sync-master 2020-04-17 15:51:00 +08:00
Bodo Graumann
896867b5e7
Use model as body param for generateAliasAsModel (#4569)
* generateAliasAsModel: Use model name as body param

* Update samples
2020-04-17 13:36:27 +08:00
Andy.Yang.cn
c3837ca331
[Rust Server] Fix #5906 (yaml with path parameter error) (#5871)
* [Rust Server] Fix Rust 1.39+ "Box<Future" and "as &Has" compile issue

* [Rust Server] Fix Rust server side pathRegEx and baseName not match issue

* [Rust Server] Add test case yaml with path parameter.
2020-04-15 17:19:00 +01:00
Nicolas Homble
c479e518d4
[Python][aiohttp] create venv as rule (#5913)
* create venv as rule

* create venv as rule II
2020-04-14 14:53:28 +08:00
Richard Whitehouse
95105cef2e
[Rust Server] Support complex query parameters (#5831)
* [Rust Server] Support complex query parameters

* [Rust Server] Remove unused extern crate

* [Rust Server] tokio should be a dev-dependency

* [Rust Server] Add test for complex query params

* Update samples

Co-authored-by: Matt Williams
2020-04-12 19:57:50 +01:00
Artem Shubovych
62c346f8da
[enhancement] [jaxrs-spec] Add builders to models (#4930)
* Update formatting in jaxrs-spec POJOs

* Add generateBuilders option

* Update formatting in jaxrs-spec POJOs

* Disable the builders generation by default

* Ensure samples are up-to-date

* Revert newline change

* Run ensure-up-to-date

* update doc

* fix merge conflicts

Co-authored-by: Artem Shubovych <ashubovych@atlassian.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-04-12 17:27:34 +08:00
Gonzalo
6a158de431
Add date time format annotation on pojo for model query parameters (#5437)
* Add date time format annotation on pojo for model query parameters

* Regenetare samples

* update spring samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-04-12 09:39:16 +08:00
sunn
c73f3c5eb2
Updates to allow the setting of the dateTime format string (#5763) 2020-04-09 09:20:35 +02:00
Jacob Floyd
469b21830c
Add pythonSrcRoot option to python servers (aiohttp/flask/blueplanet) to support src/ layout projects [and reenable/fix all python server tests] (#5423)
* 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.
2020-04-07 23:14:13 -07:00
jburgess
2ff9be6f95
[codegen] Fix 'super.HashCode' for oneOf and allOf Implementations (retry) (#5830)
* Added hasVars after completion of all model post-processing (#5587)

* Post ensure-up-to-date

* Update to check the size of vars and not assume non-null
2020-04-07 16:42:20 +08:00
Richard Whitehouse
cdb500c156
[Rust Server] Fix no features build (#5747)
* Remove test file erroneously checked in

* [Rust Server] Fix no features build

- Need serde_json for no-features build for undefined value structures
- Don't include `IntoHeader` type and implementations if we aren't including the client/server features
- Don't export the `IntoHeader` type at all - it's internal

* Update samples
2020-04-05 19:08:39 +01:00
Alex Buchkovsky
166aae6fec
[BUG] [KOTLIN] Fix default value generation for Kotlin Strings (#5776)
* fix default value generation for kotlin

* add updated pet templates

* Revert "add updated pet templates"

This reverts commit 7e8168ad

* regen pet store projects code
2020-04-06 01:30:03 +08:00
William Cheng
52018c43ba
Minor improvements to scala akka server (#5823)
* minor improvements to scala akka server

* add samples

* update doc
2020-04-05 10:09:31 +08:00
Bouillie
af85fab52b
Scala akka-http server (#5758)
* 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>
2020-04-04 23:16:14 +08:00