Commit graph

262 commits

Author SHA1 Message Date
Artur Maciag
24276bf37a Unify find path method of request validator 2020-02-25 09:08:30 +00:00
Artur Maciag
18944893f7 Version 0.13.2 2020-02-24 10:00:28 +00:00
Artur Maciag
35da0289c1 Version 0.13.1 2020-02-18 12:06:23 +00:00
A
01e04ff0cb
Merge pull request #200 from p1c2u/fix/validators-shortcuts-fix
Validators shortcuts fix
2020-02-18 12:04:53 +00:00
Artur Maciag
3ca531a485 Validators shortcuts fix 2020-02-18 11:57:15 +00:00
Artur Maciag
15e9c28175 Flask error handler status fix 2020-02-18 11:51:42 +00:00
Artur Maciag
912f0afc7a Version 0.13.0 2020-02-17 16:46:25 +00:00
Artur Maciag
1bea6013c3 Property read-only and write-only support 2020-02-17 12:42:13 +00:00
Pedro Peixoto
975ac0d7c9 Updating unmarshal and validation methods' signatures to propagate the context until reaching the properties. 2020-02-17 12:25:44 +00:00
Pedro Peixoto
8260426b91 Creating a decorator that warns the developer whenever he fails to set a context. 2020-02-17 12:23:40 +00:00
Pedro Peixoto
aa95bc5d02 Providing a context whenever unmarshalling objects on Request and Responses
(readOnly and writeOnly applies on to properties)
2020-02-17 12:17:44 +00:00
Pedro Peixoto
ca369f795a Creating read_only and write_only properties on the Schema 2020-02-17 12:14:46 +00:00
Artur Maciag
e0d61c8f11 OpenAPI request datatype refactor 2020-02-11 14:54:36 +00:00
Artur Maciag
aa7ed31acd Missing path model fields 2020-02-07 11:21:11 +00:00
Artur Maciag
fde1b6bdc5 Security providers and security models retouch 2020-02-04 13:58:42 +00:00
Artur Maciag
4ae5a085a3 Security HTTP scheme type support 2020-02-04 11:14:51 +00:00
p1c2u
d915f23414 Security validation with Api Key support 2020-02-04 11:06:52 +00:00
p1c2u
75643da1af Free-form objects unmarshal 2020-02-03 20:58:27 +00:00
p1c2u
d4ac0978d5 Missing Info models 2020-02-03 19:50:21 +00:00
Artur Maciag
ab2e10f998 Custom media type deserializers 2020-02-03 18:35:48 +00:00
Artur Maciag
4044483194 style fixes 2020-02-03 14:55:50 +00:00
Artur Maciag
6d8b2e5111 Move media deserializers to separate subpackage 2020-02-03 13:34:43 +00:00
Artur Maciag
58d5c26fee Move param deserializers to separate subpackage 2020-02-03 13:05:44 +00:00
Artur Maciag
7b87cf9019 Move value getters out of schema models 2020-02-03 11:29:01 +00:00
Artur Maciag
faa8164f9a Request and response data validation process refac 2020-02-03 11:13:37 +00:00
Artur Maciag
7da1ea6b77 Get rid of cast in schema 2020-02-03 10:59:27 +00:00
Artur Maciag
b4c10e847a Split cast and deserialise processes 2020-02-03 10:17:27 +00:00
Artur Maciag
475076a2a2 Deserialize models without schema 2020-02-03 09:31:02 +00:00
p1c2u
61fb830ac2 Get rid of unmarshal in schema 2020-02-03 01:30:25 +00:00
p1c2u
3f7442624a Move unmarshal out of schema models 2020-02-02 22:56:25 +00:00
p1c2u
991c58627f Wrappers cleanup 2020-02-02 11:16:03 +00:00
Artur Maciag
376dc205ae unmarshalling formatters 2020-02-01 23:50:56 +00:00
Artur Maciag
6b6abc0b01 Move schema validator to separate subpackage 2020-01-28 09:51:09 +00:00
A
c3f9adadaa
Merge pull request #184 from p1c2u/refactor/move-casters-to-subpackage
Move casters to separate subpackage
2020-01-27 13:24:08 +00:00
Artur Maciag
5059f05396 Flask OpenAPI request parameters 2020-01-27 11:23:20 +00:00
p1c2u
b5aabf213c FlaskOpenAPIView handler change 2020-01-26 23:29:19 +00:00
Artur Maciag
0f7fa5287e Python 3.5 json binary input deserialization fix 2020-01-24 21:02:00 +00:00
Artur Maciag
0d0fa524cf Flask OpenAPI view 2020-01-24 21:01:21 +00:00
p1c2u
368f6882e5 Move casters to separate subpackage 2020-01-23 22:48:34 +00:00
p1c2u
b026fb2151 Move Unmarshallers to separate subpackage 2020-01-23 18:30:31 +00:00
Artur Maciag
da3b6ee669 Shortcuts cleanup 2020-01-17 14:52:26 +00:00
Artur Maciag
7360fca581 Flake8 check fixes 2020-01-17 14:43:18 +00:00
Gouji Ochiai
8152d20e8e use getall instead of getlist 2019-11-19 13:07:20 +09:00
p1c2u
44de9c4322 Validation schema errors iter fix 2019-10-22 22:01:17 +01:00
p1c2u
c4d4ed8515 Server missing fields 2019-10-22 18:21:40 +01:00
p1c2u
d7840d0d61 Operations more fields 2019-10-22 17:20:52 +01:00
p1c2u
cfdf3410d2 Narrow validation exceptions 2019-10-20 15:06:13 +01:00
p1c2u
2bca2526f2 Schema validation errors list 2019-10-20 15:06:11 +01:00
p1c2u
88459829ad Schema validate exceptions refactor 2019-10-20 13:25:21 +01:00
p1c2u
939cec94e7 Schema unmarshal exceptions refactor 2019-10-20 13:00:14 +01:00
p1c2u
2000b1215f Django OpenAPI request/response factories 2019-10-20 00:58:28 +01:00
Pieterjan Lambein
0d62c5f374 Add django wrapper 2019-10-19 15:38:49 +01:00
p1c2u
0bbf787423 Flask factories; Get rid of wrappers 2019-10-19 13:35:48 +01:00
p1c2u
cffc47c60a OpenAPI request and response datatypes 2019-10-19 13:01:56 +01:00
p1c2u
8a614de0bb Restructure flask and mock 2019-10-19 12:01:57 +01:00
p1c2u
48ee8f9f87 Validation result datatypes and tests restructure 2019-10-19 10:55:32 +01:00
p1c2u
aa78985348 Version 0.12.0 2019-09-21 20:07:04 +01:00
p1c2u
fc60083e78 Get rid of schema validation in unmarshal 2019-09-13 01:55:22 +01:00
p1c2u
a2fc5284c6 Get rid of object validator 2019-09-12 19:56:39 +01:00
p1c2u
b2410e2f3a OAS 3.0 validator 2019-09-12 19:46:11 +01:00
p1c2u
c4c51637d2 Rename schema validate to obj_validate 2019-09-12 19:46:11 +01:00
p1c2u
f414b182c8 Version 0.11.1 2019-09-07 13:03:58 +01:00
p1c2u
5273a7ff7c Separate cast and unmarshal 2019-09-02 23:48:13 +01:00
Gerhard Weis
d490d5774b fix path parameter validation when overridden on operation 2019-06-20 06:23:54 +10:00
p1c2u
4ac4baf710 Version 0.11.0 2019-06-18 22:42:44 +01:00
Artur Maciag
27ebae3182 Parameters on path item object support 2019-06-18 16:31:42 +01:00
Artur Maciag
c9b2d8c4f8 attr errors hashable fix 2019-06-18 14:54:02 +01:00
Artur Maciag
9d9629b4bd Primitive types unmarshallers 2019-06-17 16:24:46 +01:00
A
9376b2e2da
Merge pull request #141 from bjmc/flask_params
Modify FlaskOpenAPIRequest to accomodate path variables
2019-06-17 15:38:45 +01:00
A
0df1d051b4
Merge pull request #133 from crunchr/support-any-type-with-one-of-rb1
Add support for one-of with any type
2019-06-17 13:28:41 +01:00
Brendan McCollam
3ef0c6adcf Convert Flask path variables to OpenAPI path parameters 2019-06-12 12:16:55 +01:00
Daniel Bradburn
d742a03f0f remove unused import 2019-06-08 11:03:58 +02:00
Artur Maciag
75840e0a95 Version 0.10.0 2019-05-21 13:21:42 +01:00
A
98f72bff1b
Merge pull request #134 from dz0ny/fix/number_parsing
Fix number validator
2019-05-21 13:19:07 +01:00
Artur Maciag
63f3ffb09f Number format added 2019-05-21 12:54:13 +01:00
A
f0cfa2d0e0
Merge pull request #131 from MCapitani/links
add support for "links" in Response
2019-05-21 12:26:32 +01:00
A
f5d26112b2
Merge pull request #130 from MCapitani/add-path-param
add support for path-level parameters
2019-05-17 10:30:51 +01:00
Janez Troha
3339e1311a Fix number validator
The `integer_types` is always a tuple. When checking
if an instance is a number it fails because it's doing a comparison against a tuple
instead of real type.

➜ python -c "from six import integer_types;import sys;print(integer_types);print(sys.version)"
(<type 'int'>, <type 'long'>)
2.7.16 (default, Apr  6 2019, 01:42:57)
[GCC 8.3.0]

➜ python3 -c "from six import integer_types;import sys;print(integer_types);print(sys.version)"
(<class 'int'>,)
3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.3.0]

And spec defines a number as both int and float https://swagger.io/docs/specification/data-models/data-types/#numbers so both validators need to support both types.
2019-05-15 19:00:38 +02:00
Daniel Bradburn
7d903a8907 Add support for one-of with any type 2019-05-02 15:50:38 +02:00
Nejc Zupan
13e65a2d91 Add missing STRING_FORMAT_CALLABLE_GETTER: SchemaFormat.PASSWORD
`password` is a valid OpenAPIv3 string format, that is used as a UI hint
for frontend clients to mask the input field.

It was already present in the `SchemaFormat` enum, but it was not
handled in `_unmarshal_string` that uses `STRING_FORMAT_CALLABLE_GETTER`
to decide how to unmarshal a string, which would result in an error like
this one:

```
Traceback (most recent call last):
  [... snip ...]
  File ".venv/lib/python3.7/site-packages/openapi_core/validation/request/validators.py", line 37, in validate
    body, body_errors = self._get_body(request, operation)
  File ".venv/lib/python3.7/site-packages/openapi_core/validation/request/validators.py", line 82, in _get_body
    body = media_type.unmarshal(raw_body, self.custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/media_types/models.py", line 45, in unmarshal
    unmarshalled = self.schema.unmarshal(deserialized, custom_formatters=custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters, strict=strict)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast
    return cast_callable(value)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 295, in _unmarshal_object
    value, custom_formatters=custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 335, in _unmarshal_properties
    prop_value, custom_formatters=custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters, strict=strict)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast
    return cast_callable(value)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 295, in _unmarshal_object
    value, custom_formatters=custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 335, in _unmarshal_properties
    prop_value, custom_formatters=custom_formatters)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 189, in unmarshal
    casted = self.cast(value, custom_formatters=custom_formatters, strict=strict)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 179, in cast
    return cast_callable(value)
  File ".venv/lib/python3.7/site-packages/openapi_core/schema/schemas/models.py", line 215, in _unmarshal_string
    formatstring = self.STRING_FORMAT_CALLABLE_GETTER[schema_format]
KeyError: <SchemaFormat.PASSWORD: 'password'>
```
2019-04-26 20:22:54 +01:00
Artur Maciag
4d99cbe7e1 Move additional props check to separate method 2019-03-26 13:27:44 +00:00
Diogo Baeder de Paula Pinto
b029066add Fix #124: Checking "additionalProperties" in "oneOf" items.
This is important because it does the correct validation over items that
are restricted in "oneOf", so that it's possible to use schemas that are
superset of one another as items of "oneOf".
2019-03-26 02:30:07 -03:00
Artur Maciag
5f7c6ba6ee Version 0.9.0 2019-03-22 14:55:06 +00:00
Artur Maciąg
f8e4e34e39 String byte format fix 2019-03-22 14:35:12 +00:00
A
beaa08a9c0
Merge branch 'master' into master 2019-03-22 13:29:04 +00:00
A
aa978cbe00
Merge pull request #121 from ondratu/master
Object additionalProperties support
2019-03-22 13:21:43 +00:00
Artur Maciąg
cd0ca5d26f Raw value type strict validation 2019-03-22 11:21:50 +00:00
Ondrej Tuma
cfaeb03120 no version change 2019-03-13 19:55:39 +01:00
Ondrej Tuma
83b9c37915 Object additionalProperties support
* Default is true like in specification
* When is set false, it works like in past
* Object with types works
2019-03-12 16:01:28 +01:00
Marco Capitani
f748783842 add support for "links" in Response 2019-03-08 14:12:11 +01:00
Marco Capitani
f232f7419b add support for path-level parameters 2019-03-08 10:19:09 +01:00
Diogo Baeder de Paula Pinto
a08b62035e Properly formatting UUID if value to be unmarshalled is already a UUID.
Before this change, if a UUID instance got received as value in the
Schema, it was breaking the unmarshal because UUID instances can't be
used as values to instantiate other UUIDs.
2019-02-28 18:25:22 -03:00
Artur Maciag
395f68b234 Version 0.8.0 2019-02-28 14:20:06 +00:00
Artur Maciag
a533a080cc byte string format 2019-02-27 00:59:45 +00:00
Diogo Baeder de Paula Pinto
dadf075670 Accepting uuid string format and validating accordingly. 2019-02-26 02:57:50 -03:00
A
d07a9d0e63
Merge pull request #106 from benhowes/patch-1
Dont use value for determining any type
2019-02-24 02:11:11 +00:00
Berend Kapelle
f08257b853
fix test for non utc systems.
`strict_rfc3339.rfc3339_to_timestamp()` is tz aware
`datetime.datetime.fromtimestamp` is not

this causes  the test `test_string_format_datetime` to fail on
system that are not on utc
2019-01-28 14:43:24 +01:00
Ben Howes
3d2926871b
Dont use value for determining any type
otherwise Falsy values are not valid types
2018-12-11 14:49:13 +00:00
Artur Maciag
db5d825395 Version 0.7.1 2018-10-29 10:19:49 +00:00
Artur Maciag
4db726bdd7 Version 0.7.0 2018-10-25 13:05:59 +01:00