Can't use Rust reserved keywords in Event extra_keys as key names
Categories
(Data Platform and Tools :: Glean: SDK, defect)
Tracking
(Not tracked)
People
(Reporter: jteow, Unassigned)
References
Details
STR
Create an Event with extra_keys
containing a property name with reserved keyword in the Rust language (e.g. type
).
// metrics.yaml
example:
...
type: event
extra_keys:
type:
description: Lorem ipsum.
type: string
Then, try to compile Firefox.
Result
The struct
representing the extra properties will contain properties that will cause Rust compilation errors during the firefox-on-glean
step. Should get the "expected identifier, found keyword type
".
// metrics.rs
pub struct SomeExtra {
pub type: Option<String>
}
Comment 1•2 years ago
|
||
Yeah, this is a known issue, see also bug 1800904.
Question:
- Are you using the generated Rust API or the C++ or JavaScript API?
- If using the Rust API, would you expect to use
r#type
in your code?
Reporter | ||
Comment 2•2 years ago
|
||
I'm using the Javascript API for Firefox Desktop. For now, I got Data Science to approve a property name change to unblock the story.
Might be sufficient just to say that limitation that in the documentation.
Comment 3•2 years ago
|
||
(In reply to James Teow [:jteow] from comment #2)
I'm using the Javascript API for Firefox Desktop. For now, I got Data Science to approve a property name change to unblock the story.
Might be sufficient just to say that limitation that in the documentation.
Thanks. Yeah, we'll have to figure out something here.
Updated•2 years ago
|
Description
•