@@ -65,11 +65,12 @@ public function generate(JsonApi $api): array
65
65
'properties ' => ['id ' => ['type ' => 'string ' , 'readOnly ' => true ]],
66
66
]);
67
67
68
- $ schemas ["{$ type }Create " ] = $ this ->buildSchema ($ resource , $ createSchema , [
69
- 'required ' => ['type ' ],
70
- ]);
68
+ $ schemas ["{$ type }Create " ] = $ this ->buildSchema ($ resource , $ createSchema );
71
69
72
- $ schemas ["{$ type }Update " ] = $ this ->buildSchema ($ resource , $ updateSchema );
70
+ $ schemas ["{$ type }Update " ] = $ this ->buildSchema ($ resource , $ updateSchema , [
71
+ 'required ' => ['type ' , 'id ' ],
72
+ 'properties ' => ['id ' => ['type ' => 'string ' ]],
73
+ ]);
73
74
}
74
75
75
76
return array_filter ([
@@ -91,10 +92,9 @@ private function buildSchema(Resource $resource, array $schema, array $overrides
91
92
return array_replace_recursive (
92
93
[
93
94
'type ' => 'object ' ,
94
- 'required ' => ['type ' , ' id ' ],
95
+ 'required ' => ['type ' ],
95
96
'properties ' => [
96
97
'type ' => ['type ' => 'string ' , 'const ' => $ resource ->type ()],
97
- 'id ' => ['type ' => 'string ' ],
98
98
'attributes ' => ['type ' => 'object ' ] + ($ schema ['attributes ' ] ?? []),
99
99
'relationships ' => ['type ' => 'object ' ] + ($ schema ['relationships ' ] ?? []),
100
100
],
0 commit comments