openapi-generator-cli -g dart-dio. Генерируется, но коммитится: CI ловит дрейф openapi/openapi.json, а приложение собирается без запуска генератора. Пересобирается через just gen-client после любого изменения роутов.
115 lines
3.9 KiB
Dart
115 lines
3.9 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'problem.dart';
|
|
|
|
// **************************************************************************
|
|
// CopyWithGenerator
|
|
// **************************************************************************
|
|
|
|
abstract class _$ProblemCWProxy {
|
|
Problem detail(String? detail);
|
|
|
|
Problem errors(List<Object>? errors);
|
|
|
|
Problem status(int status);
|
|
|
|
Problem title(String title);
|
|
|
|
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Problem(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
|
///
|
|
/// Usage
|
|
/// ```dart
|
|
/// Problem(...).copyWith(id: 12, name: "My name")
|
|
/// ````
|
|
Problem call({
|
|
String? detail,
|
|
List<Object>? errors,
|
|
int status,
|
|
String title,
|
|
});
|
|
}
|
|
|
|
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfProblem.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfProblem.copyWith.fieldName(...)`
|
|
class _$ProblemCWProxyImpl implements _$ProblemCWProxy {
|
|
const _$ProblemCWProxyImpl(this._value);
|
|
|
|
final Problem _value;
|
|
|
|
@override
|
|
Problem detail(String? detail) => this(detail: detail);
|
|
|
|
@override
|
|
Problem errors(List<Object>? errors) => this(errors: errors);
|
|
|
|
@override
|
|
Problem status(int status) => this(status: status);
|
|
|
|
@override
|
|
Problem title(String title) => this(title: title);
|
|
|
|
@override
|
|
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `Problem(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
|
///
|
|
/// Usage
|
|
/// ```dart
|
|
/// Problem(...).copyWith(id: 12, name: "My name")
|
|
/// ````
|
|
Problem call({
|
|
Object? detail = const $CopyWithPlaceholder(),
|
|
Object? errors = const $CopyWithPlaceholder(),
|
|
Object? status = const $CopyWithPlaceholder(),
|
|
Object? title = const $CopyWithPlaceholder(),
|
|
}) {
|
|
return Problem(
|
|
detail: detail == const $CopyWithPlaceholder()
|
|
? _value.detail
|
|
// ignore: cast_nullable_to_non_nullable
|
|
: detail as String?,
|
|
errors: errors == const $CopyWithPlaceholder()
|
|
? _value.errors
|
|
// ignore: cast_nullable_to_non_nullable
|
|
: errors as List<Object>?,
|
|
status: status == const $CopyWithPlaceholder()
|
|
? _value.status
|
|
// ignore: cast_nullable_to_non_nullable
|
|
: status as int,
|
|
title: title == const $CopyWithPlaceholder()
|
|
? _value.title
|
|
// ignore: cast_nullable_to_non_nullable
|
|
: title as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
extension $ProblemCopyWith on Problem {
|
|
/// Returns a callable class that can be used as follows: `instanceOfProblem.copyWith(...)` or like so:`instanceOfProblem.copyWith.fieldName(...)`.
|
|
// ignore: library_private_types_in_public_api
|
|
_$ProblemCWProxy get copyWith => _$ProblemCWProxyImpl(this);
|
|
}
|
|
|
|
// **************************************************************************
|
|
// JsonSerializableGenerator
|
|
// **************************************************************************
|
|
|
|
Problem _$ProblemFromJson(Map<String, dynamic> json) =>
|
|
$checkedCreate('Problem', json, ($checkedConvert) {
|
|
$checkKeys(json, requiredKeys: const ['status', 'title']);
|
|
final val = Problem(
|
|
detail: $checkedConvert('detail', (v) => v as String?),
|
|
errors: $checkedConvert(
|
|
'errors',
|
|
(v) => (v as List<dynamic>?)?.map((e) => e as Object).toList(),
|
|
),
|
|
status: $checkedConvert('status', (v) => (v as num).toInt()),
|
|
title: $checkedConvert('title', (v) => v as String),
|
|
);
|
|
return val;
|
|
});
|
|
|
|
Map<String, dynamic> _$ProblemToJson(Problem instance) => <String, dynamic>{
|
|
'detail': ?instance.detail,
|
|
'errors': ?instance.errors,
|
|
'status': instance.status,
|
|
'title': instance.title,
|
|
};
|