Skip to content

Commit fb4e8e8

Browse files
committed
Merge branch 'master' into upgrade-5.0-start
2 parents 4c3e59a + a95675f commit fb4e8e8

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Annotate a dart class with @Openapi() annotation
7979
inputSpecFile: 'example/openapi-spec.yaml',
8080
generatorName: Generator.dart,
8181
outputDirectory: 'api/petstore_api')
82-
class Example extends OpenapiGeneratorConfig {}
82+
class Example {}
8383
```
8484

8585
Run
@@ -126,7 +126,7 @@ New:
126126
cachePath: 'some/preferred/directory/cache.json',
127127
useNextGen: true
128128
)
129-
class Example extends OpenapiGeneratorConfig {}
129+
class Example {}
130130
```
131131

132132
**IMPORTANT** With the new changes comes 2 new annotation properties:

openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ class AdditionalProperties {
365365
/// Allow the 'x-enum-values' extension for enums
366366
final bool? useEnumExtension;
367367

368+
/// With this option enabled, each enum will have a new case, 'unknown_default_open_api',
369+
/// so that when the server sends an enum case that is not known by the client/spec,
370+
/// they can safely fallback to this case
371+
final bool? enumUnknownDefaultCase;
372+
368373
/// Flutter wrapper to use (none|flutterw|fvm)
369374
final Wrapper wrapper;
370375

@@ -387,6 +392,7 @@ class AdditionalProperties {
387392
this.allowUnicodeIdentifiers = false,
388393
this.ensureUniqueParams = true,
389394
this.useEnumExtension = false,
395+
this.enumUnknownDefaultCase = true,
390396
this.prependFormOrBodyParameters = false,
391397
this.pubAuthor,
392398
this.pubAuthorEmail,
@@ -407,6 +413,7 @@ class AdditionalProperties {
407413
allowUnicodeIdentifiers: map['allowUnicodeIdentifiers'] ?? false,
408414
ensureUniqueParams: map['ensureUniqueParams'] ?? true,
409415
useEnumExtension: map['useEnumExtension'] ?? true,
416+
enumUnknownDefaultCase: map['enumUnknownDefaultCase'] ?? true,
410417
prependFormOrBodyParameters:
411418
map['prependFormOrBodyParameters'] ?? false,
412419
pubAuthor: map['pubAuthor'],
@@ -428,6 +435,7 @@ class AdditionalProperties {
428435
'allowUnicodeIdentifiers': allowUnicodeIdentifiers,
429436
'ensureUniqueParams': ensureUniqueParams,
430437
'useEnumExtension': useEnumExtension,
438+
'enumUnknownDefaultCase': enumUnknownDefaultCase,
431439
'prependFormOrBodyParameters': prependFormOrBodyParameters,
432440
if (pubAuthor != null) 'pubAuthor': pubAuthor,
433441
if (pubAuthorEmail != null) 'pubAuthorEmail': pubAuthorEmail,
@@ -512,6 +520,7 @@ class DioProperties extends AdditionalProperties {
512520
bool sortModelPropertiesByRequiredFlag = true,
513521
bool sortParamsByRequiredFlag = true,
514522
bool useEnumExtension = true,
523+
bool enumUnknownDefaultCase = true,
515524
String? sourceFolder,
516525
Wrapper wrapper = Wrapper.none})
517526
: super(
@@ -529,6 +538,7 @@ class DioProperties extends AdditionalProperties {
529538
sortParamsByRequiredFlag: sortParamsByRequiredFlag,
530539
sourceFolder: sourceFolder,
531540
useEnumExtension: useEnumExtension,
541+
enumUnknownDefaultCase: enumUnknownDefaultCase,
532542
wrapper: wrapper);
533543

534544
DioProperties.fromMap(Map<String, dynamic> map)
@@ -587,6 +597,7 @@ class DioAltProperties extends AdditionalProperties {
587597
bool sortModelPropertiesByRequiredFlag = true,
588598
bool sortParamsByRequiredFlag = true,
589599
bool useEnumExtension = true,
600+
bool enumUnknownDefaultCase = true,
590601
String? sourceFolder,
591602
Wrapper wrapper = Wrapper.none})
592603
: super(
@@ -604,6 +615,7 @@ class DioAltProperties extends AdditionalProperties {
604615
sortParamsByRequiredFlag: sortParamsByRequiredFlag,
605616
sourceFolder: sourceFolder,
606617
useEnumExtension: useEnumExtension,
618+
enumUnknownDefaultCase: enumUnknownDefaultCase,
607619
wrapper: wrapper);
608620

609621
DioAltProperties.fromMap(Map<String, dynamic> map)

0 commit comments

Comments
 (0)