Skip to content

Commit

Permalink
don't serialize none
Browse files Browse the repository at this point in the history
Summary:
it turns out serde serialise `None` as `"field": null`
Glean server fails to parse it, but works ok if there is no field

Reviewed By: alanz

Differential Revision: D55321543

fbshipit-source-id: be32270000b74f213dbf8e4c46605c094a8e7ac1
  • Loading branch information
perehonchuk authored and facebook-github-bot committed Apr 5, 2024
1 parent 6bd3230 commit ff9d544
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/elp/src/bin/glean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,11 @@ pub(crate) struct MacroTarget {
#[serde(rename = "file")]
file_id: GleanFileId,
name: String,
#[serde(skip_serializing_if = "Option::is_none")]
arity: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
expansion: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ods_url: Option<String>,
}

Expand Down Expand Up @@ -324,6 +327,7 @@ pub(crate) struct FuncDecl {
name: String,
arity: u32,
span: Location,
#[serde(skip_serializing_if = "Option::is_none")]
doc: Option<String>,
exported: bool,
deprecated: bool,
Expand All @@ -332,6 +336,7 @@ pub(crate) struct FuncDecl {
#[derive(Serialize, Debug)]
pub(crate) struct MacroDecl {
name: String,
#[serde(skip_serializing_if = "Option::is_none")]
arity: Option<u32>,
span: Location,
}
Expand Down

0 comments on commit ff9d544

Please sign in to comment.