Comments (2)
So, fields are required unless they have a default value set. (Eg. Similar to arguments on a Python function)
Using default=None or default=“” would make the field optional, and indicate what value should be used when it is missing. (Also, allow_blank and allow_null will set a corresponding default, too)
See first section of https://www.encode.io/typesystem/fields/
from typesystem.
So, typesystem doesn't really support true optional fields. This is a problem with the data I'm working with (Google Music). There are plenty of fields that may simply not exist in the data. For many, it either doesn't make sense to default the values or might actually cause calls to fail. Some of these include YouTube video references, album art links, attributions, rating, last rating timestamp, and more. Every other schema library I've used before supported true optional fields. This is a deal-breaker as far as my current use case and at least one potential use case is concerned.
from typesystem.
Related Issues (20)
- Test failures on python3.8/python3.9
- `Email` field
- `URL` field
- `IPAddress` field
- `File` field HOT 1
- `Image` field HOT 1
- References are broken for JSON schema (0.4.0) HOT 5
- Quickstart example presented in the README does not work HOT 1
- UnboundLocalError: local variable 'field' referenced before assignment
- Serialization of reference fields in composite fields HOT 1
- Time fields deserialized as strings instead of datetime objects HOT 1
- Dynamic Choice fields
- fields.Choice to include list of choices in validation error message HOT 1
- Nested `Schema` instantiation
- Cross field and conditional validation
- datetime incompatibility with JSON schema and OpenAPI specification
- IntegerField allows string HOT 1
- Generation of typesystem classes from orm/sqlalchemy models (On-the-fly or command based)
- Adding `title` and `description` to JSON Schema for Fields
- HTML Radiobutton field
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typesystem.