feat: implement GraphQL interface to the middleware DB#2162
feat: implement GraphQL interface to the middleware DB#2162
Conversation
| # Ensure consistent node name for tests to match persisted DB owner (avoids :wrong_db_owner_node) | ||
| config :kernel, :distributed, [:'aeternity@localhost'] | ||
|
|
||
| # Do not start embedded node services for GraphQL/data correctness tests to avoid DB owner mismatch | ||
| # Use full node services in tests; ensure you invoke tests with: | ||
| # elixir --name aeternity@localhost -S mix test | ||
| config :ae_mdw, :start_node_services, true | ||
| config :ae_mdw, :sync, true | ||
|
|
There was a problem hiding this comment.
Should this file be restored from master? Is there a reason for this change?
docs/graphql.md
Outdated
| --- | ||
| ## Security Considerations | ||
| - Depth & complexity limits are not yet enforced (add them before exposing publicly). | ||
| - Rate limiting is inherited from existing stack (none specific to GraphQL yet). | ||
| - User input is limited to IDs now; later additions must validate pagination cursors and filters. | ||
|
|
||
| --- | ||
| ## Contributing | ||
| Open a PR adding new fields and include: | ||
| - Schema changes | ||
| - Resolver(s) | ||
| - Unit tests (success + failure) | ||
| - Brief addition to this doc (Roadmap or new section) | ||
|
|
||
| --- | ||
| ## FAQ | ||
| **Why Absinthe instead of generating GraphQL from REST automatically?** | ||
| Absinthe offers strong flexibility, custom middleware, and Elixir-native patterns for batching and instrumentation. | ||
|
|
||
| **Will REST be deprecated?** | ||
| Not in the short term. GraphQL is additive and will target aggregate and selective data retrieval patterns first. | ||
|
|
||
| **How do I enable GraphiQL in prod for debugging?** | ||
| You should not. If absolutely necessary, guard it behind an env flag and temporary branch only. | ||
|
|
||
| --- | ||
| ## Support / Contact | ||
| File an issue in the repository with the `graphql` label for feature requests or bugs. |
| import_types(AeMdwWeb.GraphQL.Schema.Helpers.CustomTypes) | ||
|
|
||
| import_types(AeMdwWeb.GraphQL.Schema.Types.AccountTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.BlockTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.ContractTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.NameTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.StatsTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.StatusTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.TransactionTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.ChannelTypes) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.Aex9Types) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.Aex141Types) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Types.OracleTypes) | ||
|
|
||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.AccountQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.BlockQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.ContractQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.NameQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.StatsQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.StatusQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.TransactionQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.ChannelQueries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.Aex9Queries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.Aex141Queries) | ||
| import_types(AeMdwWeb.GraphQL.Schema.Queries.OracleQueries) |
There was a problem hiding this comment.
Maybe allow import_types to take a list as well?
import_types([
AeMdwWeb.GraphQL.Schema.Types.AccountTypes,
AeMdwWeb.GraphQL.Schema.Types.BlockTypes
])Or maybe even multi-arg if possible
There was a problem hiding this comment.
I have tried this, but it's not running. Maybe it's not possible to do so?
|
@radrow For docs auto generation, first run the mdw locally, and then run |
|
@radrow I have noticed this endpoint |
There was a problem hiding this comment.
The entire file needs a rewrite.
There was a problem hiding this comment.
@radrow the change here seems random. Is this an intended change?
No description provided.