Toshi
My feedback
-
5 votes
Toshi supported this idea ·
-
1 vote
Toshi shared this idea ·
-
2 votes
Toshi supported this idea ·
-
4 votes
An error occurred while saving the comment Toshi shared this idea ·
-
1 vote
Toshi shared this idea ·
-
2 votes
Toshi supported this idea ·
-
3 votes
Toshi supported this idea ·
-
3 votes
Toshi supported this idea ·
-
2 votes
Toshi supported this idea ·
-
2 votes
Toshi supported this idea ·
-
4 votes
Toshi supported this idea ·
-
3 votes
An error occurred while saving the comment Toshi commented
Hi Sumedha, sorry for the delay and thanks for the reply.
> I was able to generate typescript types using the endpoint with GQL Codegen
I will check that again. Last time I tried, it generates a schema which has a lot of @deprecated directives. Is it expected?> The one thing I can think of is including the authorization header
Yes, that was a trap, but I think I solved: I got an access token running curl with API key, and put the token in codegen.yml like: (indent/space is broken here)schema:
- https://realm.mongodb.com/api/client/v2.0/app{my app id here}/graphql:
headers:
Authorization: Bearer {token here}This gave me a schema but with @deprecated directives.
> You should be able to do this on the 'SDKs' tab in the UI.
SDKs tab looks great! (I thought I once checked this tab, I maybe overlooked, sorry..)
One question; are these code snippets only accessible on this page? Could I get them through CLI like graphql-codegen?An error occurred while saving the comment Toshi commented
Hi Sumedha, thank you for response. I'm sorry I didn't notice your comment, and I even updated my post after you commented. So you might find some diffs between what you initially read and the current text above. I just didn't expect any response! Sorry and thanks.
So, I started a scratch web-app project. I used React(Next.js) and Apollo client for GraphQL requests. I read many doc pages, but basically followed this one:
https://docs.mongodb.com/realm/tutorial/web-graphql/I created Atlas cluster -> Put some data in collection -> Initialized Realm -> Clicked "Generate schema" button and got schemas by sampling -> Went to the GraphQL page and tried some queries-> Downloaded schema.graphql by clicking button there -> Setup graphql-codegen's yml file locally.
> Is the Web UI you're referring to here, the Atlas/Compass UI?
I referred to the web pages, whose domains are cloud.mongodb.com / realm.mongodb.com.As for your question about difference of #3 and #6:
In addition to a frontend app with React, I'm writing some serverless functions too. I used Next.js(Vercel) build-in functions feature here. On the server side, I wanted to try Realm node.js SDK instead of Apollo, because it looked simpler and attractive in how it defines and handles relationship.
So I read over Realm Node.js SDK docs, but I couldn't come up with good way to keep DRY to align schemas between frondend and function. I also tried realm-cli and got local json schema files (`rules/tracker.users.json` file etc). I thought the json schema files can be the source-of-truth. Is there any way to convert the json schema to realm object schema, or vice versa? Especially I'm lost in which to define relationships. I checked 3rd party tooling (for example quicktype.io), but I couldn't find a good way to go.
Also, I felt that these local json files are not expected to be edited repeatedly. For this need, I put up another idea (maybe I'm wrong):
https://feedback.mongodb.com/forums/930808-mongodb-cli/suggestions/41158219-push-local-settings-pull-remote-settingsOne more note; I think graphql-codegen is really well developed, so GraphQL->TypeScript conversion is ok. I should say JSON->GraphQL->TypeScript schema generation is greatly automated already. One minor problem is currently realm's `schema.graphql` file is only downloadable from the "Download Schema Button" if I'm right. It would be great to download it programatically. I usually use the remote graphql endpoint for the schema path on the codegen.yml file. However with Realm GraphQL endpoint it didn't work correctly, so I use the manually downloaded file instead.
Sorry for the long comment. If I'm behaving not as you recommended/expected (maybe so), please point out. For further communication, I'll be happy to continue with emails.
Toshi shared this idea ·
-
6 votes
Toshi shared this idea ·
-
6 votes
Toshi shared this idea ·
-
2 votesunder review · 0 comments · Realm » Realm Application Development · Flag idea as inappropriate… · Admin →
Toshi supported this idea ·
-
2 votes
Toshi supported this idea ·
-
5 votes
Toshi supported this idea ·
-
17 votes
An error occurred while saving the comment Toshi commented
Not only for functions, but also please consider local tooling for graphql.
AWS Amplify has a local development feature which is really useful. Just run a simple command `amplify mock api` then you get a locally running graphql endpoint. It really speeds up both development and testing.
Toshi supported this idea ·
-
15 votes
Toshi supported this idea ·
-
15 votes
Toshi supported this idea ·
FYI:
SearchKit, a great UI library for ElasticSearch, has released v3 a few days ago. Good news is that it decoupled with ElasticSearch and introduced GraphQL layer in-between, which might mean there would be possibility for Atlas Search to utilize it.
- https://blog.searchkit.co/searchkit-v3-enter-graphql-330e1aa5752d
- https://blog.searchkit.co/searchkit-why-graphql-aa886603b698