Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Commit ae04db0

Browse files
authored
Merge pull request #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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy