Commit graph

233 commits

Author SHA1 Message Date
Brendan McCollam
3ef0c6adcf Convert Flask path variables to OpenAPI path parameters 2019-06-12 12:16:55 +01:00
Brendan McCollam
2ec02e473e Adds failing test
Adds flask_wrapper.yaml spec
2019-06-12 11:37:10 +01:00
A
4874851054
Merge pull request #136 from badcure/remove_py34
Removing Python 3.4 from testing. It is no longer supported.
2019-05-22 09:06:17 +01:00
Artur Maciag
b284191eeb End of Python 3.4 support 2019-05-22 08:57:27 +01:00
brian.price
80668ce1da Removing Python 3.4 from testing. It is no longer supported. 2019-05-21 18:05:58 -05: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
A
391d664dac
Merge pull request #132 from niteoweb/fix/password_format
Add support for `password` string format
2019-05-17 10:28:07 +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
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
A
f274836c4d
Merge pull request #125 from diogobaeder/master
Fix #124: Checking "additionalProperties" in "oneOf" items.
2019-03-26 13:35:16 +00:00
Artur Maciag
4d99cbe7e1 Move additional props check to separate method 2019-03-26 13:27:44 +00:00
Diogo Baeder de Paula Pinto
14196b6ce1 Fix #124: Fixing test for Python 2. 2019-03-26 03:41:14 -03: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
A
e7fa45be40
Merge pull request #117 from p1c2u/fix/string-byte-format-fix
String byte format fix
2019-03-22 14:48:16 +00:00
Artur Maciąg
f8e4e34e39 String byte format fix 2019-03-22 14:35:12 +00:00
A
c846b2e453
Merge pull request #112 from diogobaeder/master
Properly formatting UUID if value to be unmarshalled is already a UUID.
2019-03-22 14:30:02 +00:00
Artur Maciag
aa206d868e Test string format quirks rename fix 2019-03-22 14:14:42 +00:00
Artur Maciag
d0e163b5ba Test string format UUID non strict fix 2019-03-22 14:05:54 +00:00
Artur Maciag
9aa16dff0f Test object with invalid additional properties fix 2019-03-22 13:44:05 +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
A
964302db36
Merge pull request #123 from p1c2u/fix/raw-value-type-strict-validation
Raw value type strict validation
2019-03-22 11:35:20 +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
A
68b015a755
Merge pull request #111 from p1c2u/feature/byte-string-format
byte string format
2019-02-28 14:10:38 +00:00
Artur Maciag
a533a080cc byte string format 2019-02-27 00:59:45 +00:00
A
23118296ab
Merge pull request #109 from diogobaeder/master
Accepting uuid string format and validating accordingly.
2019-02-26 14:30:19 +00:00
Artur Maciag
48d1d1c8ae UUID string format tests 2019-02-26 14:22:28 +00:00
Diogo Baeder de Paula Pinto
dadf075670 Accepting uuid string format and validating accordingly. 2019-02-26 02:57:50 -03:00
A
922fce4085
Merge pull request #75 from smarlowucf/flake8
Switch test requirement to pytest-flake8.
2019-02-24 03:29:44 +00:00
Artur Maciąg
dccb93bbfe test validaotr escape sequence fix 2019-02-24 02:28:45 +00: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
A
7da0c98ea5
Merge pull request #102 from dxr3x/fix-readme-example
Fix import in an example
2019-02-24 02:08:57 +00:00
A
698706d2e4
Merge pull request #107 from berend/bugfix/fix_test_for_non_utc
fix test for non utc systems.
2019-02-24 02:07:26 +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
Konstantin Tyurin
abe0d6dd5a Fix import in an example 2018-11-02 11:12:50 +01:00
Artur Maciag
db5d825395 Version 0.7.1 2018-10-29 10:19:49 +00:00
Artur Maciag
917ccf7d38 MANIFEST py27 fix 2018-10-29 10:18:51 +00:00
Artur Maciag
4db726bdd7 Version 0.7.0 2018-10-25 13:05:59 +01:00