Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@motorina0
Copy link
Collaborator

@motorina0 motorina0 commented May 22, 2024

Sumary:

  • Explicitly declare optional fields as Optional. This is is only required for editable fields.
  • This PR also fixes an incorrect uppercase name: LNBITS_SHOW_HOME_PAGE_ELEMENTS

Problem:
In the settings, a field of this form is considered optional:

my_filed: str = Field(default=None)

However, if the default value changes then the field is no longer considered optional.

my_filed: str = Field(default="Some Value")

Solution:

Optional fields are declared as Optional:

my_filed: Optional[str] = Field(default=None)

@motorina0 motorina0 marked this pull request as ready for review May 22, 2024 09:57
@codecov
Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.80%. Comparing base (44b458e) to head (43c04a7).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2530   +/-   ##
=======================================
  Coverage   61.80%   61.80%           
=======================================
  Files          69       69           
  Lines        9703     9703           
=======================================
  Hits         5997     5997           
  Misses       3706     3706           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@motorina0 motorina0 changed the title [fix] settings optional fields [fix] editable fields with default=None must be Optional May 22, 2024
@arcbtc arcbtc merged commit 07f0dc8 into dev May 22, 2024
@arcbtc arcbtc deleted the fix_settings_optional_fields branch May 22, 2024 13:03
motorina0 added a commit that referenced this pull request Jul 10, 2024
* fix: optional fields

* fix: bad uppercase field
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.

3 participants