131 Commits

Author SHA1 Message Date
Peter Leibiger
608242b4d8
[dart][dart-dio] Improve prefixing of inner enums with classname (#8685)
* [dart][dart-dio] Improve prefixing of inner enums with classname

* prevent further name conflicts by correctly naming the enum, until now there could potentially occur conflicts e.g. 2x `MapTestInnerEnum` by renaming the `items` child property
* correctly set `enumName` to match `datatypeWithEnum`

* Unrelated test regeneration
2021-02-16 17:59:54 +08:00
William Cheng
b4f4d7434b Merge remote-tracking branch 'origin/master' into 6.0.x 2021-02-12 18:48:20 +08:00
William Cheng
3e81876e2c Merge remote-tracking branch 'origin/master' into 5.1.x 2021-02-06 17:52:32 +08:00
William Cheng
c7fcb39a2d
Prepare v5.0.1 release (#8627)
* release 5.0.1

* update samples
2021-02-06 16:37:22 +08:00
William Cheng
2c457a458e Merge remote-tracking branch 'origin/5.1.x' into 6.0.x 2021-02-02 21:43:53 +08:00
William Cheng
5b99d8724c Merge remote-tracking branch 'origin/master' into 5.1.x 2021-02-02 21:04:15 +08: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
Peter Leibiger
5135967c91
[dart] Fix typo added in 57126a19 (#8581) 2021-01-30 11:32:33 +08:00
NANASHI0X74
57126a1900
Add getters for private default Headers and authentications (#8509)
* add getters for default headermap and auths

* regenerate samples, make shebangs portable

* Revert making shebangs portable

This reverts commit ec60f603598abf0f57dfdb6ca55b4d5c1ee25edf.

Co-authored-by: nanashi0x74 <rian.lindenberger@mpq.se>
2021-01-29 10:58:07 +08:00
William Cheng
694b10e41c Merge remote-tracking branch 'origin/5.1.x' into 6.0.x 2021-01-28 16:47:55 +08:00
William Cheng
d97717ee24 Merge remote-tracking branch 'origin/master' into 5.1.x 2021-01-28 15:52:44 +08:00
Peter Leibiger
201acbd3de
[dart] Fix switch on enums not possible (#8512)
All enum instances are `const` so `equals/hashCode` is not needed.
Removing this allows to `switch/case` on enum instances.
2021-01-25 18:31:19 +08:00
William Cheng
64ae0eed04 Merge remote-tracking branch 'origin/5.1.x' into 6.0.x 2021-01-09 00:15:53 +08:00
William Cheng
18bec1da28 Merge remote-tracking branch 'origin/master' into 5.1.x 2021-01-08 21:06:47 +08:00
Peter Leibiger
02473d8175
[dart] Cleanup, remove leftover inline objects/docs and regnerate tests (#8362) 2021-01-07 22:29:32 +08:00
William Cheng
25b0cbe2f1
Prepare 5.0.1 snapshot (#8249)
* update version to 5.0.1-SNAPSHOT

* update samples

* update meta codegen
2020-12-21 17:14:18 +08:00
William Cheng
4261252491 prepare 6.0.0 snapshot release 2020-12-21 16:39:40 +08:00
William Cheng
345b68a107 prepare 5.1.0 snapshot release 2020-12-21 16:35:12 +08:00
William Cheng
d7d5e53f2b
Prepare v5.0.0 release (#8247)
* update to 5.0.0

* update samples
2020-12-21 13:04:11 +08:00
William Cheng
0be3fe6104
Set skipFormModel to true by default (#8125)
* set skipFormModel to true by default

* update tests

* regenerate ruby faraday client

* remove inline object spec files

* more clean up on inline object files

* update samples
2020-12-18 23:57:19 +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
Peter Leibiger
ddd11abb87
[dart][dart-dio] Correctly type responses and futures (#8195)
* don't rely on implicit dynamics
* this is a requirement for NNBD
* add space between return type and some method names
2020-12-16 00:52:47 +08:00
Peter Leibiger
70e86a0840
[dart] Fix enums with default value (#8182)
* simplify template expression
2020-12-15 09:56:35 +08:00
Peter Leibiger
f484e0db42
[dart][dart-dio] Formatting improvements (#8180)
* always add trailing commas in arrays and break each line
* make variables final
* improve API formatting (mainly leading spaces)
* remove empty lines and whitespaces
* fix formatting of datatype and description and docs
* consistently use single quotation marks (dart already does this)
2020-12-15 09:55:33 +08:00
Peter Leibiger
e412145a1f
[dart][dart-dio] More enum fixes for inner types (#8174)
* correctly generate enums from `mostInnerItems`
* use `datatypeWithEnum` which should always be he correct type
* dart generators prefix inner enums with the classname of the containing class, ensure datatypeWithEnum always matches
2020-12-14 23:05:31 +08:00
Peter Leibiger
cd0257b0e5
[dart][dart-dio] Enum improvements (#8149)
* [dart] Always use the correct enum data type

* use raw strings for enum string values

* [dart-dio] Use raw strings for built_value enums

`@BuiltValueEnumConst` does some wierd string handling in the generated code `r'\$'` becomes `'$'`. This is different compared to the wireName in `@BuiltValueField`
2020-12-13 23:59:29 +08:00
Peter Leibiger
a93a60b6eb
[dart] Handle enumVarNames for negative names (#8143) 2020-12-10 18:59:23 +08:00
Peter Leibiger
4ad6d0bfe5
[dart] Variable/Operation/Model naming (#8123)
* [dart] Properly escape param/var names that clash with Dart types

* [dart] Add tests for var/enumVar names

* note: public and private are no keywords in Dart
* some tests are still wrong, some are commented out

* Fix typo

* [dart] Improve variable name escaping

* add more tests

* [dart] Fix operationId naming

* [dart] Fix upper case var name with leading underscore

* [dart] Correctly support model prefix/suffix

* [dart] Support spaces in property names

* Call super for empty operationId

* [dart] Fix and improve enumVar naming/generation

* use same handling for all 3 generators
* allow `updateEnumVarsWithExtensions` to have access to the data type
* improve `x-enum-values` handling and add supprt for other enum vendor extensions
* remove duplicate and outdated tests from `DartDioModelTest`
* add more tests to `DartModelTest`
* no longer force lowercase enums for plain dart generator (breaking)
* this change also removes the trailing underscore from plain dart generator (breaking)
2020-12-09 23:21:08 +08:00
Peter Leibiger
144e08b4fc
[dart] Use raw strings for json/header parameter names (#8131)
This should fix all problems related to unescaped characters in strings that are assumed to be raw - e.g. `json[r'$special[property.name]']`
2020-12-09 11:12:48 +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
Peter Leibiger
751ffad8db
[dart] Cleanup and OAS3 support (#8085)
* [dart] Cleanup and regnerate old/wrong tests and docs

* docs path seems to be doc now in all dart generators
* generated tests are very old and use wrong classes

* [dart-dio] Improve formatting

* [dart][dart-dio] Restructure tests to same layout

* remove duplicate/old openapi sample for which there is no generation config
* generate to `petstore_client_lib` for both generators
* run generated tests as integration tests for dart2 even if empty - this makes it easier to find compile errors

* [dart] Improve gitignore handling for Dart generators

* globally ignore all dart related files that should not be commited
* remove old ignores that are no longer valid

* [dart][dart-dio] Add OAS3 generation and integration tests

Dart2 doesn't compile, needs fixes.

* [dart] Do not attempt to deserialize binary content from JSON fields

Not sure if that case is ever relevant but for now there doesn't seem to be a better option.

* [dart] Fix integration tests for OAS3 petstore

Some POST operations now return 200 with content.

* [dart] Generate Petstore Fake API but don't add to integration tests yet

Explicitly not adding the new integration tests to the master POM. They do not work but having them allows for quickly iterating on open issues without breaking existing basic OAS2/OAS3 petstore examples. Instead they should be run manually until everything is fixed.
2020-12-07 21:38:39 +08:00