Skip to content

Commit a8cba9c

Browse files
author
alida
committed
Fix KeyError @ fields to JSON:API schema rendering
As the field called id according to rules guided by JSON:API is required it's processing must be be excluded in iteration's control structure used to apply requirment state to fields being either child of property called attributes or relationships.
1 parent 48827a8 commit a8cba9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

starlette_jsonapi/openapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def fields2jsonschema(self, fields, *, ordered=False, partial=None):
106106
properties['attributes']['properties'][observed_field_name] = prop
107107
# TODO: support meta fields
108108

109-
if field_obj.required:
109+
if field_obj.required and field_name != 'id':
110110
if not partial or (
111111
is_collection(partial) and field_name not in partial
112112
):

0 commit comments

Comments
 (0)