Skip to content

Commit

Permalink
feat(api): support entity spans format (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-prosser authored Apr 3, 2024
1 parent 0c22d50 commit 028337a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Add `get emails`
- Added support for `--auto-increase-up-to` when creating quotas.
- Support spans format for entities

# v0.22.2

Expand Down
18 changes: 16 additions & 2 deletions api/src/resources/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,26 @@ fn should_skip_serializing_entities(maybe_entities: &Option<Entities>) -> bool {
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)]
pub struct NewEntity {
#[serde(untagged)]
pub enum NewEntity {
WithSpan(NewEntityWithSpan),
WithSpans(NewEntityWithSpans),
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)]
pub struct NewEntityWithSpan {
pub name: EntityName,
pub formatted_value: String,
pub span: NewEntitySpan,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)]
pub struct NewEntityWithSpans {
pub name: EntityName,
pub formatted_value: String,
pub spans: Vec<NewEntitySpan>,
}

#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, Eq)]
pub struct NewEntitySpan {
content_part: String,
Expand All @@ -793,7 +807,7 @@ pub struct NewEntitySpan {
pub struct Entity {
pub name: EntityName,
pub formatted_value: String,
pub span: EntitySpan,
pub spans: Vec<EntitySpan>,
}

#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, Eq)]
Expand Down

0 comments on commit 028337a

Please sign in to comment.