Usage of allowed and nullable params
See original GitHub issueI’m have a issues when use allowed and nullable params
Use-case abstract
schemas = [
{'role': {'type': 'string', 'allowed': ['agent', 'client', 'supplier']}},
{'role': {'type': 'string', 'allowed': ['agent', 'client', 'supplier', None]}},
{'role': {'type': 'string', 'allowed': ['agent', 'client', 'supplier'], 'nullable': True}},
{'role': {'type': 'string', 'allowed': ['agent', 'client', 'supplier', None], 'nullable': True}},
{'role': {'type': 'string', 'nullable': True}},
]
data = [
{'role': 'agent'},
{'role': None},
]
Output from cerberus
Version - 1.2
Schema # Data
1 True False
2 True False
3 True False
4 True True
5 True True
Version - 1.1
Schema # Data
1 True False
2 True False
3 True True
4 True True
5 True True
Bug report / Feature request
As we can see in v1.2 have different ouput with nullable param (3td schema). It looks like a bug In my oppinion v1.1 working more properly
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using Optional and Nullable Properties in API Requests
Learn how optional and nullable properties can be used flexibly in combinations in each parameter of your API requests made from a SDK....
Read more >Simplified parameters, nullable means optional #2232 - GitHub
Omitting an argument means that null will be the value of the parameter, unless it has a default value, then the default value...
Read more >Nullable and @NotNull - IntelliJ IDEA - JetBrains
@Nullable The @Nullable annotation helps you detect: Method calls that can return null. Variables (fields, local variables, and parameters), that can be null....
Read more >How to allow for null parameters in API Attribute Routing?
Is there a way I can modify the route to allow for when 1 or more parameters are null/empty strings?
Read more >Java: Why not allow nulls in methods to represent optional ...
In general it is a bad idea to use null to indicate an optional value. It is a bad idea whether it is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like 74c015b57a7224d1a6fdc30e7c7f0779489c39df introduced the change.
It seems that allowed needs to be added the the call to _drop_remaining_rules in order to match the 1.1 behavior.
no, on the contrary,
no rules were skipped at allsome rules caused remaining rules to be dropped, others didn’t.