@@ -4,12 +4,6 @@ import 'dart:io';
44import 'package:crypto/crypto.dart' ;
55import 'package:meta/meta.dart' ;
66
7- /// Config base class
8- /// Your annotated class must extend this config class
9- @Deprecated (
10- 'You do not need to extend this anymore (See example). This class would be removed in the next major release.' )
11- abstract class OpenapiGeneratorConfig {}
12-
137class Openapi {
148 /// Additional properties to pass to the compiler (CSV)
159 ///
@@ -26,12 +20,6 @@ class Openapi {
2620 /// --api-package
2721 final String ? apiPackage;
2822
29- /// relative path or url to spec file
30- ///
31- /// -i
32- @Deprecated ('To be removed in the next major' )
33- final String inputSpecFile;
34-
3523 /// Provides the access information to the input spec file.
3624 ///
3725 /// For use with useNextGen.
@@ -43,7 +31,7 @@ class Openapi {
4331 /// to be applied to the fetch request when the spec file is in a remote
4432 /// location. There is also special handling for when the spec file lives within
4533 /// AWS.
46- final InputSpec ? inputSpec;
34+ final InputSpec inputSpec;
4735
4836 /// folder containing the template files
4937 ///
@@ -80,12 +68,6 @@ class Openapi {
8068 /// --reserved-words-mappings
8169 final Map <String , String >? reservedWordsMappings;
8270
83- /// Tells openapi-generator to always run during the build process
84- /// if set to false (the default), openapi-generator will skip processing if the [outputDirectory] already exists
85- @Deprecated (
86- 'The generator will always run to determine if there are changes made on the input spec file' )
87- final bool ? alwaysRun;
88-
8971 /// if set to true, flutter pub get will be run on the [outputDirectory] after the code has been generated.
9072 /// Defaults to true for backwards compatibility
9173 final bool ? fetchDependencies;
@@ -122,21 +104,6 @@ class Openapi {
122104 /// e.g {'inline_object_2': 'SomethingMapped'}
123105 final Map <String , String >? inlineSchemaNameMappings;
124106
125- /// Use the next generation of the generator.
126- ///
127- /// This annotation informs the generator to use the new generator pathway.
128- /// Enabling this option allows for incremental changes to the [inputSpecFile]
129- /// to be generated even though the annotation was unchanged.
130- ///
131- /// Due to some limitations with build_runner and it only running when the
132- /// asset graph has changed, a generated line get injected at the beginning of
133- /// the file at the end of each run.
134- ///
135- /// This will become the default behaviour in the next Major version (v5).
136- ///
137- /// Default: false
138- final bool useNextGen;
139-
140107 /// The path where to store the cached copy of the specification.
141108 ///
142109 /// For use with [useNextGen] .
@@ -152,8 +119,7 @@ class Openapi {
152119 this .additionalProperties,
153120 this .overwriteExistingFiles,
154121 this .skipSpecValidation = false ,
155- @Deprecated ('To be removed in the next major' ) required this .inputSpecFile,
156- this .inputSpec,
122+ required this .inputSpec,
157123 this .templateDirectory,
158124 required this .generatorName,
159125 this .outputDirectory,
@@ -165,9 +131,7 @@ class Openapi {
165131 this .apiPackage,
166132 this .fetchDependencies = true ,
167133 this .runSourceGenOnOutput = true ,
168- this .alwaysRun = false ,
169134 this .cachePath,
170- this .useNextGen = false ,
171135 this .projectPubspecPath,
172136 this .debugLogging = false ,
173137 });
@@ -365,10 +329,13 @@ class AdditionalProperties {
365329 /// Allow the 'x-enum-values' extension for enums
366330 final bool ? useEnumExtension;
367331
368- /// With this option enabled, each enum will have a new case, 'unknown_default_open_api',
332+ /// If the server adds new enum cases, that are unknown by an old spec/client,
333+ /// the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api',
369334 /// 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;
335+ /// they can safely fallback to this case.
336+ ///
337+ /// Default: false
338+ final bool enumUnknownDefaultCase;
372339
373340 /// Flutter wrapper to use (none|flutterw|fvm)
374341 final Wrapper wrapper;
@@ -392,7 +359,7 @@ class AdditionalProperties {
392359 this .allowUnicodeIdentifiers = false ,
393360 this .ensureUniqueParams = true ,
394361 this .useEnumExtension = false ,
395- this .enumUnknownDefaultCase = true ,
362+ this .enumUnknownDefaultCase = false ,
396363 this .prependFormOrBodyParameters = false ,
397364 this .pubAuthor,
398365 this .pubAuthorEmail,
@@ -413,7 +380,7 @@ class AdditionalProperties {
413380 allowUnicodeIdentifiers: map['allowUnicodeIdentifiers' ] ?? false ,
414381 ensureUniqueParams: map['ensureUniqueParams' ] ?? true ,
415382 useEnumExtension: map['useEnumExtension' ] ?? true ,
416- enumUnknownDefaultCase: map['enumUnknownDefaultCase' ] ?? true ,
383+ enumUnknownDefaultCase: map['enumUnknownDefaultCase' ] ?? false ,
417384 prependFormOrBodyParameters:
418385 map['prependFormOrBodyParameters' ] ?? false ,
419386 pubAuthor: map['pubAuthor' ],
@@ -520,7 +487,7 @@ class DioProperties extends AdditionalProperties {
520487 bool sortModelPropertiesByRequiredFlag = true ,
521488 bool sortParamsByRequiredFlag = true ,
522489 bool useEnumExtension = true ,
523- bool enumUnknownDefaultCase = true ,
490+ bool enumUnknownDefaultCase = false ,
524491 String ? sourceFolder,
525492 Wrapper wrapper = Wrapper .none})
526493 : super (
@@ -597,7 +564,7 @@ class DioAltProperties extends AdditionalProperties {
597564 bool sortModelPropertiesByRequiredFlag = true ,
598565 bool sortParamsByRequiredFlag = true ,
599566 bool useEnumExtension = true ,
600- bool enumUnknownDefaultCase = true ,
567+ bool enumUnknownDefaultCase = false ,
601568 String ? sourceFolder,
602569 Wrapper wrapper = Wrapper .none})
603570 : super (
0 commit comments