-
Notifications
You must be signed in to change notification settings - Fork 2.8k
allow customising graphql schema for a table (close #981) #2509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolve Conflicts: server/src-lib/Hasura/Server/App.hs server/src-lib/Hasura/Server/Utils.hs
|
Deploy preview for hasura-docs ready! Built with commit 6309ce5 |
|
Review app for commit a19496d deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
|
@rakeshkky @0x777 why aren't we doing |
|
@ecthiender If you have a separate endpoint |
Resolve Conflicts: server/src-lib/Hasura/RQL/DDL/Schema/Table.hs server/src-lib/Hasura/RQL/Types/Common.hs
|
As of now, the only way to update I have a plan to add @0x777 @ecthiender @shahidhk thoughts? |
|
Review app for commit 48032f7 deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
It would be version nil (or 1) ideally, but if the code is easier managed if the version is 2, go ahead with 2. |
Resolve Conflicts: server/src-exec/Migrate.hs server/src-lib/Hasura/RQL/Types/SchemaCache.hs server/src-lib/Hasura/Server/App.hs server/src-lib/Hasura/Server/Query.hs
|
Review app for commit e0a5f4b deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
|
Review app for commit c8e1452 deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
|
Review app for commit 6b00fec deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
Resolve Conflicts: server/src-lib/Hasura/Server/Utils.hs
|
Review app for commit 7ffb524 deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
Resolve Conflicts: docs/graphql/manual/api-reference/schema-metadata-api/index.rst
|
Review app for commit 75f250e deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
dc67263 to
5973e2f
Compare
|
Review app for commit 5973e2f deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
Resolve Conflicts: server/src-exec/Migrate.hs server/src-lib/Hasura/GraphQL/Resolve/Insert.hs server/src-lib/Hasura/GraphQL/Resolve/Mutation.hs server/src-lib/Hasura/GraphQL/Resolve/Select.hs server/src-lib/Hasura/GraphQL/Schema.hs server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs server/src-lib/Hasura/GraphQL/Schema/Common.hs server/src-lib/Hasura/GraphQL/Schema/Mutation/Common.hs server/src-lib/Hasura/GraphQL/Schema/Select.hs server/src-lib/Hasura/RQL/DDL/Schema/Table.hs server/src-lib/Hasura/RQL/DML/Internal.hs server/src-lib/Hasura/RQL/DML/Returning.hs server/src-lib/Hasura/RQL/GBoolExp.hs server/src-lib/Hasura/RQL/Types/Column.hs
|
@lexi-lambda Please have a final glance. Suggest the changes if any. |
|
Review app for commit 6309ce5 deployed to Heroku: https://hge-ci-pull-2509.herokuapp.com |
shahidhk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
I am guessing console changes are going out as a separate PR |
|
Review app https://hge-ci-pull-2509.herokuapp.com is deleted |
…ra#2509) * allow customizing GraphQL root field names, close hasura#981 * document v2 track_table API in reference * support customising column field names in GraphQL schema * [docs] add custom column fields doc in API reference * add tests * rename 'ColField' to 'ColumnField' * embed column's graphql field in 'PGColumnInfo' -> Value constructor of 'PGCol' is not exposed -> Using 'parseJSON' to construct 'PGCol' in 'FromJSON' instances * avoid using 'Maybe TableConfig' * refactors & 'custom_column_fields' -> 'custom_column_names' * cli-test: add configuration field in metadata export test * update expected keys in `FromJSON` instance of `TableMeta` * use `buildSchemaCacheFor` to update configuration in v2 track_table * remove 'GraphQLName' type and use 'isValidName' exposed from parser lib * point graphql-parser-hs library git repo to hasura * support 'set_table_custom_fields' query API & added docs and tests
Requires merging hasura/graphql-parser-hs#17
TODO:-
Description
Allow users to customize root field names of a Postgres table and column fields in GraphQL schema. However, original Postgres column names are used to define metadata such as relationships, permissions etc.
Default root field names generated for a table
authorare:Queries:-
authorauthor_by_pkauthor_aggregateMutations:-
insert_authordelete_authorupdate_authorTODO:- insert UI screenshots after console work is done.
Note:- Only root field names and columns are customizable as of now. I'm open to any request for customizing other parts of Hasura generated GraphQL schema
Affected components
Related Issues
#981
Solution and Design
A new optional
versionfield whose type isIntis introduced in/v1/querypayload which specifiesthe version of the query. If absent
versionis considered as1. All existing query types come underversion: 1track_tablequery type is supported inversion: 2.Example:-
A new
set_table_custom_fieldsquery type is added inversion: 2. It is used to update the custom field names of an already tracked table.Example:-
Catalog changes:-
A new nullable column
configurationof typeJSONBis added to tablehdb_catalog.hdb_tablewhich stores the configuration JSON object found intrack_tablev2query.For Console:
Refer docs to learn more about new
track_tableversion2API.NOTE: Tracking an already tracked table using version2track_tableAPI won't throw API exception, instead it'll update the configuration in metadata cache and catalog.Steps to test and verify
Limitations, known bugs & workarounds