Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# set defaults from template
if self.template is not None:
data.update(self.template)
paths = data['paths']
definitions = data['definitions']
ignore_verbs = set(
self.config.get('ignore_verbs', ("HEAD", "OPTIONS"))
)
# technically only responses is non-optional
optional_fields = self.config.get('optional_fields') or OPTIONAL_FIELDS
for name, def_model in self.get_def_models(
spec.get('definition_filter')).items():
description, swag = parse_definition_docstring(
def_model, self.sanitizer)
if name and swag:
if description:
swag.update({'description': description})
definitions[name].update(swag)
specs = get_specs(
self.get_url_mappings(spec.get('rule_filter')), ignore_verbs,
optional_fields, self.sanitizer,
doc_dir=self.config.get('doc_dir'))
http_methods = ['get', 'post', 'put', 'delete']
for rule, verbs in specs:
operations = dict()
for verb, swag in verbs:
update_dict = swag.get('definitions', {})