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

Support none_value_handling and Missing #47

Merged
merged 6 commits into from Jun 23, 2022
Merged

Support none_value_handling and Missing #47

merged 6 commits into from Jun 23, 2022

Conversation

spaceorc
Copy link
Contributor

@spaceorc spaceorc commented Jun 23, 2022

  1. Support options & none_value_handling:
@dataclass
@mr.options(
    none_value_handling = mr.NoneValueHandling.INCLUDE,
    naming_case=mr.CAMEL_CASE,
)
class SomeData:
   ...
  1. Support MISSING as default value:
@dataclass
class SomeData:
  f1: str = mr.MISSING
  f2: str = mr.MISSING

data = SomeData(f1="str")
dumped = mr.dump(data)
assert dumped == {"f1": "str"}

loaded = mr.load(SomeData, {"f1": "str"})
assert loaded.f1 == "str"
assert loaded.f2 is ms.MISSING

@Pliner Pliner changed the title Feature/missing Support none_value_handling and Missing Jun 23, 2022
@Pliner Pliner merged commit 54f6348 into main Jun 23, 2022
@Pliner Pliner deleted the feature/missing branch June 23, 2022 13:27
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.

None yet

3 participants