Skip to content

Commit

Permalink
1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Carapacik committed Dec 5, 2024
1 parent df890f4 commit 490b7f6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
3 changes: 3 additions & 0 deletions swagger_parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.20.1
- Fixed errors with config parsing

## 1.20.0
- Add validation params to generated `freezed` classes
- Fixed errors with empty schema properties([#280](https://github.com/Carapacik/swagger_parser/issues/280))
Expand Down
6 changes: 4 additions & 2 deletions swagger_parser/lib/src/config/swp_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ class SWPConfig {
);
}

final mergeClients = yamlMap['mergeClients'];
final mergeClients = yamlMap['merge_clients'];
if (mergeClients is! bool?) {
throw const ConfigException(
"Config parameter 'mergeClients' must be bool.",
"Config parameter 'merge_clients' must be bool.",
);
}

Expand Down Expand Up @@ -193,6 +193,8 @@ class SWPConfig {
final rawJsonSerializer = yamlMap['json_serializer']?.toString();
if (rawJsonSerializer != null) {
jsonSerializer = JsonSerializer.fromString(rawJsonSerializer);
} else if (rootConfig?.jsonSerializer != null) {
jsonSerializer = rootConfig!.jsonSerializer;
}

final rootClient = yamlMap['root_client'];
Expand Down
20 changes: 8 additions & 12 deletions swagger_parser/lib/src/generator/model/programming_language.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,21 @@ enum ProgrammingLanguage {
markFileAsGenerated: markFilesAsGenerated,
);
}

switch (jsonSerializer) {
case JsonSerializer.freezed:
return dartFreezedDtoTemplate(
return switch (jsonSerializer) {
JsonSerializer.freezed => dartFreezedDtoTemplate(
dataClass,
markFileAsGenerated: markFilesAsGenerated,
generateValidator: generateValidator,
);
case JsonSerializer.jsonSerializable:
return dartJsonSerializableDtoTemplate(
),
JsonSerializer.jsonSerializable => dartJsonSerializableDtoTemplate(
dataClass,
markFileAsGenerated: markFilesAsGenerated,
);
case JsonSerializer.dartMappable:
return dartDartMappableDtoTemplate(
),
JsonSerializer.dartMappable => dartDartMappableDtoTemplate(
dataClass,
markFileAsGenerated: markFilesAsGenerated,
);
}
)
};
}
case kotlin:
if (dataClass is UniversalEnumClass) {
Expand Down
2 changes: 1 addition & 1 deletion swagger_parser/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: swagger_parser
description: Package that generates REST clients and data classes from OpenApi definition file
version: 1.20.0
version: 1.20.1
repository: https://github.com/Carapacik/swagger_parser/tree/main/swagger_parser
topics:
- swagger
Expand Down

0 comments on commit 490b7f6

Please sign in to comment.