Skip to content
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

Consider exposing generated output struct types #60

Closed
dphm opened this issue Apr 19, 2024 · 0 comments · Fixed by #61
Closed

Consider exposing generated output struct types #60

dphm opened this issue Apr 19, 2024 · 0 comments · Fixed by #61

Comments

@dphm
Copy link
Contributor

dphm commented Apr 19, 2024

I changed tests to assert JSON output instead of using structs because the generated structs are in a private module.

You could revert that change if the output types are made public, which might also be helpful for docs.

Error:

d@Delta-Shopify shopify-function-rust % cargo t
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling shopify_function_macro v0.5.0 (/Users/d/src/github.com/Shopify/shopify-function-rust/shopify_function_macro)
   Compiling shopify_function v0.5.0 (/Users/d/src/github.com/Shopify/shopify-function-rust/shopify_function)
   Compiling example_with_targets v1.0.0 (/Users/d/src/github.com/Shopify/shopify-function-rust/example_with_targets)
   Compiling example v1.0.0 (/Users/d/src/github.com/Shopify/shopify-function-rust/example)
error[E0603]: module `output` is private
  --> example_with_targets/src/tests.rs:16:37
   |
16 |     let expected = crate::target_a::output::FunctionTargetAResult { status: Some(200) };
   |                                     ^^^^^^  --------------------- struct `FunctionTargetAResult` is not publicly re-exported
   |                                     |
   |                                     private module
   |
note: the module `output` is defined here
  --> example_with_targets/src/lib.rs:4:1
   |
4  | / #[shopify_function_target(
5  | |     // Implicit target = "example.target-a"
6  | |     // Implicit generated module name = "target_a"
7  | |     query_path = "a.graphql",
8  | |     schema_path = "schema.graphql"
9  | | )]
   | |__^
   = note: this error originates in the attribute macro `shopify_function_target` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: module `output` is private
  --> example_with_targets/src/tests.rs:32:34
   |
32 |     let expected = crate::mod_b::output::FunctionTargetBResult {
   |                                  ^^^^^^  --------------------- struct `FunctionTargetBResult` is not publicly re-exported
   |                                  |
   |                                  private module
   |
note: the module `output` is defined here
  --> example_with_targets/src/lib.rs:16:1
   |
16 | / #[shopify_function_target(
17 | |     // Explicit target if function name does not match target handle
18 | |     target = "example.target-b",
19 | |     // Override generated module name
...  |
22 | |     schema_path = "schema.graphql"
23 | | )]
   | |__^
   = note: this error originates in the attribute macro `shopify_function_target` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0603`.
error: could not compile `example_with_targets` (lib test) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

Originally posted by @dphm in #51 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant