Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions openapi_codec/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,20 @@ def _get_parameters(link, encoding):
'required': field.required,
'in': 'formData',
'description': field.description,
'type': field.type or 'string'
'type': field.type or 'string',
}
if field.type == 'array':
parameter['items'] = {'type': 'string'}
parameters.append(parameter)
else:
# Expand coreapi fields with location='form' into a single swagger
# parameter, with a schema containing multiple properties.
schema_property = {
'description': field.description,
'type': field.type or 'string'
'type': field.type or 'string',
}
if field.type == 'array':
schema_property['items'] = {'type': 'string'}
properties[field.name] = schema_property
if field.required:
required.append(field.name)
Expand All @@ -148,8 +152,10 @@ def _get_parameters(link, encoding):
'required': field.required,
'in': location,
'description': field.description,
'type': field.type or 'string'
'type': field.type or 'string',
}
if field.type == 'array':
parameter['items'] = {'type': 'string'}
parameters.append(parameter)

if properties:
Expand Down