50 Commits

Author SHA1 Message Date
William Cheng
0f8b0edfad fix dart openapi-generator version 2020-04-21 10:09:42 +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
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
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
Åsmund Grammeltvedt
a8015ad8c1 [typescript] Make additional properties access safer (#5207)
* [typescript-fetch] Make additional properties access safer

Instead of asserting that any key access returns a valid property, force
the consumer to check that the value is defined.

* Update tests

* Put null-safe additional props behind and flag and share

* Undo over copy

* Update docs

* Rearrange code

* Move to unit tests
2020-02-10 07:47:29 +01:00
Jim Schubert
607f5a1c0a
[core] Move overwrite ownership to SupportingFile (#5036)
* [core] Move overwrite ownership to SupportingFile

Previously, there was a writeOptional method in DefaultCodegen which
allowed *Codegen instances to immediately write out a supporting file if
it did not exist. This would allow a codegen implementation to skip
user-facing options such as definitions in .openapi-codegen-ignore, the
"supportingFiles" system property, and support for the experimental
handlebars templating engine. While our implementation only modified the
supportingFiles list conditionally, it added confusion as it seemed to
imply that file writes were somewhat the responsibility of
DefaultCodgen (it's DefaultGenerator which handles file manipulation).

This commit moves the definition of whether a file supports overwriting
existing files into the SupportingFile type itself, allowing that
functionality to be determined at time-of-write rather than
time-of-definition. This would allow us, for example, to dump the list
of files which would be generated using a --dry-run option or similar.

This will be a breaking change for anyone who has extended
DefaultCodegen and called "writeOptional". The path to migrate is to add
the SupportingFile to the supportingFiles list and chain the method call
`.doNotOverwrite()` on the instance.

This has the added benefit of clarifying this behavior, considering the
write behavior wasn't previously "optional" writes but optionally
defining the list of supportingFiles based on the state of the file
system.

* [samples] Regenerated
2020-01-29 18:26:39 -05:00
William Cheng
82e2448bf2 Merge remote-tracking branch 'origin/4.3.x' into 5.0.x 2020-01-20 15:46:13 +08:00
William Cheng
04af5e0445 Merge remote-tracking branch 'origin/master' into 4.3.x 2020-01-20 15:04:34 +08:00
Jim Schubert
78bf3adc4a
[core] Initial FeatureSet structures and definitions (#3614)
[core] Initial FeatureSet structures and definitions
Add default feature set to DefaultCodegen
Initial FeatureSet definitions for:

*  ada 
*  android 
*  apache2 
*  asciidoc 
*  aspnetcore 
*  avro 
*  bash 
*  c 
*  clojure 
*  cpp-pistache-server 
*  cpp-qt5-client 
*  cpp-qt5-qhttpengine-server 
*  cpp-restbed-server 
*  cpp-restsdk 
*  cpp-tizen 
*  csharp 
*  csharp-nancyfx 
*  csharp-netcore 
*  cwiki 
*  dart 
*  eiffel 
*  elixir 
*  elm 
*  erlang 
*  flash 
*  fsharp-functions 
*  go  Client/Server
*  graphql-nodejs-express-server 
*  graphql-schema 
*  groovy 
*  haskell 
*  haskell-http-client 
*  java 
*  jmeter 
*  kotlin 
*  kotlin vertx 
*  kotlin-server 
*  kotlin-spring 
*  lua 
*  mysql 
*  nim 
*  nodejs 
*  nodejs-express 
*  objc 
*  ocaml 
*  openapi 
*  openapi-yaml 
*  perl 
*  php 
*  php-laravel 
*  php-lumen 
*  php-silex 
*  php-slim 
*  php-symfony 
*  php-ze-ph 
*  powershell 
*  protobuf 
*  protobuf-schema 
*  python 
*  python-aiohttp 
*  python-blueplanet 
*  python-experimental 
*  r 
*  ror 
*  ruby 
*  ruby 
*  ruby-sinatra 
*  rust 
*  scala-akka 
*  scala-finch 
*  scala-gatling 
*  scala-http-client 
*  scala-lagom 
*  scala-play 
*  scalatra 
*  scalaz 
*  spring 
*  static docs 
*  swift 
*  typescript
2020-01-11 16:20:47 -05:00
Jim Schubert
ec1e9a4c9b
[csharp] enum suffix changes enumValueNameSuffix to enumValueSuffix (#4927)
* [csharp] Change enum value suffix name

'enumValueNameSuffix' and 'enumNameSuffix' were introduced in a recent
commit. This changes 'enumValueNameSuffix' to 'enumValueSuffix' to
better differentiate between the two options. This also adds a caveat to
the default description which explains that this flexibility may cause
issues when used by client generator.

* [csharp][aspnetcore] Regenerate samples
2020-01-05 16:18:19 -05:00
William Cheng
165a9e0508 Merge remote-tracking branch 'origin/4.3.x' into 5.0.x 2019-12-20 20:52:27 +08:00
William Cheng
cded5f9cf3 update dart samples 2019-12-20 20:51:46 +08:00
William Cheng
531dc30917 Merge remote-tracking branch 'origin/master' into 4.3.x 2019-12-20 20:38:49 +08:00
Jim Schubert
399e73e5d8 [samples] Fix --batch option for slim4/feign and regenerate (#4810) 2019-12-17 16:21:58 +08:00
William Cheng
4ed742b6bc update samples 2019-11-21 15:24:13 +08:00
William Cheng
facabd4472 Merge branch '4.3.x' into 5.0.x 2019-11-21 15:19:31 +08:00
William Cheng
60f4de0f22 Merge remote-tracking branch 'origin/master' into 4.3.x 2019-11-20 18:15:22 +08:00
Mikle
2838db2052 Add HEAD method to ApiClient of dart codegen (#4504)
* add HEAD method to ApiClient of dart codegen

* update samples
2019-11-20 11:52:57 +08:00
William Cheng
f07b3e0521
Prepare 4.2.2-SNAPSHOT (#4497)
* update to 4.2.2-SNAPSHOT

* update doc

* update samples

* skip ocaml test

* update version

* fix version
2019-11-15 21:34:25 +08:00
Jim Schubert
4a91e62fb7 [ci] Setting ensure-up-to-date to use batch option in CircleCI (#4445)
* [build] Enable --batch option in ensure-up-to-date

* [samples] Regenerate

* [ci] Use --batch in CircleCI script
2019-11-13 18:06:14 +08:00
wing328
54151891cc Merge branch 'master' into 5.0.x 2019-10-17 11:18:57 +08:00
Jim Schubert
54d7e8c488
[CLI] Initial implementation for batch generation (#3789)
* [CLI] Initial implementation for batch generation

Allows for generating multiple outputs via config. Just specify multiple
config files on command line.

Intent for this is to reduce CI times to generate outputs as well as to
reduce time for users to run ensure-up-to-date to meet PR standards.

Example command:

  openapi-generator batch --includes-base-dir `pwd` --fail-fast  -- bin/ci/*

---

As part of this implementation, the batch command support a customized
JSON key, `!include`. If this key's value refers to an existing file,
that file's contents are "unwrapped" into the config during
deserialization. This allows us to easily point to the same configs used
by our sample scripts without modifying the CLI generate task's switches
or assumptions.

* Allow for path-relative outputs
* Add batch JSON objects
* Include INFO log about threads used and includes/root
* Ensure GlobalSettings.reset()
* Improved thread-safety of ModelUtils
2019-10-09 12:51:52 -04:00
Nick Meinhold
41acae19e4 Dart fix template tests (#4015)
* Clean up samples directory before fixing tests

- removed from samples/client/petstore/dart2 :
  - purge_test.sh (doesn't seem to be used and not helpful)
  - openapi folder (is to be re-generated with more meaningful name)
- updated dart2-petstore.sh to generate client library with new name
- used updated shell script to re-generate client library
- updated CI/.drone.yml to use the new client library for tests

* Update petstore tests to use faked http client

- skipped all of the tests that hit a live endpoint
- made a fake http client that can be set to check for expected values
   and/or return a provided response
- added some files with test data recorded from live api calls
- updated the README to reflect changes to tests

* Update .drone.yml so CI will run the tests
2019-10-02 11:16:05 +08:00
William Cheng
ea029b4029
update doc, samples (#3875) 2019-09-11 21:17:11 +08:00
William Cheng
3ebefccfa9
Prepare v4.1.2 release (#3873)
* update samples

* update date
2019-09-11 18:33:27 +08:00
Austin Adams
096f2d0fc8 Adds Http Info To Dart Api (#3851) 2019-09-07 16:31:52 +08:00
Quim Muntal
8f13b88ed9 Support custom git repository (#3757)
* add gitHost param to GeneratorSettings and related

* parameterize gitHost in READMEs

* parameterize gitHost in go.mod

* parameterize gitHost in git_push

* update petstore samples

* run ./bin/utils/export_docs_generators.sh

* run meta-codehen.sh

* Revert "run meta-codehen.sh"

This reverts commit d6d579f6159186531257cdfdd73b9caf9e9ffeba.

* Revert "run ./bin/utils/export_docs_generators.sh"

This reverts commit 1b81538198d4319fd1b4e97447303e3cc0e8dc99.

* Revert "update petstore samples"

This reverts commit f513add88396707f6991ae2e4920359583ec88f1.

* run ensure-up-to-date
2019-09-03 21:35:49 +08:00
Nick Meinhold
3be1196264 [Dart] Fix README template and update testing doco (#3809)
* [Dart] Fix README template and update testing doco

- deleted redundant shell script
- fixed and updated README template
- updated test package and moved to a dev_dependency
- removed old unused dev_dependency packages
- updated testing documentation in petstore sample

* Remove references to dart-flutter-petstore.sh

* Fix typos

* Fix typo
2019-09-03 08:51:43 +08:00
Nick Meinhold
f25c6da856 Don't create redundant samples (#3800)
- removed lines in dart2-petstore.sh that create redundant samples
- deleted all dart2 samples
- ran dart2-petstore.sh to create only openapi sample
2019-08-30 12:02:26 +08:00
William Cheng
8236424aff
Fix Dart2 default template (#3790)
* fix dart2 default template

* update dart samples
2019-08-29 15:10:19 +08:00
William Cheng
d0d545bbdd
Prepare 4.1.2 snapshot (#3758)
* update pom

* update samples

* update ts axios samples
2019-08-26 22:13:12 +08:00
William Cheng
136c1407ac
Move tests to Drone.io CI (#3754)
* move tests to drone.io

* ls dir

* debug

* use bash

* use jdk 11 image

* move tests to drone.io

* use maven wrapper

* comment out scripts in circleci

* update dart samples

* remove commented tests

* update dart samples
2019-08-26 00:35:51 +08:00
Nick Meinhold
a05f68431a [Dart] Avoid redundant null checking in fromJson (#3632)
* Move dart null checks inside mustache type checks

- removed surrounding null check
- added a conditional expression to each case except the redundant one

* Run shell scripts so CIs can verify the change
2019-08-25 01:16:32 +08:00
Nick Meinhold
ba65f675e2 [Dart] Make clients crossplatform (#3608)
* Remove browserClient flag and bump http dependency

* Run shell scripts so CIs can verify the change
2019-08-13 15:35:00 +08:00
Paul Mundt
4b0fc3013f [dart2] Fix up test code generation, double deserialization, 'new' keyword deprecation (#3576)
* dart2: Use the correct classname in test generation

At present test generation has a stray hard-coded reference to the pet
store Pet() class, which should reflect the actual classname under test.

* dart2: Call toDouble() in generated code for double types

At present the generated code does not correctly handle transitioning
to double when dealing with non-integer types in JSON deserialization.
This ends up with dart raising an unhandled type mismatch exception:

Unhandled exception: type 'int' is not a subtype of type 'double' where
...

Using the .toDouble() conversion when a double type is expected fixes
this up by making the typing explicit.

* dart2: Drop use of deprecated 'new' keyword in generated code

The use of the 'new' keyword in dart2 is deprecated and should be
avoided, as per the official guidance of the dart2 authors:

https://dart.dev/guides/language/effective-dart/usage#dont-use-new

* dart2: Regenerate samples for mustache template changes
2019-08-09 00:15:45 +08:00
William Cheng
b88b1d656a
Add auto-generated tests and travis config to Dart clients (#3006)
* add auto-generated tests and travis config for dart

* improve tests

* fix tests

* add test, travis files to dart jaguar generator
2019-05-27 18:44:57 +08:00
William Cheng
2bc9592bd5
Revert "Add auto-generated tests and travis config to Dart clients (#2909)" (#3001)
This reverts commit dfda6655ec4add93b03bf351287286523cb53e97.
2019-05-26 01:50:31 +08:00
William Cheng
dfda6655ec
Add auto-generated tests and travis config to Dart clients (#2909)
* add auto-generated tests and travis config for dart

* improve tests

* fix tests
2019-05-25 22:52:30 +08:00
Alexis Yushin
4b414d81d4 dart2: Do not add non-nullable fields to model json (#2777)
* do not add non-nullable fields to model json

This fix would avoid adding and sending fields that are not isNullable in the request.

* updated sample for issue #2535
2019-05-02 16:31:38 +08:00
Paul Mundt
c08c45de05 dart2 linter updates for prefer_equal_for_default_values, prefer_is_empty (#2654)
* Use isNotEmpty instead of length in dart2 validity checks

In dart2 the preferred method of checking whether an object is empty or
not is to use the .isNotEmpty property. An aspect that is now warned
about by the linter.

While not an issue in this particular case - testing length can also
have negative performance implications for Iterable collections, which
are not required to know or provide their length deterministically.

* Prefer equals for default values in dart2

The dart2 linter complains about m({a: 1}) style assignments, preferring
m({a = 1}) instead. Update the api_client generation to follow this.

* Regenerate dart2 samples for mustache template changes
2019-04-17 10:57:06 +08:00
Dale King
d93fd31bb1 [dart] Fix authentication for dart (#2419)
* [dart] Fix authentication so all forms of Swagger 2.0 authentication work

* Run changes on petstore examples

* Amend dart2 generated README to cover basic authentication

* Amend dart2 generated README to cover authentication methods

* [dart] Fix authentication so all forms of Swagger 2.0 authentication work

* Run changes on petstore examples
2019-03-19 10:08:43 +08:00
d3v-cl
49b15ee518 Dart queryargs (#2250)
* [DART2]: fix encoding query args

* [DART]fix: url encode query arguments

* [DART][DART2]feat: rebuild petstore
2019-03-07 15:52:34 +08:00
d3v-cl
bc6997f0e5 [DART2]: fix Map<String, nativeType> fromJson (#1936) 2019-01-25 10:54:46 +08:00
d3v-cl
9ccf872290 [DART] fix: set fields to null if json value is null. (#1798)
* fix: set fields to null if json value is null.

* rebuild dart2 petstore

* rebuild dart petstore

* rebuild petstore

* [DART]fix: set fields to null if json value is null.
2019-01-09 00:26:46 +08:00
William Cheng
22049db8c1
fix enum value, update dart petstore samples (#1193) 2018-10-09 07:08:04 +08:00
ircecho
58e43ceeec [DART2] Maps could not be deserialized in dart 2 (#1007)
* fix[dart2]: due to stronger type checking in dart 2, maps could not be deserialized

* rebuild dart2 petstore
2018-09-14 18:40:37 +08:00
ircecho
6a1e560540 fix[dart2]: improved error reporting (#1006)
* fix[dart]: improved error reporting

* rebuilt dart2 petstore

* rebuilt dart2 petstore with dartfmt
2018-09-11 00:14:50 +08:00
William Cheng
d9400caf69
Set Dart2 as default, better format Dart code with dartfmt (#949)
* change dart default to v2

* add dart2 author

* add dartfmt to postProcess file in dart generator

* add dartfmt to format dart code
2018-09-02 17:59:42 +08:00
Yimin Lin
d327c5be46 [Dart 2] Add support for Dart 2 (#754)
* Add an option for Dart2

* add dart2 samples, update travis

* fix dart installation

* Upper constraints on the SDK version

* Update dependencies

* supportDart2 option can now be passed through --additional-properties

* Update petstore tests

* Update dart2-petstore.sh

* Running tests on Dart VM

* Fixed JSON deserialization bugs

* Fixed missing initialization of postBody

* Run bin/dart2-petstore.sh to regenerate libraries

* Update pom.xml

* Added SDK version constraints in pubspec.mustache

* Run bin/dart2-petstore.sh to regenerate libraries

* move dart2 test to the end
2018-09-01 01:49:18 +08:00