From 41ec0425bcd77f72f76b3f5d0dcbbd4e570f317b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 2 Dec 2016 16:03:43 +0000 Subject: [PATCH] Don't produce invalid Swagger documents when a 'file' field is erronously included in a JSON encoded link. --- openapi_codec/__init__.py | 2 +- openapi_codec/encode.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openapi_codec/__init__.py b/openapi_codec/__init__.py index 2c803f4..49a1c9f 100644 --- a/openapi_codec/__init__.py +++ b/openapi_codec/__init__.py @@ -8,7 +8,7 @@ from openapi_codec.decode import _parse_document -__version__ = '1.2.0' +__version__ = '1.2.1' class OpenAPICodec(BaseCodec): diff --git a/openapi_codec/encode.py b/openapi_codec/encode.py index 8c7396a..981f83f 100644 --- a/openapi_codec/encode.py +++ b/openapi_codec/encode.py @@ -123,9 +123,13 @@ def _get_parameters(link, encoding): else: # Expand coreapi fields with location='form' into a single swagger # parameter, with a schema containing multiple properties. + use_type = field.type or 'string' + if use_type == 'file': + use_type = 'string' + schema_property = { 'description': field.description, - 'type': field.type or 'string', + 'type': use_type, } if field.type == 'array': schema_property['items'] = {'type': 'string'} 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