Metafield value support or documentation
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by reviewing the shopify_function crate's metafield handling and the generated types concern in issue #17. Compare this with the referenced Shopify Function API example and the custom types shown in api.rs; done should be a clear documented path for handling metafield values, or a defined support change if documentation is insufficient.
Written by the indexing model from the issue text.
Description
I found it confusing to use the shopify_function crate for the metafield data types being passed between Shopify and the Function.
One issue was the inability to preview / see the generated types, which I see an existing issue for: https://github.com/Shopify/shopify-function-rust/issues/17
Here is an example of a function API that sends metafields: https://shopify.dev/docs/api/functions/reference/order-routing-location-rule/graphql/common-objects/metafield
The metafield value is passed from Shopify to the function as a string and I found the support for this in shopify_function not clear.
When not using this crate and generating types myself in api.rs, I ended up doing something like this to handle the metafield format:
pub struct Metafield {
pub value: Option<String>,
}
pub struct Configuration {
pub value: Option<ExampleGroups>,
}
impl Configuration {
fn from_str(value: &str) -> Self {
// ExampleGroups::from_str constructs the JSON from the metafield string value
Configuration { value: Some(ExampleGroups::from_str(&value)) }
}
fn default() -> Self {
Configuration {
value: None,
}
}
}
pub fn parse_function_configuration_value(metafield: Option<Metafield>) -> Configuration {
match metafield.and_then(|m| m.value) {
Some(value) => Configuration::from_str(&value),
None => Configuration::default(),
}
}
- Dominant language
- Rust
- Stars
- 47
- Forks
- 9
- Avg merge
- 1h 53m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/shopify-function-rust
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Shopify/shopify-function-rust#169 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 58/100
Shopify/shopify-function-rust#132 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
All issues in Shopify/shopify-function-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug team:backend track:services-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cowprotocol/services#4950 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·