dotansimha / dotansimha/graphql-code-generator-community
Merge allow-list collections from hasura-allow-list
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Is your feature request related to a problem? Please describe.**
The Hasura plug-in is great for generating allow lists – however, if you have allowed queries from multiple sources (e.g. a hasura REST API), then this plugin overwrites the allow list collections every time.
**Describe the solution you'd like**
`hasura-allow-list` is best written to: `metadata/query_collections.yaml`. This file looks like:
```
- name: rest-allowed-queries
definition:
queries:
- name: getCustomQuery2 REST
query: |
query getCustomQuery2($id: Int!) {
user: users(where: {id: {_eq: $id}}, limit: 1) {
id
foobar
}
}
- name: web-allowed-queries
definition:
queries:
- name: getCustomQuery
query: |-
query getCustomQuery($id: Int!) {
user: users(where: {id: {_eq: $id}}, limit: 1) {
id
}
}
```
The file `allow_list.yaml` specifies which collections to utilize in the hasura allow list:
```
- collection: rest-allowed-queries
scope:
global: true
- collection: web-allowed-queries
scope:
global: true
```
If I use the hasura allow list codegen plugin, the plugin should overwrite only the specified `collectionName` (default `allowed-queries`) and leave any other collections intact. As of now it overwrites the entire file and blasts away my allowed queries for the REST api.
**Describe alternatives you've considered**
I've tried to figure out if I can just write to a file and merge it in, but haven't found a way.
**Additional context**
Let me know if you need more context. Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.