Skip to content

Default to false for text styles#306

Merged
motnyk merged 1 commit intomasterfrom
use_default_values_for_text_styles
Nov 28, 2022
Merged

Default to false for text styles#306
motnyk merged 1 commit intomasterfrom
use_default_values_for_text_styles

Conversation

@motnyk
Copy link
Copy Markdown
Contributor

@motnyk motnyk commented Nov 28, 2022

We broke the serialization of TextStyleIF in #304 because if Optional is empty we pass "code": null to Slack and it returns us response like this:

{
  "ok" : false,
  "error" : "invalid_blocks",
  "warning" : "missing_charset",
  "response_metadata" : {
    "messages" : [ "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/1/style/italic]", "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/1/style/strike]", "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/1/style/code]", "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/7/style/bold]", "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/7/style/italic]", "[ERROR] must be a boolean [json-pointer:/blocks/0/elements/0/elements/7/style/strike]" ],
    "warnings" : [ "missing_charset" ]
  }
}

We have to exclude the fields completely if Optional is empty or make them default to false. I think the latter option makes way more sense since Optional<Boolean> itself doesn't make a lot of sense and only complicates the interaction the code.

@motnyk motnyk requested a review from nliutyi-hs November 28, 2022 17:47
@motnyk motnyk merged commit 53221e2 into master Nov 28, 2022
@motnyk motnyk deleted the use_default_values_for_text_styles branch November 28, 2022 17:49
nliutyi-hs added a commit that referenced this pull request Nov 28, 2022
nliutyi-hs added a commit that referenced this pull request Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants