-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[graphql-alt] Update IAddressable return types for partial error support [2/n] #24681
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| before: Option<balance::Cursor>, | ||
| ) -> Result<Option<Connection<String, Balance>>, RpcError<balance::Error>> { | ||
| let pagination: &PaginationConfig = ctx.data()?; | ||
| ) -> Option<Result<Connection<String, Balance>, RpcError<balance::Error>>> { |
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.
This makes me wonder if it might be better to pull these functions out into a separate impl block that returns Result<Option<...>, ...> and then here we call that function and transpose the result.
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.
Or I wonder if you could use your async { ... } trick here?
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.
Yes I have applied the async pattern we discussed on other PR
tpham-mysten
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.
Thanks for the review!
| before: Option<balance::Cursor>, | ||
| ) -> Result<Option<Connection<String, Balance>>, RpcError<balance::Error>> { | ||
| let pagination: &PaginationConfig = ctx.data()?; | ||
| ) -> Option<Result<Connection<String, Balance>, RpcError<balance::Error>>> { |
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.
Yes I have applied the async pattern we discussed on other PR
c030c27 to
236bdf2
Compare
…t [5/n] (#24684) ## Description Add partial error support for GraphQL resolvers in sui-indexer-alt-graphql by changing return types from Result<Option<T>, E> to Option<Result<T, E>> for MoveModule and MovePackage types. ## Test plan How did you test the new or updated feature? ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- ## Stack: - #24595 - #24681 - #24682 - #24683 - #24684 ⬅️ ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
…n] (#24683) ## Description Add partial error support for GraphQL resolvers in sui-indexer-alt-graphql by changing return types from Result<Option<T>, E> to Option<Result<T, E>> for Epoch, Checkpoint, and Validator types. ## Test plan How did you test the new or updated feature? ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- ## Stack - #24595 - #24681 - #24682 - #24683 ⬅️ - #24684 ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
…rt [3/n] (#24682) ## Description Add partial error support for GraphQL resolvers in sui-indexer-alt-graphql by changing return types from Result<Option<T>, E> to Option<Result<T, E>> for Transaction-related types. ## Test plan How did you test the new or updated feature? ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- # Stack: - #24595 - #24681 - #24682 ⬅️ - #24683 - #24684 ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
7309fb8 to
d6c8b65
Compare
…port [6/n] (#25108) ## Description Updates ServiceConfig return types from Result<Option<T>, E> to Option<Result<T, E>> for partial error support. Files changed: - crates/sui-indexer-alt-graphql/src/api/types/service_config.rs ## Test plan ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- ## Stack - #24595 - #24681 - #24682 - #24683 - #24684 - #25108 ⬅️ ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
… return types for partial error support [7/n] (#25109) ## Description Updates `IMoveObject` interface and its implementors (`MoveObject`, `CoinMetadata`, `DynamicField`) return types from `Result<Option<T>, E>` to `Option<Result<T, E>>` for partial error support. Files changed: - crates/sui-indexer-alt-graphql/src/api/types/move_object.rs - crates/sui-indexer-alt-graphql/src/api/types/coin_metadata.rs - crates/sui-indexer-alt-graphql/src/api/types/dynamic_field.rs ## Test plan How did you test the new or updated feature? ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- ## Stack - #24595 - #24681 - #24682 - #24683 - #24684 - #25108 - #25109 ⬅️ ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
…n] (#25110) ## Description Updates `Query` return types from `Result<Option<T>, E>` to `Option<Result<T, E>>` for partial error support. Files changed: - crates/sui-indexer-alt-graphql/src/api/query.rs ## Test plan How did you test the new or updated feature? ``` cargo nextest run -p sui-indexer-alt-e2e-tests ``` --- - #24595 - #24681 - #24682 - #24683 - #24684 - #25108 - #25109 - #25110 ⬅️ ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [x] GraphQL: Partial error will be properly supported in GraphQL. Invalid fields will have error messages and valid fields will still be displayed normally - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
Description
Enable partial error support in
sui-indexer-alt-graphqlby changing GraphQL resolver return types fromResult<Option<T>, E>toOption<Result<T, E>>.Pattern Migration
Changed ~30 files to use the Option<Result<T, E>> pattern with two main approaches:
Files Modified
move_object.rs
types
Test plan
How did you test the new or updated feature?
Stack
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.