8767 Commits

Author SHA1 Message Date
https://gitlab.com/selankon
6439990463
Add listFromJson method to fix #4887 (#5355) 2020-05-02 21:27:27 +08:00
Jaumard
7d5695e551
dart-dio improvements (#6047)
* fix runtime deserialisation

* add security support for dart dio

* regenerate dart dio sample

* update dio pubspec.mustache deps

* check response type before parsing

* add default dateTime serializer

* regenerate sample
2020-05-02 21:23:52 +08:00
Åsmund Grammeltvedt
c08e80f49b
Propagate deprecated property through $ref's (#6093)
* Propagate deprecated property through $ref's

As $ref is supposed to completely replace the definition of a property,
make sure we also include the 'deprecated' property when generating the
type of a $ref property.

This makes a property $ref'ing a deprecated schema also become deprecated.

* Clarify why we're messing around with $ref
2020-05-01 22:01:01 +08:00
William Cheng
6484c03518
Test scala akka petstore client in CI (#6118)
* test scala akka in ci

* fix compilation error

* fix scala akka test

* add tests
2020-05-01 16:47:38 +08:00
adg-mh
c38b52919f
[dart-dio][client] Handle x-www-form-urlencoded form data (#5597) 2020-05-01 11:02:45 +08:00
William Cheng
b23c52f2ca
[Go][experimental] provide code samples in the API doc (#6115)
* provide code samples in api doc

* update petstore samples
2020-05-01 10:50:01 +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
William Cheng
3bbaedd9bc
Better "Any Type" support (#6091)
* better anytype support

* add tests for any type

* fix test with any_value

* fix tests

* fix case additionalProperties: {}

* test with CI

* remove check in map schema

* Revert "remove check in map schema"

This reverts commit e016c4155f1bd8753e894d87bad8e70eee29f3d5.

* fix tests, comment out map schema fix

* fix tests

* fix tests with correct codegen model

* fix tests

* fix tests for map of any type

* fix array of any type

* fix array of any type

* update samples, remove log

* add typemapping to go, python
2020-04-30 21:23:55 +08:00
Jim Schubert
cc623ba429
[cli][build] Relax the git id plugin (#6094)
* [cli][build] Relax the git id plugin

* Guard against null on missing build properties
2020-04-30 08:49:07 -04: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
Aleksandr Nekrasov
8e4452e383
[scala-akka-http] fixed getOffsetDateTimeHeader and removed broken test due invalid v2 spec (#6109) 2020-04-30 10:53:14 +08:00
William Cheng
001d9cb36d
better docstring for jersey2 client (#6104) 2020-04-29 23:43:21 +08:00
Geoff Brown
bc097cfdde
[C#] Fixed valuetype parameters and discriminator deserialization (#5680)
* Fixed valuetype parameters and discriminator deserialization

- Made non-required valuetypes nullable, and flagged required valuetypes as "x-csharp-value-type"
- Made sure to camelCase discriminator property names in Subtype converter

* Ran pet store sample script

* Ensure that readWriteVars and readOnlyVars are also marked as isEnum and isPrimitiveType where appropriate

* Updated petstore sample with enum fix

* Fields that are required should emit default values (otherwise the consuming API might throw a fit

* Added missing sample updated

* Re-ran petstore example script to grab all changes

* Rebased and re-ran example update script

* update csharp samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-04-29 21:36:27 +08:00
Jim Schubert
a8cc42d170
[validation] Warn on duplicate tags (#6061)
The specification requires that tags are unique. This isn't caught by
swagger-parser, so we will issue a warning if duplicate tag names are
found.
2020-04-29 11:48:05 +08:00
iliaskarim
e01c1a9b72
Readonly properties for Swift 5 (#6048)
* Generate readonly properties in Swift5 with additional readonlyProperties parameter

* add sample
2020-04-29 11:17:00 +08:00
Dennis Ameling
7424582210
[TypeScript-Angular] Add AuthService example to README.md (#6087)
* Add AuthService example to TypeScript Angular README.md

* Update generated Angular libs
2020-04-28 17:13:41 +02:00
Justin Black
a2b613c1b3
Fixes md docs (#6079)
* Fixes md docs

* Separates out boolean enum options into legacyDiscriminatorBehaviorOpts

* Updates docs, adds true and false descriptions
2020-04-28 22:30:56 +08:00
n0idea
6bb4bd8ebe
fixed typescript-axios pattern data integrity by removing escapeText() call (#5974) 2020-04-28 16:22:21 +02:00
Harald Fernengel
500fb472b0
[typescript-fetch] Allow multiline documentation (#6088)
Add a lambda that formats the documentation correctly even if it
contains newlines. The generated docs with typedoc looks a lot better
and also renders Markdown correctly.

Also remove the "no description" fallback for APIs because we don't have
it anywhere else, other generators don't generate a default fallback and
I'd rather have no documentation than a "no description" string.
2020-04-28 16:20:26 +02:00
Jim Schubert
f12fb86a1a
[feat] Allow configuration of yaml minimize quotes (#5933)
There are cases where minimizing quotes results in invalid YAML. For
example, an input YAML with string "1234_1234" will be converted to YAML
value 1234_1234 which is an int in YAML 1.1
(https://yaml.org/type/int.html)

THe only option in these cases is to either:

* Revert the option completely to always quote values
* Provide a user-customization to disable quotes minimization

This applies the latter with the assumption that this is an edge case
and users who are unaffected will default to the "prettier" version.

An alternative would be to write a custom serializer for strings, and if
they are in the format of of any of the valid formats defined in YAML:

[-+]?0b[0-1_]+ # (base 2)
|[-+]?0[0-7_]+ # (base 8)
|[-+]?(0|[1-9][0-9_]*) # (base 10)
|[-+]?0x[0-9a-fA-F_]+ # (base 16)
|[-+]?[1-9][0-9_]*(:[0-5]?[0-9])+ # (base 60)

Then wrap the result in quotes. That approach was not taken because of
the potential for significant performance impact on very large specs,
which our users are often tasked with transforming.
2020-04-28 22:20:15 +08:00
Harald Fernengel
6f9d8259b0
[typescript-fetch] Make FormData optional (#6077)
Check "typeof FormData" first. This allows the code to also work in
nodejs with isomorphic-fetch.
2020-04-28 15:21:53 +02:00
William Cheng
46216cd796 Merge remote-tracking branch 'origin/master' into 5.0.x 2020-04-28 20:35:28 +08:00
Harald Fernengel
354f195ec0
[typescript-fetch] Support deepObject query params (#6075)
deepObject query parameters need to be specially marshalled.
Unfortunately, they're quite tricky to distinguish in mustache because
there's no boolean property for deepObject, so add a vendorExtension
property to ease the mustache template.
2020-04-28 10:37:31 +02:00
jerbob92
3d5b140c3d
Fix URLSessionImplementations file upload (#6043)
* Fix URLSessionImplementations file upload

* Generated petstore
2020-04-28 00:28:21 +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
William Cheng
3b0bd368a6
Update Java (feign) client dependency (#6068)
* update feign dependency

* update feign samples
2020-04-28 00:09:14 +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
Kieran Simpson
0e276bef19
Add input flag for Gradle openApiGenerate task (#5966) 2020-04-24 22:20:40 -04:00
Sebastien Rosset
e8f486ba7f
[Python experimental] Readme improvements (#6031)
* Python experimental readme improvements

* Python experimental readme improvements

* execute scripts in bin directory
2020-04-25 00:10:32 +08:00
Sebastien Rosset
58908e6494
[codegen] change x-oneOf-name to x-one-of-name. Consistency with naming conventions and x-all-of-name (#5820)
* change x-oneOf-name to x-one-of-name.

* Add code comments

* Add code comments
2020-04-25 00:07:15 +08:00
Justin Black
8e8471c1fd
[CORE] Fixes composed schema discriminator map (#4906)
* 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>
2020-04-25 00:01:02 +08:00
William Cheng
45bbe4922b
Add test for allOf without object type (#6042)
* add test for allof without object type

* add comments to test cases
2020-04-24 23:41:42 +08:00
sunn
234053fed9
Export response code to worker (#6021) 2020-04-24 14:46:25 +02:00
sunn
649daed9a9
Export valid and set status of properties (#6020) 2020-04-24 14:44:48 +02:00
Sebastien Rosset
6ad5e5fb45
[Python experimental] Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info (#6033)
* Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info

* Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info
2020-04-23 23:16:31 -07:00
Sebastien Rosset
1e01c380e8
[python-experimental] Minor doc update, code comments and exception handling (#5945)
* add support for any type, i.e. when 'type' attribute is not specified in OAS schema

* fix typos, add code comments

* Handle case when 'type' attribute is not present in the OAS schema

* fix python formatting rule

* fix python formatting rule

* remove 'object' as a type
2020-04-23 22:59:31 -07:00
William Cheng
93dd4a5138
Add jersey2-experimental to Java client generator (#6024)
* 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
2020-04-24 12:47:25 +08: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
iliaskarim
bafed337b5
Fix OpenAPI link in broken Swift4/5 README templates (#6035)
* Fix Swift README templates

* Update Swift4/5 samples
2020-04-24 10:36:52 +08:00
Francisco A. Lozano
c981535579
Change access updateParamsForAuth to protected (#5940)
So that it can be overridden with a custom behaviour.
2020-04-23 23:25:35 +08:00
chenqping
140f823465
fix generate java-inflector crash issue on windows (#6011) 2020-04-23 13:31:42 +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
Harald Fernengel
00ffcea6ef
[typescript-fetch] Fix map API return type (#5995)
Fix APIs that return a map.
2020-04-22 14:25:26 +02:00
Harald Fernengel
b431d65099
Make "Index" a reserved word (#6000)
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.
2020-04-22 14:24:42 +02:00
Harald Fernengel
63b4429775
Escape clashing model names (#6004)
Closes #6002
2020-04-22 14:23:24 +02:00
William Cheng
47a9294a99 Merge remote-tracking branch 'origin/master' into 5.0.x-sync-master4 2020-04-22 12:15:45 +08:00
Jochen Schalanda
40be1c311e
[Java][Client] Fix Gradle and SBT builds for REST Assured generator (#5990)
* Fix Gradle and SBT builds for Java REST Assured generator

* Add missing jackson-databind-nullable dependency to SBT build

* Update rest-assured sample

* Add sample for Java client with REST Assured and Jackson

* Add new REST Assured sample as Maven sub-module
2020-04-22 11:19:17 +08:00
William Cheng
12512cf720
update cxf version (#6003) 2020-04-22 11:02:23 +08:00