-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
remote relationship create api #2850
Closed
tirumaraiselvan
wants to merge
17
commits into
hasura:master
from
tirumaraiselvan:add-remote-relationship-no-op
Closed
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e7a23cd
wip remote relationship create api
tirumaraiselvan c750a21
1) Tests for creation of remote relationships
nizar-m fe1a33f
Fix errors on remote query timeout test
nizar-m b6b0b2f
Test creation with multi-nested field
nizar-m 1ddd4f2
allow multiple list elements in join arguements
tirumaraiselvan 070f5a2
Remove xfail for tests with array args
nizar-m 88427cb
refactor
tirumaraiselvan 6443125
Merge pull request #61 from tirumaraiselvan/issue-60
tirumaraiselvan ba8f465
no-op
tirumaraiselvan 20de1a6
- Add python 3.7 to server-builder docker image
nizar-m 2a8baeb
fix the fixture for remote schema timeout tests
nizar-m f3687f1
Graphene 3 supports null value for input arguments.
nizar-m da92ef2
Merge branch 'add-remote-relationship-no-op' of github.com:tirumarais…
nizar-m 1edd8f7
Bring back ciignore
nizar-m 9433aa5
Merge pull request #65 from tirumaraiselvan/issue-63
tirumaraiselvan 2d9b323
remove hasura_fields from API
tirumaraiselvan c933b35
create functions
tirumaraiselvan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE ViewPatterns #-} | ||
|
||
module Hasura.RQL.DDL.RemoteRelationship | ||
( runCreateRemoteRelationship | ||
, runCreateRemoteRelationshipP1 | ||
) | ||
where | ||
|
||
import Hasura.GraphQL.Validate.Types | ||
|
||
import Hasura.EncJSON | ||
import Hasura.Prelude | ||
import Hasura.RQL.DDL.RemoteRelationship.Validate | ||
import Hasura.RQL.Types | ||
|
||
import qualified Data.HashMap.Strict as HM | ||
import qualified Data.Text as T | ||
import Instances.TH.Lift () | ||
|
||
runCreateRemoteRelationship :: | ||
(MonadTx m, CacheRWM m, UserInfoM m) => RemoteRelationship -> m EncJSON | ||
runCreateRemoteRelationship remoteRelationship = do | ||
adminOnly | ||
(_remoteField, _additionalTypesMap) <- | ||
runCreateRemoteRelationshipP1 remoteRelationship | ||
pure successMsg | ||
|
||
runCreateRemoteRelationshipP1 :: | ||
(MonadTx m, CacheRM m) => RemoteRelationship -> m (RemoteField, TypeMap) | ||
runCreateRemoteRelationshipP1 remoteRelationship = do | ||
sc <- askSchemaCache | ||
case HM.lookup | ||
(rtrRemoteSchema remoteRelationship) | ||
(scRemoteSchemas sc) of | ||
Just {} -> do | ||
validation <- | ||
getCreateRemoteRelationshipValidation remoteRelationship | ||
case validation of | ||
Left err -> throw400 RemoteSchemaError (T.pack (show err)) | ||
Right (remoteField, additionalTypesMap) -> | ||
pure (remoteField, additionalTypesMap) | ||
Nothing -> throw400 RemoteSchemaError "No such remote schema" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
monad-validate might remove some boilerplate
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.
I tried doing this and TBH it didn't make much of a difference. So just leaving this as is atm.