Skip to content

Commit 98696c1

Browse files
committed
#124: throw error on required added
1 parent 15b6ef8 commit 98696c1

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

example/model_generator/config.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,14 @@ OGM:
99
properties:
1010
structuredMessage: String?
1111
beneficiary:
12-
required: true
1312
type: String
1413
beneficiaryIBAN:
15-
required: true
1614
type: String
1715
test_Test:
18-
required: true
1916
type: String
2017
some_Thing:
21-
required: true
2218
type: String
2319
some_ThinG_huGE:
24-
required: true
2520
type: String
2621
securityRole:
2722
type: String?
@@ -50,7 +45,6 @@ Testing:
5045
structuredMessage:
5146
type: String?
5247
beneficiary:
53-
required: true
5448
type: String
5549
beneficiaryIBAN:
5650
type: String?
@@ -66,15 +60,13 @@ AdminProfileData:
6660
extends: UserProfileDataExtended
6761
properties:
6862
privileges:
69-
required: true
7063
type: String
7164

7265
UserProfileDataExtended:
7366
path: user/profile
7467
extends: UserProfileData
7568
properties:
7669
additionalField:
77-
required: true
7870
type: String
7971

8072
UserProfileData:
@@ -83,25 +75,18 @@ UserProfileData:
8375
explicit_to_json: true
8476
properties:
8577
firstName:
86-
required: true
8778
type: String
8879
lastName:
89-
required: true
9080
type: String
9181
standardLanguage:
92-
required: true
9382
type: String
9483
mainAccountNumber:
95-
required: true
9684
type: String
9785
legalEmail:
98-
required: true
9986
type: String
10087
phones:
101-
required: true
10288
type: Testing
10389
legalAddress:
104-
required: true
10590
type: OGM
10691
offTrack:
10792
include_if_null: false
@@ -119,10 +104,8 @@ Person:
119104
type: object
120105
properties:
121106
firstName:
122-
required: true
123107
type: String
124108
gender:
125-
required: true
126109
unknown_enum_value: X
127110
type: Gender
128111

@@ -158,7 +141,6 @@ Project:
158141
static_create: true
159142
properties:
160143
name:
161-
required: true
162144
type: String
163145
default_value: "'test'"
164146
cost:

lib/config/yml_generator_config.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ class YmlGeneratorConfig {
180180
Field getField(String name, YamlMap property,
181181
{required bool disallowNullForDefaults}) {
182182
try {
183+
if (property.containsKey('required')) {
184+
throw ArgumentError(
185+
'required is removed, follow the migration to version 7.0.0');
186+
}
183187
final ignored =
184188
property.containsKey('ignore') && property['ignore'] == true;
185189
final includeFromJson = !property.containsKey('includeFromJson') ||

0 commit comments

Comments
 (0)