743 Commits

Author SHA1 Message Date
Peter Leibiger
065c0281fa
[dart] Improve types & imports (#9167)
* [dart] Improve types & imports

* don't use importMapping as it is intended for something different that is not possible in dart
* introduce imports map for dart specific features
* always import `dart:core`
* get rid of additionalReservedWords
* fix `--type-mappings` not working
* use required type mappings in samples
* no longer define additional reserved words  as it is impossible to list all anyways, they can now be configured via type-mapping parameter
* simplify dio imports

* Don't use guava for map instantiation

* Update docs
2021-04-07 00:33:35 +08:00
William Cheng
c79d056935
Allow to specify response headers (needed for redirecting clients) (#9170)
* Allow to specify response headers (needed for redirecting clients) (#8148)

Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>

* add addResponseHeaders option

* enable addResponseHeaders

* fix comma

Co-authored-by: randomswdev <randomswdev@users.noreply.github.com>
Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>
2021-04-05 16:27:41 +08:00
Justin Black
6cc270633b
[python] Fixes additional_properties_type for models (#8802)
* Fixes additionalProperties values for models, updates docs, adds tag test of it, fixes frit and gmfruit tests

* Moves this.setDisallowAdditionalPropertiesIfNotPresent higher

* Makes setting additional_properties_model_instances contingent on the presence of addprosp in schema, updates sample spec composed schemas to remove addprops False form two

* Fixes oneOf anyOf allOf instantiation logic

* Removes Address from Cat definition

* Adds required vars for apple and banana, removes required vars from composed schema init sig

* Updates composed schema vars to be set on self and all composed instances

* Removes get_unused_args, get_var_name_to_model_instances, and get_additional_properties_model_instances

* Fixes fruit + deserilization tests, creates ComposedSchemaWithPropsAndNoAddProps

* Fixes FruitReq tests

* Fixes GmFruit tests

* Fixes discard_unknown_keys tests

* Samples updated

* Removes additionalproperties False in Child

* Samples updated

* Improves handling of v2 and v3 specs for isFreeFormObject, v2 sample spec updated with link to bug

* Adds cli option disallowAdditionalPropertiesIfNotPresent to python

* Adds getAdditionalProperties method so the value for addProps will be correct

* Reverts file

* Reverts file

* Updates python doc

* Reverted anytype_3 definition

* Updates test_deserialize_lizard

* Updates test_deserialize_dict_str_dog

* Updates testDog

* Updates testChild

* Adds v2 python_composition sample

* Adds needed files for python testing

* Adds existing tests into the new python sample

* Fixes test_dog

* Removes addProps false form Dog

* Fixes testChild

* Updates how additionalProperties are set

* Fixes empty_map type

* Type generation fixed for v2 and v3 specs

* Refactors getTypeString, updates artifactids in pom.xml files

* Adds new python sample to CI testing I think

* Fixes artifactId collision, regenrates docs
2021-03-31 08:48:12 -07:00
William Cheng
ab6c6962c2
add enum suffic support to rust client (#9107) 2021-03-29 11:40:26 +08:00
William Cheng
0e0dc3f26b update doc 2021-03-24 13:45:52 +08:00
Kam
f137f3331a
Add possibility to generate only files needed for sources compilation (#9012) 2021-03-24 13:27:25 +08:00
Peter Leibiger
3d038b74fd
[dart][dart-dio] Next-gen dart-dio generator (#8869)
* [dart-dio] Remove old Dart 1.x templates

* [dart-dio] Initial version of a next-gen Dart Dio generator

* Fix a couple readme links and examples

* Fix import in testcase

* Add integration tests to master POM

* Run initial dart format and improve some base formatting

* Generate docs

* Use integer matchers in test for content-length

* Separate more built_value specific files

* Fix mustache partial path

* Update pubspec template

* Fix tests after mock lib updates

* Generate with new built_value pre-release

This solves the problem of not being able to serialize null.

* Update built_value dependency

* Regenerate after merge

* Regenerate tests

* Fix missing byte response cast

* Update dio to 4.0.0-prev1

* Run format

* Ignore unused imports in inheritance classes

* Update mock test library

* Update docs

* Make a couple variables final

* Update and freeze dio dependency

* Update generator doc

* Add a new option to post processes all dart output at once

This is much faster than individual files. The committed samples should be formatted since Dart is very opinionated and it makes diffs in PRs much easier to read.
Due to this, we also need to format in CI, otherwise there is a git diff.

* Test some CI stuff
2021-03-20 12:26:56 +08:00
William Cheng
46326249d2
mark httpclient support as experimental (#9016) 2021-03-19 23:14:58 +08:00
Blackclaws
061b00e990
[csharp][aspnetcore] Update aspnetcore nuspec and csproj with authors and description (#8995)
* Update aspnetcore nuspec and csproj with authors and description

* Removed unneccesary include
2021-03-19 21:25:32 +08:00
Peter Leibiger
de8b344a34
[dart] Generic docs update and fixes (#8999)
* [dart] Generic docs update and fixes

* none of the dart generators supports XML
* jaguar is no longer maintained
* dart and dart-dio support bearer token
* none of the dart generators supports composition atm.

* [dart-dio] Supports customization of authorizations and userAgent

* Remove deprecation of dart-jaguar for now
2021-03-19 21:15:13 +08:00
agilob
c920d08b69
[dart] mark json_serializable as experimental (#8979)
* Hide json_serializable from public users

* Make json_serializable as experimental

* Update wording marking json_serializable as experimental
2021-03-19 21:11:22 +08:00
Adam Leventhal
15c3bf47a4
[Rust Client] several small fixes to code generation errors (#8845)
* fix cyclic types

* fixed up bad enum names

* fixed double crate:: issue

* add required ToString for enum classes

* Adds Debug/Clone derive macro for generated configuration type

* Updates versions of dependencies recorded in generated Cargo.toml

* fix merge

* bin/generate-samples.sh

Co-authored-by: Benjamin Naecker <bnaecker@fastmail.com>
2021-03-15 10:30:22 +08:00
Justin Black
8226269101
Fixes legacyDiscriminatorBehavior description (#8931)
* Fixes description

* Samples and docs updated
2021-03-08 13:39:12 -08:00
Internaional Network Support & Service - Glas
041d908963
Changed virtualan version from 1.0.0 to 2.1.7. Update readme.md and d… (#8910)
* Changed virtualan version from 1.0.0 to 2.1.7. Update readme.md and description in springboot generator.

* Updated virtualan link in spring.md.

* update samples

Co-authored-by: networkinss <oliver.glas@inss.ch>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-03-07 09:38:31 +08:00
delenius
7b5a583345
Make JS client case sensitive wrt. reserved words (#8905)
Fixes #8904
2021-03-06 18:40:06 +08:00
Oleh Kurpiak
976b4aa757
[Java] Additional enum type annotations (#8389)
* [Java] Additional enum type annotations

* [Java] Additional enum type annotations
2021-03-04 23:33:00 +08:00
Blackclaws
e815d7ced8
C# Netcore WebRequest and HttpClient functionality (#8821)
* Add switch to disable RestSharp

* Introduce CLI Option for webRequestLibrary

* Fix missing brace

* Remove restsharp references

* HttpClient added

* WebRequest NewRequest functionality added

* WebRequest added to CLIOptions

* Add custom HttpMethod only for Restsharp.

* Add WebRequestPathBuilder.mustache

* HttpClient NewRequest

* Add using Statement to WebRequestPathBuilder.mustache

* Adjusts retry configuration for HttpClient

* Reuse JsonDecoder

* Make reusing the client a separate option

* Save cookies in request

* Implement more methods for HttpClient

* Small fixes

* Fix post content

* Add new sample config

* Update existing samples

* Add new sample

* Add new property supportsRetry

* Use new property to exclude RetryConfiguration

* Exclude Polly on non supporting Retry

* Update sample and documentation

* Create HttpMethod Patch for netstandard 2.0 compatibility

* Fix query parameter generation

* Switch to library settings

* Allow httpclient reuse (experimental)

* Remove webrequest from template as its not used right now
2021-02-28 16:18:16 +08:00
Dheeraj Nalluri
264b017eec
[Java][Client] JSON-B serialization support (#8729)
* Added JSON-B support.

* Mention jsonb in docs
2021-02-27 15:32:46 +08:00
agilob
9fc33f6a73
[Dart] Add configuration to add new generators and add json_serializable (#8789)
* Add Dart configuration flag to set new generator

* Change templates to add json_serializable generator

* Fix dart tests

* Add custom serialization for standard generator

* this change opens us a way to allow adding more than 2 generators

* Add sample project for json_serializer

* Use basename for json field name

* Update samples with basename as json key

* Update dart generator docs

* Create AbstractDartCodegen class

* Update docs, dart-dio and dart-jaguar dont get json_serializable yet

* Deduplicate method calls

* Dix dart-dio generation

* Revert formatting change in dart mustache

* Fix formatting changes again

* Improve dart serialization documentation

specify default serializer

* Better name for cli option

* Rename default dart generator to 'native'

* Another attempt to reduce whitespace noise

* Fix api-client and api-helper

* Rename default serialization mode to include word serialization

* Remove trailing whitespace in enums
2021-02-25 17:11:16 +08:00
William Cheng
df1ae03960
[Refactor] create Python abstract class (#8817)
* create python abstract base class

* refactor AbstractPythonConnexionServerCodegen

* update doc
2021-02-25 14:10:49 +08:00
James Gilliland
f3c164d1ad
[PHP] Use a valid php type for maps (#8718)
* Use a valid php type for maps

* Convert type hint to correct format

Align map array format to that expected by phpdoc and associated tools.
2021-02-21 18:07:45 +08:00
Peter Leibiger
c916df9381
[dart][dart-dio] Nullable support/improvements (#8727)
* [dart-dio] Disable nullable fields by default

This is not in line with the OAS and will prevent future Dart nullabilty features (NNBD) from being useful as all types would be optional.
Users can still opt-in for this.

* [dart-dio] Properties are nullable when not required AND not nullable

* [dart][dart-dio] Support nullable/required fields

* properties in built_value need to be nullable when they are nullable in OAS or when they are not required in OAS
* built_value does not support serializing `null` values by default as it is based on a serialization format based on iterables/lists and not maps
* dart-dio uses the built_value json plugin to convert the built_value format to regular json
* by generating a custom serializer for each class we can add support for serializing `null` values if the property is required AND nullable in OAS
* this is a breaking change as not all properties in the models are nullable by default anymore

* Implement required/nullable for dart

* Changes for set types and enum names after rebase

* Add some comments and fix built_value fields with default being nullable

* More rebase changes and regenerate docs
2021-02-17 21:44:21 +08:00
William Cheng
55292dd22b
Add ASP.NET Core 5.0 support (#8717)
* add aspnet core 5.0 support

* skip overwriting Org.OpenAPITools.csproj

* update doc

* update doc
2021-02-17 18:58:13 +08:00
Patrick McGleenon
3c4015b897
[REQ] [GO] Added enumClassPrefix option to go-gin-server. Used same appro… (#8681)
* [REQ] Added enumClassPrefix option to go-gin-server.  Used same approach as #7008 (go-server)

	modified:   docs/generators/go-gin-server.md
	modified:   modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java
	modified:   modules/openapi-generator/src/main/resources/go-gin-server/model.mustache

* Fixed CI error in docs
2021-02-16 17:54:00 +08:00
basyskom-dege
578420cfa9
Finished paramter styling(query,path,header,cookie) (#8587) 2021-02-08 20:21:53 +08:00
Bruno Coelho
45fc02350b
[kotlin] fix Date types usages (#8594)
* [kotlin] fix Date types usages
2021-02-02 20:55:51 -05:00
Peter Leibiger
769b0e0e38
[feature][dart] Add support for uniqueItems/sets (#8375)
* [dart][dart-dio] Add support for set types

* copy `uniqueItems` usage from 2.0 fake spec to `3.0`
* add support for sets in parameters, responses and properties

* Regenerate all other samples

* Fix broken tests due to invalid cast

* Update documentation

* Regenerate samples

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-02-02 18:42:45 +08:00
Matthew Dowdell
b4154be8d0
[Rust Server] Add support for Bearer token authentication (#7840)
* [rust-server] Add support for Bearer auth

- Added bearer auth to the security features for rust server
- Supplemented the basic auth condition in the context template to handled basic auth and bearer auth separately.
- Repurpose an exising sample to confirm the code generation works as expected.

* Update docs

* Update readme for bearer tokens
2021-01-30 12:07:46 +00:00
Petr Tůma
061552f5d4
[feature][python-flask] Add CORS support to python-flask server (#8472)
* Add CORS support to python-flask server generator

* Documentation update and CORS support for other generators using the same base class

* Trivial sample changes
2021-01-29 10:54:02 +08:00
William Cheng
f6c617d09f
Add typescript-nestjs client generator (#8522)
* #3336 add nestjs generator

* #3336 add nestjs generator

* #3336 add nestjs generator

* #3336 add nestjs generator

* remove extra files from building

* Revert "remove extra files from building"

This reverts commit 7f80f961ef0cd0e50b9d2bb856a3703d5b821640.

* fix merge

* fix tests

* Add missing test client options provider for nestjs

* cleanup PRS

* fix compilation error

* remove groovy bin files;

* fix tests

* add samples

* update doc

* update samples

Co-authored-by: Victor Frank <vfrank@lumeris.com>
2021-01-26 09:34:33 +01:00
William Cheng
84813be309
remove supportJava6 option (#8514) 2021-01-26 10:27:09 +08:00
basyskom-dege
c55bee1273
[Qt][C++] Updated cpp-qt5-client doc (#8251)
* Update cpp-qt5-client.md

Added missing security feature support in the documentation

* added missing security features in doc
2021-01-25 18:26:47 +08:00
Antonio
cb530d4e75
Add .t in spec generation of Elixir structs (#8159)
* Add .t in spec generation of object types

* update samples

* Adds workaround for free-form maps with propper typespec

* Adds missing typsspec definition for structs

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Michael Ramstein <mr@cyon.ch>
2021-01-25 16:13:23 +08:00
Richard Whitehouse
5f2ca61862
[Core, Rust Server] anyOf / oneOf support for Rust Server (#6690)
* [Core] Inline Model Resolution of Enums

Enums need to be named types, so handle them as part of inline model resolution

* [Rust Server] Handle models starting with a number correctly

* [Rust Server] Additional trace

* [Rust Server] Add support for oneOf/anyOf

* [Rust Server] Update supported features

* [Rust Server] General template tidy up

* [Rust Server] Implement IntoHeaderValue for wrapped data types

* [Rust Server] Convert from string correctly

* [Rust Server] Test for anyOf/oneOf

* Update samples

* Update docs
2021-01-23 21:32:51 +00:00
William Cheng
4d75a29991
fix typo in useOneOfDiscriminatorLookup (#8480) 2021-01-20 18:51:56 +08:00
William Cheng
62eecabfa5
[csharp-netcore] add .Net 5.0 support (#8467)
* add net5.0 support to csharp-netcore client gen

* update doc

* update samples
2021-01-19 22:38:34 +08:00
Wesley A
f5b2bb5057
Implement optional powershell verb parsing (#8252)
* Implement optional powershell verb parsing #8233

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-01-07 17:41:43 +08:00
William Cheng
1df719801e
Add a new crystal client generator (beta) (#8304)
* add crytsal client generator

* update samples

* update doc

* regenerate spec

* regenerate spec

* various fixes

* test crystal in circleci

* test crystal client in drone ci

* Revert "test crystal client in drone ci"

This reverts commit 317f2cf2a09f902c08ced214e8e5802fa79c3de8.

* fix install

* fix installation

* test crystal in travis

* cache image

* add --cache-from

* update doc

* run petstore with mvn

* install crystal

* fix install crystal

* sudo mvn

* run server

* using mvnw

* fix form or body parameter

* remove crystal from circleci

* fix test

* remove cache-from

* update doc
2021-01-07 17:10:22 +08:00
Guillaume TOURBIER
9bd2a45e72
typescript-angular: add providedIn for Angular 9+ (#8324)
* feat: add providedIn for Angular 9+

Adding new option, providedIn, for generator typescript-angular
Keep providedInRoot for backward compatibility but mark as deprecated
for Angular 9+

fix: #6432

* doc: providedIn

infos about providedIn
Mark providedInRoot as deprecated

* doc: run generate-samples for typescript

using typescript-angular-v9-provided-in-any.yaml

* refactor: runned ensure-up-to-date locally

* refactor: api.module.mustache rely on providedIn too

* doc: re-generate samples
2021-01-06 15:31:41 +01:00
Luiz Felipe Stangarlin
319bd7eaa8
Add Ktorm schema generator (#7759)
* [ktorm] added support for ktorm

* [ktorm] fixed type mapping

* [ktorm] fixed foreign key

* [ktorm] added variable for the missing package import

* [ktorm] added correct templates

* [ktorm] added relationship metadata

* [ktorm] also support relationships 1:m

* [ktorm] relation to primitive naming fix

* [ktorm] updated mustache templates

* [ktorm] small fixes on templates, assigmentbuilder, docs, sql script syntax.

* fix issue, rename to ktorm-schema

* replace tabs with 4 spaces

* [ktorm] added primarykey automatic generation

* [ktorm] added tests

* [ktorm] added gradle to samples

* [ktorm] fix datatime type

* [ktorm] template fixes array and primarykey

* [ktorm][sample] regenerate

* [ktorm][sample] added manually files from kotlin-client

We inherit from baseTable, so we need those for now

* [ktorm] fix: relation column types hardcoded

* update samples

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-01-06 17:04:49 +08:00
NickPak
72869d53a3
[C][Client] Add C++ reserved keywords to C-libcurl client generator, then the C client can be compiled by C++ compiler (#8205)
* [C][Client] Add cpp reserved keywords to C-libcurl client generator

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-01-05 14:39:56 +08:00
Arthur Mogliev
206f698a98
[php-ze-ph][php-mezzio-ph] Migration from Zend to Laminas and corresponding generator rename (#8145)
* Migration from php-ze-ph to php-mezzio-ph

* Sample regen after rebase

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-12-20 21:48:37 +08:00
William Cheng
bde631c07f
[aspnetcore] Set default version to 3.1 (#8240)
* set default version to 3.1

* rename config

* update doc
2020-12-20 11:00:39 +08:00
basyskom-dege
febd65d3b8
Qt5 parameterized server (#8183)
* first Commit parameterzied Server support

* fixed serverconfig classes

* Defautl constructor f. Config, fixed regex replace

* Polosihed Templates, Added MultiServer support

* Update Readme. Fixed MultiServer. Fixed def. Value

* Passing global Server to mustache. Small fixes

* Updated  samples, fixed mustache for multi server

* added prefixes, removed unused imports

* added newly generated samples

* missing vendorExtension in mustache. Update smaple

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-12-19 11:34:12 +08:00
Peter Leibiger
e1c43f1356
[dart][dart-dio] Prevent name clashes with existing dart types (#8198)
* [dart][dart-dio] Prevent name clashes with existing dart types

Can not use dart import aliases for now as this is not supported by built_value. This means we need to add potentially clashing names/classes to an `additionalReservedWords` exclusion list. Starting with a basic list of some http/io classes.

Correctly use `importMapping` and `defaultIncludes` this time around. Improve reserved word checking.

This now successfully generates `ModelList`, `ModelFile` and `ModelClient` models which previously were not generated at all or were wrong types.

* Address review comment

* Update generator docs
2020-12-16 17:25:20 +08:00
Christophe Bornet
f2d8e3a25b
[Java/okhttp] Add dynamic operations option (#7916)
* Add dynamicOperations option to okhttp gen

* Add tests

* Add apiclient tests

* Fix apiclient template

* Add dependencies in gradle and sbt
2020-12-10 18:22:39 +08:00
William Cheng
61777b4a7c
Revise wordings for options (#8127)
* revise wordings for options

* update
2020-12-09 10:42:54 +08:00
Peter Leibiger
7fae4ab411
[dart] type improvements (#8111)
* [dart] Configure and use import mapping

This prevents models from being generated which would clash with exisiting dart types, e.g. List.

* [dart] Fix decimal format not supported

* [dart-dio] Remove redundant modelToIgnore & ignore dart:core import

* modelToIgnore is now handled via importMappings the same way other generators do this
* choose not to import dart:core as this is available by default

* [dart-dio] EnumClass is a reserved word in built_value

* Review changes

* Fix regenerate docs
2020-12-08 12:00:12 +08:00
Javier Velilla
c0c2f2b804
[Eiffel] various enhancements (#8076)
* Updated Eiffel code generator.
	Added missing language reserved words.

Updated mustache templates to use the latest Eiffel rules to avoid obsolte
feature calls and Cat-Calls.
Updated Eiffel configuration files (ecf's)
Updated comments styles.
Updated Travis CI file to use the latest Eiffel compiler.
Updated EIffel sample to use https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

* Added missing mapping decimal to REAL_64
Added Eiffel Kernel classes to importMapping to avoid generate models for
them.
Fixed issue with Eiffel feature name generation, updated toOperationId(String) method.
Simplified toInstantiationType method implementaetion.
Improved model.mustache to generate Eiffel models.

* Updated Eiffel sample.

* Removed unneeded tabs.

* Added AnyType mapping to ANY
Removed unneeded tab
Updated model name, remane models that starts with _.

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-12-07 10:07:03 +08:00
Peter Leibiger
033d985cf7
[Dart-dio] Add basic integration testing and fix compile errors (#8025)
* [dart-dio] Add basic integration test POM

This basically just fetches dependencies, runs the built_value generator and empty test cases. Even running empty test cases is more than is currently possible and at least finds compile errors.

There are compile errors atm which need to be fixed.

* [dart-dio] Fix missing BuiltSet import in models that use enums

* [dart-dio] Fix compile error when the return type is a Map

* the compile error was `serializerForType(Map<String, int>)` in `StoreApi` which needs to be  `serializerForType(Map)`
* use final instead of var in response handling

* [dart-dio] Generate docs after changes

* [dart-dio] Add integration test to CI execution list
2020-12-02 21:35:07 +08:00