swagger_parser 1.44.1
swagger_parser: ^1.44.1 copied to clipboard
Package that generates REST clients and data classes from OpenApi definition file
1.44.1 #
- Fixes
dart_mappableenum generation for JSON Schema type lists by quoting non-numeric JSON values (#468).
1.44.0 #
- Adds
preserve_schema_casingoption to preserve original casing of schema-derived identifiers, defaults tofalsefor backwards compatibility, which normalises to PascalCase. - Fixes crash when a
multipart/form-datarequest body references a schema withoutproperties. - Fixes nullable handling for single-element
allOf,oneOf, andanyOfschemas with siblingnullable: true. - Fixes missing imports for nested union properties in Freezed discriminated-union variants.
1.43.1 #
- Fixes escaping
$unknownin generated enumtoJsonerror messages. - Fixes generated code when using
json_serializable. - Fixes default enum values for
dart_mappable. - Adds README section about Server-Sent Events.
1.43.0 #
- Allows standard dart_mappable serializer method naming convention.
- Fixes default values for Enums in forms.
- Fixes errors with corrector.
1.42.0 #
- Adds support for streaming & SSE.
- Fixes preserve property names and required modifiers in properties blocks.
- Fixes API path definitions are incorrectly converted to PascalCase.
1.41.0 #
- Adds
field_parsersoption for setting field parsers for JSON serializable.
1.40.0 #
- Adds
include_pathsoption for filtering endpoints by paths. - Adds
generate_urls_constantsoption for generating URL constants for all endpoints.
1.39.1 #
- Fixes client methods returning
ModelNameUnioninstead ofModelNameSealedfor oneOf types (#393).
1.39.0 #
- Handles request body name generation case when request body is declared within request.
- Fixes incorrect deserialization syntax for undiscriminated unions (Freezed serializer).
1.38.0 #
- Adds
replacement_rules_for_raw_schemaoption for raw schema objects replacement rules.
1.37.0 #
- Adds
use_flutter_computeoption for Flutter isolate-based multithreading support.- Generates
@RestApi(parser: Parser.FlutterCompute)annotation in Retrofit clients. - Generates top-level serialization functions in each DTO model file following Retrofit's naming convention.
- Works with all serializers:
freezed,json_serializable,dart_mappable.
- Generates
swagger_parser:
use_flutter_compute: true
1.36.0 #
- Adds
add_openapi_metadata(defaultfalse) to generate OpenAPItags,operationId, andexternalDocsUrlconstants for each endpoint; whenextras_parameter_by_defaultistrue, the metadata is also prefilled into Dioextras—handy for interceptors and logging without overwriting user-supplied extras. - Uses fully-qualified default extras values (e.g.
BannerApi.findAllBannersOpenapiExtras) so generated implementations can access the static metadata constants.
swagger_parser:
extras_parameter_by_default: true
add_openapi_metadata: true
abstract class PetsClient {
static const Map<String, dynamic> listPetsOpenapiExtras =
<String, dynamic>{
'openapi': <String, dynamic>{
'tags': <String>['pets'],
'operationId': 'listPets',
'externalDocsUrl': 'https://docs.example.com/pets',
},
};
@GET('/pets')
Future<void> listPets({
// defaults to the OpenAPI metadata; merge with your own extras if needed
@Extras() Map<String, dynamic>? extras =
PetsClient.listPetsOpenapiExtras,
@DioOptions() RequestOptions? options,
});
}
# https://openapi.sepc/pets/listPets
1.35.2 #
- Fixes enum name values being an int returned in a toString.
1.35.1 #
- Fixes enum names generation.
1.35.0 #
- Adds
infer_required_from_nullable.
infer_required_from_nullable: true
Schema without required array:
- id: type: integer → required int id
- name: type: string → required String name
- desc: type: string, nullable: true → String? desc
- Fixes nullable array item types generation.
1.34.0 #
- Adds
includeIfNullhandling, disabled by default; setinclude_if_null: trueto enable it.
1.33.0 #
- Supports correct processing of nested allOf classes.
1.32.1 #
- Fixes CHANGELOG duplication.
1.32.0 #
- Adds complete support for sealed classes (
oneOf/anyOf) with thejson_serializableserializer.- WARNING: Undiscriminated sealed classes use O(n) try-catch deserialization where n is the number of variants.
- RECOMMENDED: Adds discriminator properties to your OpenAPI specification for O(1) performance.
- Adds support for sealed classes fallback for failed decoding.
- Adds complete support for sealed classes (
oneOf/anyOf) with thedart_mappableserializer.- WARNING: Undiscriminated sealed classes use O(n) try-catch deserialization where n is the number of variants.
- RECOMMENDED: Adds discriminator properties to your OpenAPI specification for O(1) performance.
- Adds support for sealed classes fallback for failed decoding.
- Adds
dart_mappable_convenient_whenoption to control union type generation fordart_mappableserializer.dart_mappable_convenient_when: truegenerates legacywhen<T>, maybeWhen<T>methods.dart_mappable_convenient_when: false(default) generates sealed classes for better type safety.
- Adds the
@Deprecated()annotation to thewhen<T>andmaybeWhen<T>methods fordart_mappable; use Dart pattern matching instead. - Fixes duplicate
unknownenum values fordart_mappablewhenunknown_enum_value: trueis enabled. - Fixes nullable discriminator union handling.
1.30.1 #
- Fixes resolve inline schemas nested within tagged operations.
1.30.0 #
- Adds support for merging all generated code into single output file using the
merge_outputsoption.
1.29.0 #
Features #
- Adds support for non-discriminated unions (
oneOf/anyOfwithout a discriminator). - Filters out unused schemas when using
include_tagsorexclude_tags.
Fixes #
- Fixes the client name for untagged paths to properly fall back to the configured
fallback_clientinstead ofclient. - Fixes the
fallback_clientconfiguration to default tofallbackinstead ofdefaultto avoid conflicts with the Dartdefaultkeyword in the generated code. - Fixes OpenAPI spec parsing to correctly preserve casing for
SCREAMING_SNAKE_CASE. - Fixes filtering so paths without tags are filtered out when
include_tagsis specified.
1.28.0 #
- Fixes documentation.
- Fixes ensure consistent file naming for tags with alphanumeric suffixes.
1.27.0 #
- Allows filtering generated client endpoints by tags.
- Adds a fallback client for endpoints without tags (#271).
1.26.4 #
- Allows single
MultipartFilearguments in multipart requests; requiresretrofit_generator10.0.1 or later.
1.26.3 #
- Fixes collisions between untagged endpoints and endpoints tagged
Clientthat caused generated clients to overwrite each other.
1.26.2 #
- Aligns default value handling for parameters according to OpenAPi Spec https://swagger.io/docs/specification/v3_0/describing-parameters/#default-parameter-values.
1.26.1 #
- Adds a
toStringoverride fordart_mappable. - Makes
dart_mappabletoJsonreturn a string.
1.26.0 #
- Adds support for Freezed fallbackUnion parameter.
1.25.1 #
- Fixes broken dart_mappable enum.
1.25.0 #
- Allows using
MultipartFileinstead ofFilein multipart requests, to support usage on web.
1.24.6 #
- Handles binary responses, such as file downloads, based on retrofit.dart#503.
1.24.5 #
- Adds an enum
toString()override that provides a JSON value to third-party consumers such as Retrofit.
1.24.4 #
- Adds the
$valuesDefinedgetter to filter out unknown values automatically.
1.24.3 #
- Deduplicates property names for
allOfschemas that mixrefandproperties, preventing naming overlaps.
1.24.2 #
- Fixes
typedeftransparency that causes import errors when generatingjson_serializableclasses; see google/json_serializable#1124.
1.24.0 #
- Fixes detection of nullable list with non-null items vs nullable list with nullable items(#323).
- Requires Dart 3.6 or later.
1.23.1 #
- Updates dart_mappable template.
1.23.0 #
1.22.1 #
- Adds supports for freezed 3.
1.21.4 #
1.20.1 #
- Fixes errors with config parsing.
1.20.0 #
- Adds validation params to generated
freezedclasses. - Fixes errors with empty schema properties(#280).
1.19.2 #
1.19.0 #
- Adds version getter to root client:
final version = RestClient.version;
- Adds
dio_options_parameter_by_default.
1.18.3 #
- Removes support of BigInt in Dart for
int64types.
1.18.2 #
- Adds support for
int64types.
1.18.0 #
- Handles empty enum value case (#238).
- Fixes replacement rules.
- Adds support for nullable lists and maps.
- Removes the
required_by_defaultconfig parameter; behavior now matchesrequired_by_default: false. - Requires Dart 3.4.
1.17.3 #
1.17.2 #
- Adds
MappableFieldto dart_mappable template.
1.17.0 #
- Adds new config parameter
extras_parameter_by_defaultfrom retrofit 4.1.0 for (#208). - Fixes errors (#190), (#192) and (#195).
1.16.4 #
- Fixes errors with
required_by_default.
1.16.3 #
1.16.2 #
- Adds new exceptions to export.
- Fixes file name from
schemeUrl.
1.16.1 #
- Fixes swagger_parser_pages (https://carapacik.github.io/swagger_parser).
1.16.0 #
- Adds a wrapping collections variable that replaces
arrayDepthandmapType; it stores and resolves all collections wrapping a type in their order of appearance (#128). - Fixes error with
required_by_default(#168). - Refactors config and rename parameters:
squash_clientstomerge_clients.enums_prefixtoenums_parent_prefix.skipp_parameterstoskipped_parameters.
- Removes config parameter
put_in_folder.
1.15.4 #
- Fixes docs.
1.15.0 #
- Adds new config parameter
required_by_default. - Adds template for E2E tests.
1.14.1 #
- Removes check that would avoid generating a map when additional properties has a
$refvalue.
1.14.0 #
- Fixes error with empty content type.
- Fixes retrofit template.
- Removes special characters from tags.
- Adds new config parameter
skip_parameters. - Extracts schemes from url (#150).
1.13.1 #
- Fixes error with path-level parameters cause crash (#147).
- Fixes
dart:ioimport in template.
1.13.0 #
- Adds support for dart_mappable.
- Changes
freezedschema property tojson_serializer, which can be set tofreezed,dart_mappableorjson_serializable(default). - Fixes enum generation name that are defined inside an array.
1.12.0 #
- Adds new config parameter
export_file.
1.11.3 #
- Fixes 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 #
- Adds description of request parameters to the code docs.
1.11.1 #
- Fixes ref component being wrongly labeled as map.
- Fixes map components being assigned an import despite not needing one.
1.11.0 #
1.10.2 #
- Fixes error in
bodywith name in dart template.
1.10.0 #
- Adds support for generating schemas by URL (see the example).
- Adds new config parameter
schema_url. - Adds new config parameter
schema_from_url_to_file. - Adds new config parameter
prefer_schema_source.
1.9.1 #
- Handles invalid names for classes, enums, and methods.
- Adds a name for unnamed models (#98).
- Adds support for
deprecatedannotations for methods.
1.9.0 #
1.8.0 #
- Adds support for multiple schemas (see the example).
- Adds support for specifying nullable types via anyOf.
- Edits root client template.
- Adds new config parameter
root_client_name. - Adds new config parameter
name. - Adds new config parameter
put_in_folder. - Adds new config parameter
squash_clients. - Renames
root_interfacetoroot_client. - Renames
squish_clientstoput_clients_in_folder.
1.7.0 #
- Adds new config parameter
mark_files_as_generated. - Adds support for default values for ref enum types.
- Adds type support for single-element
allOf,anyOf, andoneOfschemas.
1.6.2 #
- Fixes grouping words for abbreviations when special characters are present.
- Fixes replacement type for enum classes.
- Preserves casing in replacements.
1.6.1 #
- Adds summary of the methods to the code docs.
- Fixes indents for multiline code docs.
- Adds support for root client code docs.
1.6.0 #
- Adds new config parameter
path_method_name.
1.5.0 #
- Requires Dart 3.0 or later.
1.4.0 #
1.3.4 #
- Applies enum prefixes only to variable types.
1.3.2 #
- Fixes error with replacement rules in allOf.
1.3.0 #
- Adds possibility to add enum prefix from parent component
(#29). Change
enums_prefixto true to enable this option.
1.2.4 #
- Fixes names for negative enum values.
1.2.1 #
- Updates
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 #
- Updates
retrofit_generatordependency to 7.0.7 and consequently removed unused.toJson()generated methods in enums.
1.1.0 #
- Adds regex replacement for generated class names.
- Fixes error with null raw parameter in OpenApi v2 (#63).
1.0.6 #
- Fixes generation default enum values (#58).
- Adds new keywords to check the name of variables.
1.0.4 #
1.0.3 #
- Fixes error with default value in
json_serializablegeneration.
1.0.0+1 #
- Adds
root_interfaceoption to web interface. - Adds topics.
1.0.0 #
- Requires Dart >= 2.19.
- Adds support for
descriptionannotation. - Adds
root_interfaceoption to generate root interface for all Clients. - Refactors code related to
nullable.
0.10.3 #
- Uses
refto identify a client method's return type whentypeis also present.
0.10.2 #
defaultValuein dart class now generates in constructor.- Fixes error with empty
client_postfix.
0.10.1 #
- Fixes error with
serversin requests (#32). - Uses
operationIdfor method name(if such a field exists).
0.10.0 #
- Fixes error with
enumvalues not parsed in object properties. - Uses 2xx codes if code 200 not found.
nullabletypes are now supported.
0.9.1 #
- Uses
JsonEnumandJsonValueon generated enum.
0.9.0 #
- Defines single-reference sibling elements as typedefs instead of generating unnecessary classes.
- Fixes error with
Nulltype with empty type in schema.
0.8.0 #
- Adds support for dio 5.
- Downgrades the lower bound of dependencies to support Flutter 3.0.
- Completes templates for Kotlin.
0.7.0 #
- Fixes error with import for
Filetype. - Adds support for
additionalPropertiesannotations. - Fixes templates.
- Fixes error with YAML files.
0.6.4 #
- Updates example.
- Removes
implicit_dynamicfield for analyzer.
0.6.3 #
- Fixes error with return type in rest client.
0.6.2 #
- Updates docs.
0.6.1 #
- Fixes error with Multipart file type in retrofit.
- Updates dart api docs.
- Updates web interface.
0.6.0 #
- Adds support for
yamlfiles. - BREAKING CHANGE: Renames
json_pathinpubspec.yamltoschema_path.
0.5.1 #
- Fixes problem with default value in freezed template.
0.5.0 #
- Recognizes objects and generates them as DTOs.
- Fixes some problems with defaultValue.
- Fixes some problems with return type.
- Fixes some problems with naming parameters whose names are similar to dart keywords.
0.4.1 #
- Fixes a problem with parameters whose names are similar to dart keywords.
- Fixes a problem with postfix in file import.
0.4.0 #
- Adds support for
defaultannotations. - Adds enum support for dart.
- Fixes errors with Multipart.
- Fixes errors with Kotlin types.
0.3.1 #
- Fixes error with
@in url path. - Fixes the problem with
numbertype to mapdouble. - Fixes the problem with
objecttype to map DartObject. - Updates the README with instructions and steps to generate the code.
0.3.0 #
- Adds support for
requiredannotations. - Fixes error with rest client parameters type in OpenApi v2.
0.2.4 #
- Fixes error with
.and,in url path.
0.2.3 #
- Fixes error in MultiPart with single
$ref.
0.2.2 #
- Removes swagger_parser section from pubspec.yaml.
- Updates dependencies in example.
0.2.1 #
- Fixes README.
- Fixes workflow files.
0.2.0 #
- Fixes errors with generation of data classes containing
allOf. - Fixes errors with templates.
- Adds web interface for package https://carapacik.github.io/swagger_parser.
- Adds generator tests.
0.1.0 #
- Marks the initial release.