Skip to content

Commit

Permalink
Development (#678)
Browse files Browse the repository at this point in the history
* Fixed some issues

* formatted code

* updated SDK

* Updated SDK and version

* Fixed generation of lists of classes

* Fixed generation $Items classes

* Updated pubspec and changelog

* Fixed #524

* Fixed #598 Generation of query enum parameters

* Fixed conflicts

* Fixed some issues in swaggers

* Updated changelog and pubspec

* Fix #583, #637, #619 and update readme (#638)

* fix #583 and update readme

* fix #637

* fix #619

* Fixed generation of some fields

* Removed test

* Fixed classes named List

* Fixed generation of query parameters with ref default type

* Fixed generation of DateTime parameters

* Fixed generation of responses in some cases

* Some fixes

* Updated changelog and pubspec

* Implemented not nullable fields

* Fixed tests

* fixed generation of some swaggers

* Added ability to return String values

* Returned main.dart content

* Updated pubspec and changelog

* Fixed generation of required and not required fields

* Added check for object ref in body

* Fixed some things

* Fixed tests

* Fixed tests

* Fixed some things

* Updated changelog and pubspec

* Removed not needed lines in tests

* Fixed generation of nullable responses

* Added generation of DateTime

* Updated pubspec and changelog

* Fixed tests

* Fixed #669 Generation models from content schema allof

* Fixed #665 generation putIfAbsent for response from content schema

* Fixed generation of nullable and required properties

* Fixed tests

* Fixed some stuff related to nullable properties

* Updated changelog and pubspec

* Formatted code

* Formatted code

* Fixed tests

* Fixed generation of some enums inside classes

---------

Co-authored-by: Uladzimir Paliukhovich <[email protected]>
Co-authored-by: Romain <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2023
1 parent 2c25149 commit 054aecb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/src/code_generators/swagger_generator_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ abstract class SwaggerGeneratorBase {
return '\$$result';
}

return result.replaceFirst(options.cutFromModelNames, '');
return result
.replaceFirst(options.cutFromModelNames, '')
.replaceAll('\$\$', '\$');
}

String generateEnumName(String className, String enumName) {
Expand Down
10 changes: 6 additions & 4 deletions lib/src/code_generators/swagger_models_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {
schema.items?.properties.isNotEmpty == true;

properties.forEach((propertyKey, propSchema) {
final itemPart = shouldUseItemsProperties ? '\$Item' : '';
final itemPart = shouldUseItemsProperties ? '\$Item\$' : '\$';

final innerClassName =
'${getValidatedClassName(classKey)}$itemPart\$${getValidatedClassName(propertyKey)}';
final innerClassName = getValidatedClassName(
'${getValidatedClassName(classKey)}$itemPart${getValidatedClassName(propertyKey)}');

if (propSchema.properties.isNotEmpty) {
result[innerClassName] = propSchema;
Expand All @@ -174,6 +174,7 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {

if (items != null && items.properties.isNotEmpty) {
propSchema.type = 'object';

result['$innerClassName\$Item'] = items;
}
});
Expand Down Expand Up @@ -363,7 +364,8 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {
if (parameter == null) return 'Object';

if (parameter.properties.isNotEmpty) {
return '${getValidatedClassName(className)}\$${getValidatedClassName(parameterName)}$modelPostfix';
return getValidatedClassName(
'${getValidatedClassName(className)}\$${getValidatedClassName(parameterName)}$modelPostfix');
}

if (parameter.items?.properties.isNotEmpty == true) {
Expand Down

0 comments on commit 054aecb

Please sign in to comment.