Merge pull request #42 from p1c2u/fix/schema-format-accept-any-value

Schema format accepts any value
This commit is contained in:
A 2018-05-30 09:51:21 +01:00 committed by GitHub
commit 19bfff89dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -6,7 +6,7 @@ import warnings
from six import iteritems
from openapi_core.extensions.models.factories import ModelFactory
from openapi_core.schema.schemas.enums import SchemaType, SchemaFormat
from openapi_core.schema.schemas.enums import SchemaType
from openapi_core.schema.schemas.exceptions import (
InvalidSchemaValue, UndefinedSchemaProperty, MissingSchemaProperty,
OpenAPISchemaError, NoOneOfSchema, MultipleOneOfSchema,
@ -33,7 +33,7 @@ class Schema(object):
self.model = model
self.properties = properties and dict(properties) or {}
self.items = items
self.format = SchemaFormat(schema_format)
self.format = schema_format
self.required = required or []
self.default = default
self.nullable = nullable

View file

@ -259,6 +259,7 @@ components:
properties:
name:
type: string
format: custom
TagList:
type: array
items:

View file

@ -136,7 +136,7 @@ class TestPetstore(object):
assert type(parameter.schema) == Schema
assert parameter.schema.type.value ==\
schema_spec['type']
assert parameter.schema.format.value ==\
assert parameter.schema.format ==\
schema_spec.get('format')
assert parameter.schema.required == schema_spec.get(
'required', [])
@ -171,7 +171,7 @@ class TestPetstore(object):
assert type(media_type.schema) == Schema
assert media_type.schema.type.value ==\
schema_spec['type']
assert media_type.schema.format.value ==\
assert media_type.schema.format ==\
schema_spec.get('format')
assert media_type.schema.required == schema_spec.get(
'required', False)
@ -690,7 +690,7 @@ class TestPetstore(object):
assert parameters == {}
assert body is None
data_json = []
data_json = ['cats', 'birds']
data = json.dumps(data_json)
response = MockResponse(data)