Skip to content

Commit

Permalink
Added 'Method' to key classes #492
Browse files Browse the repository at this point in the history
Fixed generatino of list request bodies #493
  • Loading branch information
Uladzimir Paliukhovich committed Nov 14, 2022
1 parent 6abc2c3 commit 87f1c54
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* Fixed generation of request bodies in some cases ([#489](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/489))

* Added `Method` to key classes ([#492](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/492))

* Fixed generation of list request bodies ([#493](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/493))

# 2.8.5

* Fixed generation of request bodies with refs ([#484](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/484))
Expand Down
1 change: 1 addition & 0 deletions lib/src/code_generators/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const List<String> kKeyClasses = [
'Type',
'Query',
'Body',
'Method',
];

const kBasicTypes = [
Expand Down
3 changes: 3 additions & 0 deletions lib/src/code_generators/swagger_requests_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,9 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
if (schema != null) {
if (schema.format == kBinary) {
typeName = kObject.pascalCase;
} else if (schema.items?.type.isNotEmpty == true) {
typeName = _mapParameterName(
schema.items!.type, schema.items!.format, options.modelPostfix).asList();
} else {
typeName = _getRequestBodyTypeName(
schema: schema,
Expand Down
2 changes: 1 addition & 1 deletion lib/swagger_dart_code_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class SwaggerDartCodeGenerator implements Builder {

final imports = codeGenerator.generateImportsContent(
fileNameWithoutExtension,
models.isNotEmpty || requestBodies.isNotEmpty,
models.isNotEmpty || requestBodies.isNotEmpty || responses.isNotEmpty,
options.buildOnlyModels,
enums.isNotEmpty,
options.separateModels,
Expand Down

0 comments on commit 87f1c54

Please sign in to comment.