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

feat(api): support entity spans format #264

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading