json-to-graphql-query
json-to-graphql-query copied to clipboard
Where and how declare fragments?
I see that ConfigurablePost turns into a fragment, but where and how it should be declared? as a object? as a graphql string? where it should be? inside query property? The docs is not clear.
import { jsonToGraphQLQuery } from 'json-to-graphql-query';
const query = {
query: {
Posts: {
title: true,
__all_on: [
"ConfigurablePost",
"PageInfo"
]
}
}
};
const graphql_query = jsonToGraphQLQuery(query, { pretty: true });
+1