8000 Merge pull request #27 from core-api/graceful-handling-of-file-type-i… · Pix4D/python-openapi-codec@ae04db0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae04db0

Browse files
authored
Merge pull request core-api#27 from core-api/graceful-handling-of-file-type-in-json
Graceful handling of 'file' fields in JSON links.
2 parents 565f902 + 41ec042 commit ae04db0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

openapi_codec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from openapi_codec.decode import _parse_document
99

1010

11-
__version__ = '1.2.0'
11+
__version__ = '1.2.1'
1212

1313

1414
class OpenAPICodec(BaseCodec):

openapi_codec/encode.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,13 @@ def _get_parameters(link, encoding):
123123
else:
124124
# Expand coreapi fields with location='form' into a single swagger
125125
# parameter, with a schema containing multiple properties.
126+
use_type = field.type or 'string'
127+
if use_type == 'file':
128+
use_type = 'string'
129+
126130
schema_property = {
127131
'description': field.description,
128-
'type': field.type or 'string',
132+
'type': use_type,
129133
}
130134
if field.type == 'array':
131135
schema_property['items'] = {'type': 'string'}

0 commit comments

Comments
 (0)
0