-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Steps to reproduce
Using V3.1 standard
Use the below snippet that has both nullable: false and only type: "boolean" not type: ["boolean", "null"]
IsDefault is made a bool? in dart because it isn't in the required list.
Expected results
It should be bool because it isn't nullable and doesn't have "null" in a type array.
Actual results
@MappableClass()
class EmailAddressDto with EmailAddressDtoMappable {
const EmailAddressDto({
required this.address,
required this.id,
this.isDefault,
this.isVerified,
this.owningContactId,
});
final String address;
final String? id;
final bool? isDefault;
final bool? isVerified;
final String? owningContactId;
static EmailAddressDto fromJson(Map<String, dynamic> json) => EmailAddressDtoMapper.ensureInitialized().decodeMap<EmailAddressDto>(json);
}
Your OpenApi snippet
"EmailAddressDto": {
"required": [
"address",
"id"
],
"type": "object",
"properties": {
"address": {
"type": "string",
"nullable": false
},
"isDefault": {
"type": "boolean",
"nullable": false
},
"isVerified": {
"type": "boolean",
"nullable": false
},
"owningContactId": {
"type": [
"null",
"string"
],
"format": "uuid",
"nullable": true
},
"id": {
"type": [
"null",
"string"
],
"description": "The unique identifier for the email address.",
"format": "uuid",
"nullable": true
}
},
"nullable": false
},
Code sample
Code sample
@MappableClass()
class EmailAddressDto with EmailAddressDtoMappable {
const EmailAddressDto({
required this.address,
required this.id,
this.isDefault,
this.isVerified,
this.owningContactId,
});
final String address;
final String? id;
final bool? isDefault;
final bool? isVerified;
final String? owningContactId;
static EmailAddressDto fromJson(Map<String, dynamic> json) => EmailAddressDtoMapper.ensureInitialized().decodeMap<EmailAddressDto>(json);
}isVerified should also not be null.
Logs
Logs
[Paste your logs here]Dart version and used packages versions
Dart version
Dart SDK version: 3.11.1 (stable) (Tue Feb 24 00:03:07 2026 -0800) on "macos_arm64"Packages version
swagger_parser: 1.41.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels