Annotation based mutation sample in the docs #4705
-
The example labeled Annotation-based at https://chillicream.com/docs/hotchocolate/defining-a-schema/mutations#usage doesn't have an annotation or I don't understand it: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
While "Annotation-based" implies the usage of an attribute, in this example it only means we are not using Code-first APIs such as a To explain the example: The class "Mutation" represents a GraphQL object type of the same name with a field called "addBook". The method called "AddBook" is what computes the value for said field. |
Beta Was this translation helpful? Give feedback.
While "Annotation-based" implies the usage of an attribute, in this example it only means we are not using Code-first APIs such as a
descriptor
andObjectType
. In general you can think of "Annotation-based" as "I write regular classes/records and sprinkle in some Hot Chocolate functionality using attributes when necessary".To explain the example: The class "Mutation" represents a GraphQL object type of the same name with a field called "addBook". The method called "AddBook" is what computes the value for said field.