7/1/2023 0 Comments Graphql nested fragments![]() In GraphQL for AEM, the schema is flexible. For examples, see the Sample Queries (based on a sample Content Fragment structure for use with GraphQL). In this example, (the helper fields) _path, _metadata, _variations.Īfter a user creates a Content Fragment based on the Article model, it can then be interrogated through GraphQL. The other fields were added automatically by AEM, and represent helpful methods to provide information about a certain Content Fragment. ![]() Three of them have been controlled by the user: author, main, and referencearticle. This image shows that the generated type ArticleModel contains several fields. The corresponding GraphQL schema (output from GraphiQL automatic documentation): In addition, it creates some entrypoints for the queries that operate on this type, such as articleByPath or articleList. The fields within this type correspond to the fields and data types defined in the model. For example, it includes information that could be present as field names in the model definition.įor example, if a user created a Content Fragment Model called Article, then AEM generates a GraphQL type ArticleModel. This ability means that you must ensure that no sensitive data is available, as it could be leaked this way. ![]() To complete these guidelines, a client must fetch the Schema, which contains all the types necessary for a query.įor Content Fragments, the GraphQL schemas (structure and types) are based on Enabled Content Fragment Models and their data types.Īll the GraphQL schemas (derived from Content Fragment Models that have been Enabled) are readable through the GraphQL endpoint. The GraphQL specification provides a series of guidelines on how to create a robust API for interrogating data on a certain instance. GraphQL is a typed API, which means that data must be clearly structured and organized by type. If the user does not have read access to some fragments (stored as Assets), they do not become part of the result set.Īlso, the user must have access to a GraphQL endpoint to be able to run GraphQL queries. GraphQL queries are run with the permission of the AEM user of the underlying request. The permissions are required for accessing Assets.
0 Comments
Leave a Reply. |