openapi_sdk_gen 2.6.3
openapi_sdk_gen: ^2.6.3 copied to clipboard
Package that generates REST clients and data classes from OpenApi definition file
2.6.3 #
explicit_nullsapplies only to schemas referenced from operation request bodies. Those optional nullable fields useJsonNullable<T>(undefined,of(value),of(null)).patch(Map)remains for dynamic payloads. Generatedmodels/json_nullable.dart.
2.6.2 #
explicit_nullsDTOs no longer accept PATCH/nullable fields on the public constructor (passingnullused to clear those fields). Set them viafromJsonorpatchinstead.- Add generated
patchfactory alias forexplicit_nullsjson_serializable DTOs.
2.6.1 #
- Stop treating optional properties as nullable. JSON null is recorded only when the schema allows it (
nullable,x-nullablewhenuse_x_nullableis on, or anullunion member). explicit_nullsnow tracks only those nullable fields. Other optional fields omit null, includingdynamicand wheninclude_if_nullis off.- Promote optional
List<T?>andMap<String, dynamic>fields, and optional request parameters (including ones with defaults), so the Dart type stays nullable when the value itself cannot be JSON null. - Null-check freezed validators on optional fields that were promoted to a nullable Dart type.
2.6.0 #
- Skip path-item
summary,description, and$refinstead of crashing. - Throw on circular
allOfinstead of recursing forever. - Stop treating every field as required when one property uses
allOf. - Collapse scalar
$refunions, including OpenAPI 3.1typearrays, to string typedefs. - Infer a discriminator mapping from schema names when
mappingis omitted. - Expand
allOfmultipart bodies into form parts. - Resolve
components/responses$refs before choosing the return type. - Treat
additionalProperties: trueasMap<String, dynamic>. - Keep inherited field requiredness on a single-
$refallOfwrapper. - Keep
$refs pointed at the schema whose key was actually renamed when two names share a PascalCase form. - Decode optional nested
explicit_nullsfields in json_serializable instead of passing the raw JSON value through_omit. - Escape
$,\, and'inexplicit_nullsJSON key lookups. - Promote optional dart_mappable fields to nullable, and stop marking optional union properties as required.
- Apply
include_if_nullto optional fields that were promoted to nullable. - Return the wire type from dart_mappable enum
toJson(). - Keep the original JSON on freezed fallback union variants, and rename factory names that are Dart keywords.
- Keep Retrofit parameters that share a name by suffixing later ones with their location.
- Omit the generated-file banner when
mark_files_as_generatedis false. - Exit 2 when any schema fails to generate.
2.5.3 #
- Generate string typedefs for scalar unions (
anyOfstring|integer andtype: ["string", "number"]) instead of empty classes ordynamic.
2.5.2 #
- Fix literal default values on nullable
$refproperties that point at non-enum schemas.
2.5.1 #
- Fix literal default values on
$refproperties that point at non-enum schemas. - Fix
_omitsentinel placement so it is emitted after thepartdirective inexplicit_nullsjson_serializable DTOs.
2.5.0 #
- Add
explicit_nullsso optional fields keep PATCH omit-vs-null semantics in json_serializabletoJson().
2.4.0 #
- Fix json_serializable union deserializers to match non-string discriminator value.
2.3.2 #
- Fix discriminated and undiscriminated union wrapper classes to honor
include_if_nullannotations on nullable fields.
2.2.0 #
- Fix handle nullable multipart properties, byte-as-string type mapping, and enum keyword protection.
- Fix remove Base64Converter from all templates, update golden files for byte-as-String.
- Fix enum toJson returns raw type instead of String for non-string enums.
2.0.4 #
- Add support for Rust
serde(tag = 'discriminator_key')discriminator pattern of enums - Add support for
x-enum-varnamesextension (OpenAPI Generator style custom enum names) - Add support for
x-enum-descriptionsextension (doc comments for enum values) - Fix enum default value resolution when using
x-enumNamesorx-enum-varnames
2.0.3 #
- Fix missing
@JsonKey/@MappableFieldannotation when field names are renamed due to Dart reserved word conflicts in discriminated/undiscriminated union wrapper classes
2.2.0 #
- Support for Rust/utoipa discriminator pattern in
oneOfschemas- Detects
oneOfwithallOfitems containing$ref+ anonymous discriminator object - Automatically extracts discriminator property from inline objects with single-value enums
- Generates proper sealed/union classes for utoipa-style OpenAPI specs
- Detects
- Code formatting with
dart_style(page_width: 80, trailing_commas: preserve)
2.1.0 #
- SSE streaming support via
text/event-streamcontent type - Binary streaming via
application/octet-streamorx-streaming: true - Auto-detect discriminator for
oneOf/anyOffrom single-value enum properties - Simplified union class names (removed "Union" suffix and typedef wrapper)
2.0.2 #
- Packages updated
- Documentation improvements
2.0.1 #
- Minor documentation fixes
2.0.0 #
Complete Rework #
Complete rework and refactor of swagger_parser with enhanced architecture, improved code organization, better maintainability and extensibility.
Removed Features #
The following features are no longer available:
- Kotlin Support (
languageparameter): Multi-language support removed. Package now focuses exclusively on Dart code generation. - Replacement Rules (
replacement_rulesparameter): Regex-based name transformation removed in favor of improved automatic naming and conflict resolution. The generator now provides stable, predictable naming with built-in conflict detection and resolution, eliminating the need for user-defined regex transformations. Update your OpenAPI schema with proper component names instead of relying on post-generation transformations.
Simplified Configuration #
The following configuration options have been removed as they are now handled automatically with better defaults:
use_freezed3: Removed. Freezed 3.x is now the standard version supported.use_multipart_file: Removed. File types are now handled automatically:MultipartFilefor multipart requests,Uint8Listfor binary data in regular requests/responses. The dart:ioFiletype is no longer used.enums_to_json: Removed. Enum serialization now follows standard serializer patterns automatically.enums_parent_prefix: Removed. Enum naming follows standard Dart conventions.dart_mappable_convenient_when: Removed. Use Dart 3+ pattern matching instead of legacy when/maybeWhen methods.fallback_clientrenamed todefault_client: More intuitive naming for the client handling untagged endpoints.
Changed Defaults #
use_x_nullable: Changed fromfalsetotrue(now respectsx-nullableextension by default)export_file: Changed fromtruetofalse
Migration Notes #
replacement_rules: The improved automatic naming system now handles name normalization and conflict resolution consistently. If you relied on replacement rules, update your OpenAPI schema component names to match your desired output. This ensures stable, predictable code generation.language: kotlin: If you need Kotlin generation, consider using a Kotlin-specific OpenAPI generator such as openapi-generator.- Most other configurations will work without changes
1.34.0 #
- includeIfNull handling, turned off by default, use include_if_null=true to enable
1.33.0 #
- Support correct processing of nested allOf classes
1.32.1 #
- Fix CHANGELOG duplication
1.32.0 #
- Add complete sealed classes(
oneOf/anyOf) support forjson_serializebleserializer- WARNING: Undiscriminated sealed classes use O(n) try-catch deserialization where n is the number of variants
- RECOMMENDED: Add discriminator properties to your OpenAPI specification for O(1) performance
- Add support for sealed classes fallback for failed decoding
- Add complete sealed classes(
oneOf/anyOf) support fordart_mappableserializer- WARNING: Undiscriminated sealed classes use O(n) try-catch deserialization where n is the number of variants
- RECOMMENDED: Add discriminator properties to your OpenAPI specification for O(1) performance
- Add support for sealed classes fallback for failed decoding
- Add
dart_mappable_convenient_whenoption to control union type generation fordart_mappableserializerdart_mappable_convenient_when: true- generates legacywhen<T>, maybeWhen<T>methodsdart_mappable_convenient_when: false(default) - generates sealed classes for better type safety
- Add
@Deprecated()annotation towhen<T>, maybeWhen<T>method with dart_mappable. Use dart pattern matching - Fix creating duplicated
unknownproperty enum with dart_mappable andunknown_enum_value: true - Fix for handle nullable discriminator unions properly
1.30.1 #
- Fix resolve inline schemas nested within tagged operations
1.30.0 #
- Add support for merging all generated code into single output file using the
merge_outputsoption
1.29.0 #
Features #
- Add support for non-discriminated unions (
oneOf/anyOfwithout a discriminator) - Filter out unused schemas when using
include_tagsorexclude_tags
Fixes #
- Fix the client name for untagged paths to properly fall back to the configured
fallback_clientinstead ofclient - Fix the
fallback_clientconfiguration to default tofallbackinstead ofdefaultto avoid conflicts with the Dartdefaultkeyword in the generated code - Fix OpenAPI spec parsing to correctly preserve casing for
SCREAMING_SNAKE_CASE - Fix filtering so paths without tags are filtered out when
include_tagsis specified
1.28.0 #
- Fix documentation
- Fix ensure consistent file naming for tags with alphanumeric suffixes
1.27.0 #
- Allow to filter the generation of endpoints in a client by tags
- Allow to define a fallback client for endpoints that do not have a tag - fixes [#271]
1.26.4 #
- Allow the use of single MultipartFile arguments in multipart requests (requires retrofit_generator 10.0.1 or later)
1.26.3 #
- Fix for the bug when untagged endpoints and tagged as
Clientwill override each other which results inClienttagged overwritten during file creation
1.26.2 #
- align default value handling for parameters according to OpenAPi Spec https://swagger.io/docs/specification/v3_0/describing-parameters/#default-parameter-values
1.26.1 #
- dart_mappable toString override
- dart_mappable toJson return string
1.26.0 #
- Add support for Freezed fallbackUnion parameter
1.25.1 #
- Fix broken dart_mappable enum
1.25.0 #
- Allow using
MultipartFileinstead ofFilein multipart requests, to support usage on web.
1.24.6 #
- proper handling of binary responses aka file downloads, picked up from https://github.com/trevorwang/retrofit.dart/issues/503
1.24.5 #
- enum
toString()override implementation to provide a json value for third party consumers like retrofit
1.24.4 #
- added generation of getter $valuesDefined to automatically filter out unknown values useful when we would like to list only values that we are aware about
1.24.3 #
- Fixes
allOfcase when a mix ofrefandpropertiescould unintentionally result in naming overlap now we are deduplicating properties by name
1.24.2 #
- Fixes
typedeftransparency which results in import errors when generatingjson_serializableclasses read more details here https://github.com/google/json_serializable.dart/issues/1124
1.24.0 #
- Fix detection of nullable list with non null items vs nullable list with nullable items(#323)
- Bump Dart SDK to 3.6
1.23.1 #
- Update dart_mappable template
1.23.0 #
1.22.1 #
- Add supports for freezed 3
1.21.4 #
1.20.1 #
- Fixed errors with config parsing
1.20.0 #
- Add validation params to generated
freezedclasses - Fixed errors with empty schema properties(#280)
1.19.2 #
1.19.0 #
- Add version getter to root client:
final version = RestClient.version;
- Add
dio_options_parameter_by_default
1.18.3 #
- Remove support of BigInt in Dart for
int64types
1.18.2 #
- Added support for
int64types
1.18.0 #
- Handle empty enum value case (#238)
- Some fixes for the replacement rules
- Support for nullable lists and maps
- Remove config parameter
required_by_default, behaviour is now consistentrequired_by_default: false - Requires Dart 3.4
1.17.3 #
1.17.2 #
- Add
MappableFieldto dart_mappable template
1.17.0 #
- Add new config parameter
extras_parameter_by_defaultfrom retrofit 4.1.0 for (#208) - Fixed errors (#190), (#192) and (#195)
1.16.4 #
- Fixed errors with
required_by_default
1.16.3 #
1.16.2 #
- Add new exceptions to export
- Fixed file name from
schemeUrl
1.16.1 #
- Fix swagger_parser_pages (https://carapacik.github.io/swagger_parser)
1.16.0 #
- Wrapping collections variable introduced replacing arrayDepth and mapType: this variable presents a list of all collections wrapping a type and will resolve them in order of appearance (#128)
- Fixed error with
required_by_default(#168) - Refactor config and rename parameters:
squash_clientstomerge_clientsenums_prefixtoenums_parent_prefixskipp_parameterstoskipped_parameters
- Remove config parameter
put_in_folder
1.15.4 #
- Fix docs
1.15.0 #
- Add new config parameter
required_by_default - Added template for E2E tests
1.14.1 #
- Removed check that would avoid generating a map when additional properties has a
$refvalue
1.14.0 #
- Fixed error with empty content type
- Fixed retrofit template
- Remove special characters from tags
- Add new config parameter
skip_parameters - Extract schemes from url (#150)
1.13.0 #
- Added support for dart_mappable
- Changed
freezedschema property tojson_serializer, which can be set tofreezed,dart_mappableorjson_serializable(default). - Fixed enum generation name that are defined inside an array
1.12.0 #
- Add new config parameter
export_file
1.11.3 #
- Fixed error with annotating client methods with the first specified content type header in OpenAPI V2 schemes if the specified one is not the default.
1.11.2 #
- Add description of request parameters to the code docs
1.11.1 #
- Fixed ref component being wrongly labeled as map
- Fixed map components being assigned an import despite not needing one
1.11.0 #
1.10.2 #
- Fix error in
bodywith name in dart template
1.10.0 #
- Support for generating schemes by url (see example)
- Add new config parameter
schema_url - Add new config parameter
schema_from_url_to_file - Add new config parameter
prefer_schema_source
1.9.1 #
- Handling incorrect names for classes, enums and methods.
- Additional name for unnamed models (#98)
- Support for
deprecatedannotations for methods
1.9.0 #
1.8.0 #
- Multiple schemes support (see example)
- Support for specifying nullable types via anyOf
- Edit root client template
- Add new config parameter
root_client_name - Add new config parameter
name - Add new config parameter
put_in_folder - Add new config parameter
squash_clients - Rename
root_interfacetoroot_client - Rename
squish_clientstoput_clients_in_folder
1.7.0 #
- Add new config parameter
mark_files_as_generated - Support of default values for ref enum types
- Type support in one-element allOf, anyOf and oneOf
1.6.2 #
- Fix grouping words for abbreviations when special characters are present
- Fix replacement type for enum classes
- Takes case in replacement
1.6.1 #
- Add summary of the methods to the code docs
- Fix indents for multiline code docs
- Add support for root client code docs
1.6.0 #
- Add new config parameter
path_method_name
1.5.0 #
- Requires Dart 3.0 or later
1.4.0 #
1.3.4 #
- Enum prefix only for variable type now
1.3.2 #
- Fix error with replacement rules in allOf
1.3.0 #
- Add possibility to add enum prefix from parent component (#29). Change
enums_prefixto true to enable this option
1.2.4 #
- Fixed names for negative enum values
1.2.1 #
- Updated
retrofit_generatordependency to 7.0.8 and added config option to generate.toJson()methods in enums (retrofit_generatorwill use.toJson()instead of.namein this case)
1.2.0 #
- Updated
retrofit_generatordependency to 7.0.7 and consequently removed unused.toJson()generated methods in enums
1.1.0 #
- Add regex replacement for generated class names
- Fixed error with null raw parameter in OpenApi v2 (#63)
1.0.4 #
1.0.3 #
- Fixed error with default value in dart json_serializable generation
1.0.0+1 #
- Add
root_interfaceoption to web interface - Add topics
1.0.0 #
- Require Dart >= 2.19
- Add support for
descriptionannotation - Add
root_interfaceoption to generate root interface for all Clients - Refactor code related to
nullable
0.10.3 #
- Now uses
refto identify return type of client method iftypealso exists
0.10.2 #
defaultValuein dart class now generates in constructor- Fixed error with empty
client_postfix
0.10.1 #
- Fixed error with
serversin requests (#32) - Use
operationIdfor method name(if such a field exists)
0.10.0 #
- Fixed error with
enumvalues not parsed in object properties - Use 2xx codes if code 200 not found
nullabletypes are now supported
0.9.1 #
- Use
JsonEnumandJsonValueon generated enum
0.9.0 #
- Single ref sibling elements are now defined as typedefs instead of generating excess classes
- Fixed error with
Nulltype with empty type in schema
0.8.0 #
- Support for dio 5
- Downgraded the lower bound of dependencies to support Flutter 3.0
- Complete templates for Kotlin
0.7.0 #
- Fixed error with import for
Filetype - Add support for
additionalPropertiesannotations - Fixed templates
- Fixed error with yaml files
0.6.4 #
- Update example
- Remove
implicit_dynamicfield for analyzer
0.6.3 #
- Fixed error with return type in rest client
0.6.2 #
- Update docs
0.6.1 #
- Fixed error with Multipart file type in retrofit
- Update dart api docs
- Update web interface
0.6.0 #
- Add support for
yamlfiles - BREAKING: Rename
json_pathin pubspec.yaml toschema_path
0.5.1 #
- Fixed problem with default value in freezed template
0.5.0 #
- Objects are now recognized and are being generated as DTOs
- Fixed some problems with defaultValue
- Fixed some problems with return type
- Fixed some problems with naming parameters whose names are similar to dart keywords
0.4.1 #
- Fixed a problem with parameters whose names are similar to dart keywords
- Fixed a problem with postfix in file import
0.4.0 #
- Add support for
defaultannotations - Add enum support for dart
- Fixed errors with Multipart
- Fixed errors with Kotlin types
0.3.1 #
- Fixed error with
@in url path - Fixed the problem with
numbertype to mapdouble - Fixed the problem with
objecttype to map DartObject - Updates the README with instructions and steps to generate the code
0.3.0 #
- Add support for
requiredannotations - Fixed error with rest client parameters type in OpenApi v2
0.2.4 #
- Fixed error with
.and,in url path
0.2.3 #
- Fixed error in MultiPart with single
$ref
0.2.2 #
- Remove swagger_parser section from pubspec.yaml
- Update dependencies in example
0.2.1 #
- Fixed README
- Fixed workflow files
0.2.0 #
- Fixed errors with generation of data classes containing
allOf - Fixed errors with templates
- Add web interface for package https://carapacik.github.io/swagger_parser
- Add generator tests
0.1.0 #
- Initial release