All configuration is stored in a dict
.
from bravado_core.spec import Spec
spec_dict = json.loads(open('swagger.json', 'r').read())
config = {
'validate_requests': False,
'use_models': False,
}
swagger_spec = Spec.from_dict(spec_dict, config=config)
Config key | Type | Default | Description |
---|---|---|---|
validate_swagger_spec |
boolean |
True |
Validate the Swagger spec against the Swagger 2.0 Specification. |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
validate_requests |
boolean |
True |
On the client side, validates outgoing requests. On the server side, validates incoming requests. |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
validate_responses |
boolean |
True |
On the client side, validates incoming responses. On the server side, validates outgoing responses. |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
use_models |
boolean |
True |
Use python classes to represent models instead of dicts. See models . |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
formats |
list of SwaggerFormat |
[] |
List of user-defined formats to support. See formats . |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
include_missing_properties |
|
|
Create properties with the value None if theywere not submitted during object unmarshalling |
----------------------------- | --------------- | --------- | ---------------------------------------------------- |
default_type_to_object |
boolean |
False |
When set to True , missing types will defaultto object and be validated as such.When set to False , missing types will not bevalidated at all. |