Browse Source

Merge pull request #992 from nextcloud/refactor/dynamite

refactor(dynamite): add default values as described by openapi
pull/988/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
a160696e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/dynamite/dynamite/lib/src/builder/client.dart
  2. 2
      packages/dynamite/dynamite/lib/src/builder/header_serializer.dart
  3. 2
      packages/dynamite/dynamite/lib/src/builder/resolve_interface.dart
  4. 4
      packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart
  5. 10
      packages/dynamite/dynamite/lib/src/helpers/dynamite.dart
  6. 7
      packages/dynamite/dynamite/lib/src/models/openapi/header.dart
  7. 26
      packages/dynamite/dynamite/lib/src/models/openapi/header.g.dart
  8. 13
      packages/dynamite/dynamite/lib/src/models/openapi/open_api.dart
  9. 26
      packages/dynamite/dynamite/lib/src/models/openapi/open_api.g.dart
  10. 7
      packages/dynamite/dynamite/lib/src/models/openapi/operation.dart
  11. 24
      packages/dynamite/dynamite/lib/src/models/openapi/operation.g.dart
  12. 9
      packages/dynamite/dynamite/lib/src/models/openapi/parameter.dart
  13. 19
      packages/dynamite/dynamite/lib/src/models/openapi/parameter.g.dart
  14. 7
      packages/dynamite/dynamite/lib/src/models/openapi/request_body.dart
  15. 26
      packages/dynamite/dynamite/lib/src/models/openapi/request_body.g.dart
  16. 9
      packages/dynamite/dynamite/lib/src/models/openapi/schema.dart
  17. 43
      packages/dynamite/dynamite/lib/src/models/openapi/schema.g.dart

2
packages/dynamite/dynamite/lib/src/builder/client.dart

@ -234,7 +234,7 @@ Iterable<Method> buildTags(
).forEach(code.writeln);
final operationParameters = ListBuilder<Parameter>();
final annotations = operation.deprecated ?? false ? refer('Deprecated').call([refer("''")]) : null;
final annotations = operation.deprecated ? refer('Deprecated').call([refer("''")]) : null;
var returnDataType = 'void';
var returnHeadersType = 'void';

2
packages/dynamite/dynamite/lib/src/builder/header_serializer.dart

@ -122,7 +122,7 @@ Iterable<String> deserializeProperty(
state,
'${identifier}_${toDartName(propertyName, uppercaseFirstCharacter: true)}',
propertySchema,
nullable: isDartParameterNullable(schema.required?.contains(propertyName), propertySchema),
nullable: isDartParameterNullable(schema.required.contains(propertyName), propertySchema),
);
yield "case '$propertyName':";

2
packages/dynamite/dynamite/lib/src/builder/resolve_interface.dart

@ -34,7 +34,7 @@ TypeResultObject resolveInterface(
'${identifier}_${toDartName(propertyName, uppercaseFirstCharacter: true)}',
propertySchema,
nullable: isDartParameterNullable(
schema.required?.contains(propertyName),
schema.required.contains(propertyName),
propertySchema,
),
);

4
packages/dynamite/dynamite/lib/src/builder/resolve_mime_type.dart

@ -77,7 +77,7 @@ Iterable<String> resolveMimeTypeEncode(
case 'application/x-www-form-urlencoded':
final dartParameterRequired = isRequired(
operation.requestBody!.required,
mediaType.schema?.$default,
mediaType.schema,
);
b.add(
Parameter(
@ -100,7 +100,7 @@ Iterable<String> resolveMimeTypeEncode(
case 'application/octet-stream':
final dartParameterRequired = isRequired(
operation.requestBody!.required,
mediaType.schema?.$default,
mediaType.schema,
);
b.add(
Parameter(

10
packages/dynamite/dynamite/lib/src/helpers/dynamite.dart

@ -18,16 +18,16 @@ String filterMethodName(final String operationId, final String tag) {
String clientName(final String tag) => '${toDartName(tag, uppercaseFirstCharacter: true)}Client';
bool isDartParameterNullable(
final bool? required,
final bool required,
final openapi.Schema? schema,
) =>
(!(required ?? false) && schema?.$default == null) || (schema?.nullable ?? false);
(!required && schema?.$default == null) || (schema?.nullable ?? false);
bool isRequired(
final bool? required,
final dynamic default_,
final bool required,
final openapi.Schema? schema,
) =>
(required ?? false) && default_ == null;
required && schema?.$default == null;
int sortRequiredParameters(final openapi.Parameter a, final openapi.Parameter b) {
if (a.isDartRequired != b.isDartRequired) {

7
packages/dynamite/dynamite/lib/src/models/openapi/header.dart

@ -14,7 +14,12 @@ abstract class Header implements Built<Header, HeaderBuilder> {
@BuiltValueField(compare: false)
String? get description;
bool? get required;
bool get required;
Schema? get schema;
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final HeaderBuilder b) {
b.required ??= false;
}
}

26
packages/dynamite/dynamite/lib/src/models/openapi/header.g.dart

@ -16,7 +16,10 @@ class _$HeaderSerializer implements StructuredSerializer<Header> {
@override
Iterable<Object?> serialize(Serializers serializers, Header object, {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
final result = <Object?>[
'required',
serializers.serialize(object.required, specifiedType: const FullType(bool)),
];
Object? value;
value = object.description;
if (value != null) {
@ -24,12 +27,6 @@ class _$HeaderSerializer implements StructuredSerializer<Header> {
..add('description')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.required;
if (value != null) {
result
..add('required')
..add(serializers.serialize(value, specifiedType: const FullType(bool)));
}
value = object.schema;
if (value != null) {
result
@ -54,7 +51,7 @@ class _$HeaderSerializer implements StructuredSerializer<Header> {
result.description = serializers.deserialize(value, specifiedType: const FullType(String)) as String?;
break;
case 'required':
result.required = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?;
result.required = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool;
break;
case 'schema':
result.schema.replace(serializers.deserialize(value, specifiedType: const FullType(Schema))! as Schema);
@ -70,13 +67,15 @@ class _$Header extends Header {
@override
final String? description;
@override
final bool? required;
final bool required;
@override
final Schema? schema;
factory _$Header([void Function(HeaderBuilder)? updates]) => (HeaderBuilder()..update(updates))._build();
_$Header._({this.description, this.required, this.schema}) : super._();
_$Header._({this.description, required this.required, this.schema}) : super._() {
BuiltValueNullFieldError.checkNotNull(required, r'Header', 'required');
}
@override
Header rebuild(void Function(HeaderBuilder) updates) => (toBuilder()..update(updates)).build();
@ -152,9 +151,14 @@ class HeaderBuilder implements Builder<Header, HeaderBuilder> {
Header build() => _build();
_$Header _build() {
Header._defaults(this);
_$Header _$result;
try {
_$result = _$v ?? _$Header._(description: description, required: required, schema: _schema?.build());
_$result = _$v ??
_$Header._(
description: description,
required: BuiltValueNullFieldError.checkNotNull(required, r'Header', 'required'),
schema: _schema?.build());
} catch (_) {
late String _$failedField;
try {

13
packages/dynamite/dynamite/lib/src/models/openapi/open_api.dart

@ -21,7 +21,7 @@ abstract class OpenAPI implements Built<OpenAPI, OpenAPIBuilder> {
Info get info;
BuiltList<Server>? get servers;
BuiltList<Server> get servers;
BuiltList<BuiltMap<String, BuiltList<String>>>? get security;
@ -33,6 +33,17 @@ abstract class OpenAPI implements Built<OpenAPI, OpenAPIBuilder> {
bool get hasAnySecurity => components?.securitySchemes?.isNotEmpty ?? false;
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final OpenAPIBuilder b) {
if (b.servers.isEmpty) {
b.servers.add(
Server(
(final b) => b.url = '/',
),
);
}
}
Iterable<String> formattedTagsFor(final String? tag) sync* {
final matchedTags = tags?.where((final t) => t.name == tag);

26
packages/dynamite/dynamite/lib/src/models/openapi/open_api.g.dart

@ -22,14 +22,10 @@ class _$OpenAPISerializer implements StructuredSerializer<OpenAPI> {
serializers.serialize(object.version, specifiedType: const FullType(String)),
'info',
serializers.serialize(object.info, specifiedType: const FullType(Info)),
'servers',
serializers.serialize(object.servers, specifiedType: const FullType(BuiltList, [FullType(Server)])),
];
Object? value;
value = object.servers;
if (value != null) {
result
..add('servers')
..add(serializers.serialize(value, specifiedType: const FullType(BuiltList, [FullType(Server)])));
}
value = object.security;
if (value != null) {
result
@ -119,7 +115,7 @@ class _$OpenAPI extends OpenAPI {
@override
final Info info;
@override
final BuiltList<Server>? servers;
final BuiltList<Server> servers;
@override
final BuiltList<BuiltMap<String, BuiltList<String>>>? security;
@override
@ -132,10 +128,17 @@ class _$OpenAPI extends OpenAPI {
factory _$OpenAPI([void Function(OpenAPIBuilder)? updates]) => (OpenAPIBuilder()..update(updates))._build();
_$OpenAPI._(
{required this.version, required this.info, this.servers, this.security, this.tags, this.components, this.paths})
{required this.version,
required this.info,
required this.servers,
this.security,
this.tags,
this.components,
this.paths})
: super._() {
BuiltValueNullFieldError.checkNotNull(version, r'OpenAPI', 'version');
BuiltValueNullFieldError.checkNotNull(info, r'OpenAPI', 'info');
BuiltValueNullFieldError.checkNotNull(servers, r'OpenAPI', 'servers');
}
@override
@ -224,7 +227,7 @@ class OpenAPIBuilder implements Builder<OpenAPI, OpenAPIBuilder> {
if ($v != null) {
_version = $v.version;
_info = $v.info.toBuilder();
_servers = $v.servers?.toBuilder();
_servers = $v.servers.toBuilder();
_security = $v.security?.toBuilder();
_tags = $v.tags?.toBuilder();
_components = $v.components?.toBuilder();
@ -249,13 +252,14 @@ class OpenAPIBuilder implements Builder<OpenAPI, OpenAPIBuilder> {
OpenAPI build() => _build();
_$OpenAPI _build() {
OpenAPI._defaults(this);
_$OpenAPI _$result;
try {
_$result = _$v ??
_$OpenAPI._(
version: BuiltValueNullFieldError.checkNotNull(version, r'OpenAPI', 'version'),
info: info.build(),
servers: _servers?.build(),
servers: servers.build(),
security: _security?.build(),
tags: _tags?.build(),
components: _components?.build(),
@ -266,7 +270,7 @@ class OpenAPIBuilder implements Builder<OpenAPI, OpenAPIBuilder> {
_$failedField = 'info';
info.build();
_$failedField = 'servers';
_servers?.build();
servers.build();
_$failedField = 'security';
_security?.build();
_$failedField = 'tags';

7
packages/dynamite/dynamite/lib/src/models/openapi/operation.dart

@ -23,7 +23,7 @@ abstract class Operation implements Built<Operation, OperationBuilder> {
@BuiltValueField(compare: false)
String? get description;
bool? get deprecated;
bool get deprecated;
BuiltList<String>? get tags;
@ -35,6 +35,11 @@ abstract class Operation implements Built<Operation, OperationBuilder> {
BuiltList<BuiltMap<String, BuiltList<String>>>? get security;
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final OperationBuilder b) {
b.deprecated ??= false;
}
Iterable<String> formattedDescription(
final String methodName, {
final bool isRawRequest = false,

24
packages/dynamite/dynamite/lib/src/models/openapi/operation.g.dart

@ -17,7 +17,10 @@ class _$OperationSerializer implements StructuredSerializer<Operation> {
@override
Iterable<Object?> serialize(Serializers serializers, Operation object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
final result = <Object?>[
'deprecated',
serializers.serialize(object.deprecated, specifiedType: const FullType(bool)),
];
Object? value;
value = object.operationId;
if (value != null) {
@ -37,12 +40,6 @@ class _$OperationSerializer implements StructuredSerializer<Operation> {
..add('description')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.deprecated;
if (value != null) {
result
..add('deprecated')
..add(serializers.serialize(value, specifiedType: const FullType(bool)));
}
value = object.tags;
if (value != null) {
result
@ -104,7 +101,7 @@ class _$OperationSerializer implements StructuredSerializer<Operation> {
result.description = serializers.deserialize(value, specifiedType: const FullType(String)) as String?;
break;
case 'deprecated':
result.deprecated = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?;
result.deprecated = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool;
break;
case 'tags':
result.tags.replace(serializers.deserialize(value,
@ -146,7 +143,7 @@ class _$Operation extends Operation {
@override
final String? description;
@override
final bool? deprecated;
final bool deprecated;
@override
final BuiltList<String>? tags;
@override
@ -164,13 +161,15 @@ class _$Operation extends Operation {
{this.operationId,
this.summary,
this.description,
this.deprecated,
required this.deprecated,
this.tags,
this.parameters,
this.requestBody,
this.responses,
this.security})
: super._();
: super._() {
BuiltValueNullFieldError.checkNotNull(deprecated, r'Operation', 'deprecated');
}
@override
Operation rebuild(void Function(OperationBuilder) updates) => (toBuilder()..update(updates)).build();
@ -295,6 +294,7 @@ class OperationBuilder implements Builder<Operation, OperationBuilder> {
Operation build() => _build();
_$Operation _build() {
Operation._defaults(this);
_$Operation _$result;
try {
_$result = _$v ??
@ -302,7 +302,7 @@ class OperationBuilder implements Builder<Operation, OperationBuilder> {
operationId: operationId,
summary: summary,
description: description,
deprecated: deprecated,
deprecated: BuiltValueNullFieldError.checkNotNull(deprecated, r'Operation', 'deprecated'),
tags: _tags?.build(),
parameters: _parameters?.build(),
requestBody: _requestBody?.build(),

9
packages/dynamite/dynamite/lib/src/models/openapi/parameter.dart

@ -22,11 +22,16 @@ abstract class Parameter implements Built<Parameter, ParameterBuilder> {
@BuiltValueField(compare: false)
String? get description;
bool? get required;
bool get required;
Schema? get schema;
bool get isDartRequired => isRequired(required, schema?.$default);
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final ParameterBuilder b) {
b.required ??= false;
}
bool get isDartRequired => isRequired(required, schema);
String get formattedDescription {
final name = toDartName(this.name);

19
packages/dynamite/dynamite/lib/src/models/openapi/parameter.g.dart

@ -22,6 +22,8 @@ class _$ParameterSerializer implements StructuredSerializer<Parameter> {
serializers.serialize(object.name, specifiedType: const FullType(String)),
'in',
serializers.serialize(object.$in, specifiedType: const FullType(String)),
'required',
serializers.serialize(object.required, specifiedType: const FullType(bool)),
];
Object? value;
value = object.description;
@ -30,12 +32,6 @@ class _$ParameterSerializer implements StructuredSerializer<Parameter> {
..add('description')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.required;
if (value != null) {
result
..add('required')
..add(serializers.serialize(value, specifiedType: const FullType(bool)));
}
value = object.schema;
if (value != null) {
result
@ -66,7 +62,7 @@ class _$ParameterSerializer implements StructuredSerializer<Parameter> {
result.description = serializers.deserialize(value, specifiedType: const FullType(String)) as String?;
break;
case 'required':
result.required = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?;
result.required = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool;
break;
case 'schema':
result.schema.replace(serializers.deserialize(value, specifiedType: const FullType(Schema))! as Schema);
@ -86,15 +82,17 @@ class _$Parameter extends Parameter {
@override
final String? description;
@override
final bool? required;
final bool required;
@override
final Schema? schema;
factory _$Parameter([void Function(ParameterBuilder)? updates]) => (ParameterBuilder()..update(updates))._build();
_$Parameter._({required this.name, required this.$in, this.description, this.required, this.schema}) : super._() {
_$Parameter._({required this.name, required this.$in, this.description, required this.required, this.schema})
: super._() {
BuiltValueNullFieldError.checkNotNull(name, r'Parameter', 'name');
BuiltValueNullFieldError.checkNotNull($in, r'Parameter', '\$in');
BuiltValueNullFieldError.checkNotNull(required, r'Parameter', 'required');
}
@override
@ -189,6 +187,7 @@ class ParameterBuilder implements Builder<Parameter, ParameterBuilder> {
Parameter build() => _build();
_$Parameter _build() {
Parameter._defaults(this);
_$Parameter _$result;
try {
_$result = _$v ??
@ -196,7 +195,7 @@ class ParameterBuilder implements Builder<Parameter, ParameterBuilder> {
name: BuiltValueNullFieldError.checkNotNull(name, r'Parameter', 'name'),
$in: BuiltValueNullFieldError.checkNotNull($in, r'Parameter', '\$in'),
description: description,
required: required,
required: BuiltValueNullFieldError.checkNotNull(required, r'Parameter', 'required'),
schema: _schema?.build());
} catch (_) {
late String _$failedField;

7
packages/dynamite/dynamite/lib/src/models/openapi/request_body.dart

@ -17,5 +17,10 @@ abstract class RequestBody implements Built<RequestBody, RequestBodyBuilder> {
BuiltMap<String, MediaType>? get content;
bool? get required;
bool get required;
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final RequestBodyBuilder b) {
b.required ??= false;
}
}

26
packages/dynamite/dynamite/lib/src/models/openapi/request_body.g.dart

@ -17,7 +17,10 @@ class _$RequestBodySerializer implements StructuredSerializer<RequestBody> {
@override
Iterable<Object?> serialize(Serializers serializers, RequestBody object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
final result = <Object?>[
'required',
serializers.serialize(object.required, specifiedType: const FullType(bool)),
];
Object? value;
value = object.description;
if (value != null) {
@ -32,12 +35,6 @@ class _$RequestBodySerializer implements StructuredSerializer<RequestBody> {
..add(serializers.serialize(value,
specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MediaType)])));
}
value = object.required;
if (value != null) {
result
..add('required')
..add(serializers.serialize(value, specifiedType: const FullType(bool)));
}
return result;
}
@ -60,7 +57,7 @@ class _$RequestBodySerializer implements StructuredSerializer<RequestBody> {
specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MediaType)]))!);
break;
case 'required':
result.required = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?;
result.required = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool;
break;
}
}
@ -75,12 +72,14 @@ class _$RequestBody extends RequestBody {
@override
final BuiltMap<String, MediaType>? content;
@override
final bool? required;
final bool required;
factory _$RequestBody([void Function(RequestBodyBuilder)? updates]) =>
(RequestBodyBuilder()..update(updates))._build();
_$RequestBody._({this.description, this.content, this.required}) : super._();
_$RequestBody._({this.description, this.content, required this.required}) : super._() {
BuiltValueNullFieldError.checkNotNull(required, r'RequestBody', 'required');
}
@override
RequestBody rebuild(void Function(RequestBodyBuilder) updates) => (toBuilder()..update(updates)).build();
@ -156,9 +155,14 @@ class RequestBodyBuilder implements Builder<RequestBody, RequestBodyBuilder> {
RequestBody build() => _build();
_$RequestBody _build() {
RequestBody._defaults(this);
_$RequestBody _$result;
try {
_$result = _$v ?? _$RequestBody._(description: description, content: _content?.build(), required: required);
_$result = _$v ??
_$RequestBody._(
description: description,
content: _content?.build(),
required: BuiltValueNullFieldError.checkNotNull(required, r'RequestBody', 'required'));
} catch (_) {
late String _$failedField;
try {

9
packages/dynamite/dynamite/lib/src/models/openapi/schema.dart

@ -28,7 +28,7 @@ abstract class Schema implements Built<Schema, SchemaBuilder> {
@BuiltValueField(compare: false)
String? get description;
bool? get deprecated;
bool get deprecated;
String? get type;
@ -42,7 +42,7 @@ abstract class Schema implements Built<Schema, SchemaBuilder> {
BuiltMap<String, Schema>? get properties;
BuiltList<String>? get required;
BuiltList<String> get required;
Schema? get items;
@ -65,4 +65,9 @@ abstract class Schema implements Built<Schema, SchemaBuilder> {
bool get isContentString => type == 'string' && (contentMediaType?.isNotEmpty ?? false) && contentSchema != null;
Iterable<String> get formattedDescription => descriptionToDocs(description);
@BuiltValueHook(finalizeBuilder: true)
static void _defaults(final SchemaBuilder b) {
b.deprecated ??= false;
}
}

43
packages/dynamite/dynamite/lib/src/models/openapi/schema.g.dart

@ -16,7 +16,12 @@ class _$SchemaSerializer implements StructuredSerializer<Schema> {
@override
Iterable<Object?> serialize(Serializers serializers, Schema object, {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
final result = <Object?>[
'deprecated',
serializers.serialize(object.deprecated, specifiedType: const FullType(bool)),
'required',
serializers.serialize(object.required, specifiedType: const FullType(BuiltList, [FullType(String)])),
];
Object? value;
value = object.ref;
if (value != null) {
@ -48,12 +53,6 @@ class _$SchemaSerializer implements StructuredSerializer<Schema> {
..add('description')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.deprecated;
if (value != null) {
result
..add('deprecated')
..add(serializers.serialize(value, specifiedType: const FullType(bool)));
}
value = object.type;
if (value != null) {
result
@ -85,12 +84,6 @@ class _$SchemaSerializer implements StructuredSerializer<Schema> {
..add(serializers.serialize(value,
specifiedType: const FullType(BuiltMap, [FullType(String), FullType(Schema)])));
}
value = object.required;
if (value != null) {
result
..add('required')
..add(serializers.serialize(value, specifiedType: const FullType(BuiltList, [FullType(String)])));
}
value = object.items;
if (value != null) {
result
@ -178,7 +171,7 @@ class _$SchemaSerializer implements StructuredSerializer<Schema> {
result.description = serializers.deserialize(value, specifiedType: const FullType(String)) as String?;
break;
case 'deprecated':
result.deprecated = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?;
result.deprecated = serializers.deserialize(value, specifiedType: const FullType(bool))! as bool;
break;
case 'type':
result.type = serializers.deserialize(value, specifiedType: const FullType(String)) as String?;
@ -250,7 +243,7 @@ class _$Schema extends Schema {
@override
final String? description;
@override
final bool? deprecated;
final bool deprecated;
@override
final String? type;
@override
@ -262,7 +255,7 @@ class _$Schema extends Schema {
@override
final BuiltMap<String, Schema>? properties;
@override
final BuiltList<String>? required;
final BuiltList<String> required;
@override
final Schema? items;
@override
@ -290,13 +283,13 @@ class _$Schema extends Schema {
this.anyOf,
this.allOf,
this.description,
this.deprecated,
required this.deprecated,
this.type,
this.format,
this.$default,
this.$enum,
this.properties,
this.required,
required this.required,
this.items,
this.additionalProperties,
this.contentMediaType,
@ -306,7 +299,10 @@ class _$Schema extends Schema {
this.minLength,
this.maxLength,
this.nullable})
: super._();
: super._() {
BuiltValueNullFieldError.checkNotNull(deprecated, r'Schema', 'deprecated');
BuiltValueNullFieldError.checkNotNull(required, r'Schema', 'required');
}
@override
Schema rebuild(void Function(SchemaBuilder) updates) => (toBuilder()..update(updates)).build();
@ -498,7 +494,7 @@ class SchemaBuilder implements Builder<Schema, SchemaBuilder> {
_$default = $v.$default;
_$enum = $v.$enum?.toBuilder();
_properties = $v.properties?.toBuilder();
_required = $v.required?.toBuilder();
_required = $v.required.toBuilder();
_items = $v.items?.toBuilder();
_additionalProperties = $v.additionalProperties?.toBuilder();
_contentMediaType = $v.contentMediaType;
@ -528,6 +524,7 @@ class SchemaBuilder implements Builder<Schema, SchemaBuilder> {
Schema build() => _build();
_$Schema _build() {
Schema._defaults(this);
_$Schema _$result;
try {
_$result = _$v ??
@ -537,13 +534,13 @@ class SchemaBuilder implements Builder<Schema, SchemaBuilder> {
anyOf: _anyOf?.build(),
allOf: _allOf?.build(),
description: description,
deprecated: deprecated,
deprecated: BuiltValueNullFieldError.checkNotNull(deprecated, r'Schema', 'deprecated'),
type: type,
format: format,
$default: $default,
$enum: _$enum?.build(),
properties: _properties?.build(),
required: _required?.build(),
required: required.build(),
items: _items?.build(),
additionalProperties: _additionalProperties?.build(),
contentMediaType: contentMediaType,
@ -568,7 +565,7 @@ class SchemaBuilder implements Builder<Schema, SchemaBuilder> {
_$failedField = 'properties';
_properties?.build();
_$failedField = 'required';
_required?.build();
required.build();
_$failedField = 'items';
_items?.build();
_$failedField = 'additionalProperties';

Loading…
Cancel
Save