diff --git a/openapi_codec/__init__.py b/openapi_codec/__init__.py index 342bec1..f9d8ec1 100644 --- a/openapi_codec/__init__.py +++ b/openapi_codec/__init__.py @@ -8,7 +8,7 @@ from openapi_codec.decode import _parse_document -__version__ = '1.1.3' +__version__ = '1.1.4' class OpenAPICodec(BaseCodec): diff --git a/openapi_codec/encode.py b/openapi_codec/encode.py index 4fc3bcd..a95aaed 100644 --- a/openapi_codec/encode.py +++ b/openapi_codec/encode.py @@ -66,7 +66,7 @@ def _get_paths_object(document): for operation_id, link, tags in links: if link.url not in paths: - paths[link.url] = {} + paths[link.url] = OrderedDict() method = get_method(link) operation = _get_operation(operation_id, link, tags) @@ -77,13 +77,19 @@ def _get_paths_object(document): def _get_operation(operation_id, link, tags): encoding = get_encoding(link) + description = link.description.strip() + summary = description.splitlines()[0] if description else None operation = { 'operationId': operation_id, - 'description': link.description, 'responses': _get_responses(link), 'parameters': _get_parameters(link, encoding) } + + if description: + operation['description'] = description + if summary: + operation['summary'] = summary if encoding: operation['consumes'] = [encoding] if tags: diff --git a/tests/test_encode.py b/tests/test_encode.py index d50d226..8bd7a72 100644 --- a/tests/test_encode.py +++ b/tests/test_encode.py @@ -63,7 +63,6 @@ def test_paths(self): } }, 'parameters': [], - 'description': '', 'operationId': 'list', 'tags': ['users'] } @@ -75,7 +74,6 @@ def test_paths(self): } }, 'parameters': [], - 'description': '', 'operationId': 'create', 'tags': ['users'] } 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