aws / amazon-neptune-for-graphql

Amazon Neptune utility for GraphQL™ schemas and resolvers
Apache License 2.0
16 stars 1 forks source link

--input-schema-changes-file includes graph queries from files #10

Open AndreaNassisi opened 10 months ago

AndreaNassisi commented 10 months ago

The changes json file can include new graphql queries and mutations based on custom graph queries like:

[
    { "type": "Airport", "field": "outboundRoutesCountAdd", "action": "add", "value":"outboundRoutesCountAdd: Int @graphQuery(statement: \"MATCH (this)-[r:route]->(a) RETURN count(r)\")"},  
]

The issue is that the graph query needs to be flattened to a single line. When the graph query has multiple lines, it is difficult to author.

The proposal is to add to the changer statement the option of including a graph query from a file like:

[
    { "type": "Airport", "field": "outboundRoutesCountAdd", "action": "add", "value":"outboundRoutesCountAdd: Int @graphQuery(statement: \"${file(\"<my-query-file-name>\")}\")"},  
]

The file my-query-file-name will include a readable graph query, including CRs

MATCH (this)-[r:route]->(a) 
RETURN count(r)