Skip to content

Commit e7dce27

Browse files
committed
Loosen requirements for Upsert mutations (for templates)
1 parent a30f870 commit e7dce27

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

backend/infrahub/graphql/manager.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -787,25 +787,19 @@ class StatusUpsertInput(InputObjectType):
787787
attr_kind = get_attr_kind(schema, attr)
788788
attr_type = get_attribute_type(kind=attr_kind).get_graphql_update()
789789

790-
# A Field is not required if explicitly indicated or if a default value has been provided
791-
required = not attr.optional if not attr.default_value else False
792-
793-
attrs[attr.name] = graphene.InputField(attr_type, required=required, description=attr.description)
790+
attrs[attr.name] = graphene.InputField(attr_type, description=attr.description)
794791

795792
for rel in schema.relationships:
796793
if rel.internal_peer or rel.read_only:
797794
continue
798795

799796
input_type = self._get_related_input_type(relationship=rel)
800797

801-
required = not rel.optional
802798
if rel.cardinality == RelationshipCardinality.ONE:
803-
attrs[rel.name] = graphene.InputField(input_type, required=required, description=rel.description)
799+
attrs[rel.name] = graphene.InputField(input_type, description=rel.description)
804800

805801
elif rel.cardinality == RelationshipCardinality.MANY:
806-
attrs[rel.name] = graphene.InputField(
807-
graphene.List(input_type), required=required, description=rel.description
808-
)
802+
attrs[rel.name] = graphene.InputField(graphene.List(input_type), description=rel.description)
809803

810804
return type(f"{schema.kind}UpsertInput", (graphene.InputObjectType,), attrs)
811805

0 commit comments

Comments
 (0)