mirror of
https://github.com/correl/openapi-core.git
synced 2025-01-01 11:03:19 +00:00
Schema format accepts any value
This commit is contained in:
parent
4669c4763a
commit
d87b60ade7
3 changed files with 6 additions and 5 deletions
|
@ -6,7 +6,7 @@ import warnings
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
from openapi_core.extensions.models.factories import ModelFactory
|
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 (
|
from openapi_core.schema.schemas.exceptions import (
|
||||||
InvalidSchemaValue, UndefinedSchemaProperty, MissingSchemaProperty,
|
InvalidSchemaValue, UndefinedSchemaProperty, MissingSchemaProperty,
|
||||||
OpenAPISchemaError, NoOneOfSchema, MultipleOneOfSchema,
|
OpenAPISchemaError, NoOneOfSchema, MultipleOneOfSchema,
|
||||||
|
@ -33,7 +33,7 @@ class Schema(object):
|
||||||
self.model = model
|
self.model = model
|
||||||
self.properties = properties and dict(properties) or {}
|
self.properties = properties and dict(properties) or {}
|
||||||
self.items = items
|
self.items = items
|
||||||
self.format = SchemaFormat(schema_format)
|
self.format = schema_format
|
||||||
self.required = required or []
|
self.required = required or []
|
||||||
self.default = default
|
self.default = default
|
||||||
self.nullable = nullable
|
self.nullable = nullable
|
||||||
|
|
|
@ -259,6 +259,7 @@ components:
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
format: custom
|
||||||
TagList:
|
TagList:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|
|
@ -136,7 +136,7 @@ class TestPetstore(object):
|
||||||
assert type(parameter.schema) == Schema
|
assert type(parameter.schema) == Schema
|
||||||
assert parameter.schema.type.value ==\
|
assert parameter.schema.type.value ==\
|
||||||
schema_spec['type']
|
schema_spec['type']
|
||||||
assert parameter.schema.format.value ==\
|
assert parameter.schema.format ==\
|
||||||
schema_spec.get('format')
|
schema_spec.get('format')
|
||||||
assert parameter.schema.required == schema_spec.get(
|
assert parameter.schema.required == schema_spec.get(
|
||||||
'required', [])
|
'required', [])
|
||||||
|
@ -171,7 +171,7 @@ class TestPetstore(object):
|
||||||
assert type(media_type.schema) == Schema
|
assert type(media_type.schema) == Schema
|
||||||
assert media_type.schema.type.value ==\
|
assert media_type.schema.type.value ==\
|
||||||
schema_spec['type']
|
schema_spec['type']
|
||||||
assert media_type.schema.format.value ==\
|
assert media_type.schema.format ==\
|
||||||
schema_spec.get('format')
|
schema_spec.get('format')
|
||||||
assert media_type.schema.required == schema_spec.get(
|
assert media_type.schema.required == schema_spec.get(
|
||||||
'required', False)
|
'required', False)
|
||||||
|
@ -690,7 +690,7 @@ class TestPetstore(object):
|
||||||
assert parameters == {}
|
assert parameters == {}
|
||||||
assert body is None
|
assert body is None
|
||||||
|
|
||||||
data_json = []
|
data_json = ['cats', 'birds']
|
||||||
data = json.dumps(data_json)
|
data = json.dumps(data_json)
|
||||||
response = MockResponse(data)
|
response = MockResponse(data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue