Comments (3)
Yes, in OpenAPI "date-time" implies iso and other formats should use a specific pattern.
https://stackoverflow.com/a/49379235
Let's label this a bug.
This deserves a new field2datetime
function in field_converter.py.
Help on this welcome.
Hopefully the correct regex for other formats can be found somewhere.
Users using custom format would have to define the regex themselves.
from apispec.
Yes, in OpenAPI "date-time" implies iso and other formats should use a specific pattern.
Yes but timestamp is a little different than custom date because it should have the type "integer"
instead of "string"
.
Also OpenAPI format is an open field so I think we should also add 'timestamp'
or 'timestamp_ms'
as format .
Hopefully the correct regex for other formats can be found somewhere.
I couldn't find any regex for RFC822 so I did my own:
^((Mon|Tue|Wed|Thu|Fri|Sat|Sun), ){0,1}\d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} (UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|(Z|A|M|N)|(\+|-)\d{4})$
Some example of it here: https://regex101.com/r/hOctM6/1
It's not perfect. Some DateTime string not conform with RFC822 will slip through but it's very descriptive and relatively short..
Users using custom format would have to define the regex themselves.
Yes. I think a pattern
parameter inside the metadata of field is a good place to put it.
Help on this welcome.
Here is my pull request : #815. I hope it's good with you!
from apispec.
resolved by #815 and released in 6.4.0
from apispec.
Related Issues (20)
- Issue with nested self-referencing schemas HOT 2
- marshmallow plugin does not support `marshmallow.fields.Tuple` HOT 1
- What is the correct way to use add_attribute_function in the Marshmallow plugin? HOT 2
- additionalProperties=false is not set when using default Marshmallow schema options HOT 2
- callbacks in operation are not resolved to refs HOT 5
- wrong default value for 'name' in schema2parameters HOT 3
- parameters not being resolved for OAS3 'content' type parameters HOT 2
- Incorrect handling of marshmallow nested schema with allow_none=True in OpenAPI 3.1 HOT 4
- Incorrect handling of Union types HOT 2
- Deprecated flag is not configured correctly on query parameter objects
- sdist is missing `tox.ini` HOT 1
- Interest in taking Schema description from Schema.__doc__ docstring
- Incorrectly serialized format when using a range validator on a Decimal Marshmallow field HOT 10
- Document form data and images
- Enum by_value creates OpenAPI property without type HOT 11
- Deprecate __version__ attribute
- Add requestBody component HOT 14
- How to get Schema added to components/parameters? HOT 5
- Thanks for the report! HOT 1
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 apispec.