Comments (13)
@ddorian We can't use marshmallow (or any other existing library) here because they wouldn't fulfil our design criteria of:
- Actual type subclasses, that we can then validly use as type annotations.
- 1:1 mapping onto JSON Schema.
from apistar.
May I suggest PyDantic?
It supports type annotations out of the box and type subclasses.
It's pretty young but so is APIStar so it's still a good opportunity to switch.
from apistar.
Is there any movement on Nullable? Or is there a workaround? I'm trying to setup apistar with SQLAlchemy and I get validation errors when None
is passed to a schema, even if there is a default. I can't figure out any way to make it work.
from apistar.
APIStar is a very enjoyable framework with a lot of nice ideas.
@thedrow I just made a library to APIStar use PyDantic as typesystem. Seems fine to me, I really liked it. https://github.com/pslacerda/apistar_pydantic/
Enum
and list
needs more testing. Optional
(or nullable) , Union
and recursive models support aren't done yet.
Maybe you should use Optional
for nullable fields, but maybe is better to add Object(nullable=True)
as it look less ugly.
Keep the good work!
from apistar.
... why not just use marshmallow ? Aren't you doing too much this way (like django with friends) ?
The same for swagger etc.
from apistar.
Not yet, tho certainly on the immediate roadmap yup.
Sketching out next steps, here... https://github.com/encode/apistar/projects/1
from apistar.
required will be a future argument?
from apistar.
Most likely that, or something similar yes, but needs some thinking about first.
from apistar.
Is there any way to define a schema property as read only? I am needing that to use in a property like 'id', to prevent user send an id in a create / post method.
p.s: So far APIStar is the best api framework I've ever seen and used.
from apistar.
Any plans yet to add a way to make a field be required? I've tried typesystem.string(min_length=1)
and it seems to allow missing a field.
from apistar.
Aha, I found the required
option for typesystem.Object
.
from apistar.
Any progress on supporting nullable? typesystem.Object would become really useful with it.
from apistar.
Will it be possible to use Union
as a type?
from apistar.
Related Issues (20)
- Error: Missing option "--path" invoking `apistar validate` HOT 1
- KeyError on invoking `apistar validate` HOT 2
- CLI arguments are not validated correctly.
- Dependency incompatible with Python 3.5 HOT 2
- Sample API documentation
- Selecting a server or setting a custom endpoint HOT 4
- No repr or str on some exceptions
- Schema Validation not correct for payload structure
- No validation of requestBody schemas HOT 3
- static_url kwarg to apistar.docs is not enough
- ValidationError: All object keys must be strings HOT 4
- Handle deprecated links and parameters
- no module named apistar HOT 2
- requestBody media types are not handled generically
- consistent file extension for YAML
- Fix simple typo: agnositic -> agnostic
- tests improvements HOT 1
- Unable to run .exe file
- Doing async requests HOT 3
- Can you publish a wheel?
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 apistar.