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

Commit 41ec042

Browse files
committed
Don't produce invalid Swagger documents when a 'file' field is erronously included in a JSON encoded link.
1 parent 565f902 commit 41ec042

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