Skip to content

Commit

Permalink
Version/2.11.6 (#655)
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

---------

Co-authored-by: Uladzimir Paliukhovich <[email protected]>
Co-authored-by: Romain <[email protected]>
  • Loading branch information
3 people authored Sep 22, 2023
1 parent c9f6ec9 commit f156280
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/src/code_generators/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const kPath = 'path';
const kOptionalBody = 'optionalBody';
const kFormData = 'formData';
const kMultipart = 'multipart';
const kDateTimeFormat = 'date-time';

const kDefaultBodyParameter = 'Object';
const kField = 'Field';
Expand Down Expand Up @@ -90,6 +91,8 @@ const kBody = 'body';
const kPartFile = 'partFile';
const kPart = 'part';

const kDateTimeType = 'DateTime';

const kDynamic = 'dynamic';

const supportedRequestTypes = ['get', 'post', 'put', 'delete', 'head', 'patch'];
Expand Down
8 changes: 6 additions & 2 deletions lib/src/code_generators/swagger_requests_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
}

if (parameter.schema?.type.isNotEmpty == true) {
if (parameter.schema?.format == kDateTimeFormat) {
return kDateTimeType;
}

return _mapParameterName(parameter.schema!.type, format, modelPostfix);
}

Expand Down Expand Up @@ -1216,8 +1220,8 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
final contentSchemaType = content.schema?.type ?? '';
if (contentSchemaType.isNotEmpty == true) {
if (contentSchemaType == 'string' &&
content.schema?.format == 'date-time') {
return 'DateTime';
content.schema?.format == kDateTimeFormat) {
return kDateTimeType;
}
return kBasicTypesMap[contentSchemaType];
}
Expand Down

0 comments on commit f156280

Please sign in to comment.