refactor: api validators (boolean and date) (#7709)

* refactor: api validators (boolean and date)

* chore: open api

* revert: time bucket change
This commit is contained in:
Jason Rasmussen
2024-03-07 22:59:02 -05:00
committed by GitHub
parent 753842745d
commit a50f125dd1
41 changed files with 276 additions and 368 deletions

View File

@@ -114,7 +114,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**withHidden** | **bool**| | [optional] [default to false]
**withHidden** | **bool**| | [optional]
### Return type

View File

@@ -8,7 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**refreshAllFiles** | **bool** | | [optional] [default to false]
**refreshAllFiles** | **bool** | | [optional]
**refreshModifiedFiles** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -10,7 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**albumId** | **String** | | [optional]
**allowDownload** | **bool** | | [optional] [default to true]
**allowUpload** | **bool** | | [optional] [default to false]
**allowUpload** | **bool** | | [optional]
**assetIds** | **List<String>** | | [optional] [default to const []]
**description** | **String** | | [optional]
**expiresAt** | [**DateTime**](DateTime.md) | | [optional]

View File

@@ -13,11 +13,17 @@ part of openapi.api;
class ScanLibraryDto {
/// Returns a new [ScanLibraryDto] instance.
ScanLibraryDto({
this.refreshAllFiles = false,
this.refreshAllFiles,
this.refreshModifiedFiles,
});
bool refreshAllFiles;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? refreshAllFiles;
///
/// Please note: This property should have been non-nullable! Since the specification file
@@ -35,7 +41,7 @@ class ScanLibraryDto {
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(refreshAllFiles.hashCode) +
(refreshAllFiles == null ? 0 : refreshAllFiles!.hashCode) +
(refreshModifiedFiles == null ? 0 : refreshModifiedFiles!.hashCode);
@override
@@ -43,7 +49,11 @@ class ScanLibraryDto {
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.refreshAllFiles != null) {
json[r'refreshAllFiles'] = this.refreshAllFiles;
} else {
// json[r'refreshAllFiles'] = null;
}
if (this.refreshModifiedFiles != null) {
json[r'refreshModifiedFiles'] = this.refreshModifiedFiles;
} else {
@@ -60,7 +70,7 @@ class ScanLibraryDto {
final json = value.cast<String, dynamic>();
return ScanLibraryDto(
refreshAllFiles: mapValueOfType<bool>(json, r'refreshAllFiles') ?? false,
refreshAllFiles: mapValueOfType<bool>(json, r'refreshAllFiles'),
refreshModifiedFiles: mapValueOfType<bool>(json, r'refreshModifiedFiles'),
);
}

View File

@@ -15,7 +15,7 @@ class SharedLinkCreateDto {
SharedLinkCreateDto({
this.albumId,
this.allowDownload = true,
this.allowUpload = false,
this.allowUpload,
this.assetIds = const [],
this.description,
this.expiresAt,
@@ -34,7 +34,13 @@ class SharedLinkCreateDto {
bool allowDownload;
bool allowUpload;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? allowUpload;
List<String> assetIds;
@@ -77,7 +83,7 @@ class SharedLinkCreateDto {
// ignore: unnecessary_parenthesis
(albumId == null ? 0 : albumId!.hashCode) +
(allowDownload.hashCode) +
(allowUpload.hashCode) +
(allowUpload == null ? 0 : allowUpload!.hashCode) +
(assetIds.hashCode) +
(description == null ? 0 : description!.hashCode) +
(expiresAt == null ? 0 : expiresAt!.hashCode) +
@@ -96,7 +102,11 @@ class SharedLinkCreateDto {
// json[r'albumId'] = null;
}
json[r'allowDownload'] = this.allowDownload;
if (this.allowUpload != null) {
json[r'allowUpload'] = this.allowUpload;
} else {
// json[r'allowUpload'] = null;
}
json[r'assetIds'] = this.assetIds;
if (this.description != null) {
json[r'description'] = this.description;
@@ -128,7 +138,7 @@ class SharedLinkCreateDto {
return SharedLinkCreateDto(
albumId: mapValueOfType<String>(json, r'albumId'),
allowDownload: mapValueOfType<bool>(json, r'allowDownload') ?? true,
allowUpload: mapValueOfType<bool>(json, r'allowUpload') ?? false,
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],

View File

@@ -16,7 +16,7 @@ void main() {
// final instance = ScanLibraryDto();
group('test ScanLibraryDto', () {
// bool refreshAllFiles (default value: false)
// bool refreshAllFiles
test('to test the property `refreshAllFiles`', () async {
// TODO
});

View File

@@ -26,7 +26,7 @@ void main() {
// TODO
});
// bool allowUpload (default value: false)
// bool allowUpload
test('to test the property `allowUpload`', () async {
// TODO
});