Nested schema with a list field does not abide required
See original GitHub issueHave a nested schema using a list field and trying to make it required. A normal field within the same nested schema will enforce required just fine. The documentation states the list field inherits the same kwargs.
Here’s a stripped down version:
class Links(Schema):
states = fields.List(fields.String(), required=True) # Does not work
region = fields.Integer(required=True) # Works fine
class Job(Schema):
id = fields.Integer()
links = fields.Nested(Links)
I’ve also tried putting the required kwarg at the list string field level too.
Hope I have not overlooked something. The more I dug the more it started to look like a bug. Thank you!
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Troubles with validating nested values - Stack Overflow
And no need for many=True since you're putting the Nested field in a List field. Try this: class JsonSchema(BaseSchema): mode = fields.
Read more >5 Basic Materialized Views - Database - Oracle Help Center
Before starting to define and use the various components of summary management, you should review your schema design to abide by the following...
Read more >Google JavaScript Style Guide
1 Introduction. This document serves as the complete definition of Google's coding standards for source code in the JavaScript programming language.
Read more >Common Mistakes Developers Make In Their RAML Files
Plenty of developers upload only their main RAML file but do not provide the other referenced files. In general, a ZIP is required...
Read more >Valence
database error messages (such as a required field being missing, ... Not only are there nested lists of records (arrays), there are ......
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
If i understand the problem right:
Thanks @rastikerdar – that is the right approach; We probably don’t need to introduce the
allow_empty
parameter, as you can achieve the same validation usingvalidate.Length
@morgan Does that meet your use case?