We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: Empty dict values in the definitions are rendered not to {} but to null incorrectly.
{}
null
PoC code:
from json import loads from aiohttp import web from aiohttp_swagger.helpers import generate_doc_from_each_end_point app = web.Application() definitions = dict( test={ "type": "object", "properties": {"prop": {"type": "object", "default": dict()}}, } ) doc = generate_doc_from_each_end_point(app, definitions=definitions) print(doc) test1 = definitions["test"] test2 = loads(doc)["definitions"]["test"] print(test1) print(test2) assert test1 == test2
Expectation:
"default": {}
test2
test1
{"swagger": "2.0", "info": {"description": "Swagger API definition\n", "version": "1.0.0", "title": "Swagger API"}, "basePath": "/", "schemes": ["http", "https"], "definitions": {"test": {"type": "object", "properties": {"prop": {"type": "object", "default": {}}}}}, "paths": {}} {'type': 'object', 'properties': {'prop': {'type': 'object', 'default': {}}}} {'type': 'object', 'properties': {'prop': {'type': 'object', 'default': {}}}}
Observation:
"default": null
{"swagger": "2.0", "info": {"description": "Swagger API definition\n", "version": "1.0.0", "title": "Swagger API"}, "basePath": "/", "schemes": ["http", "https"], "definitions": {"test": {"type": "object", "properties": {"prop": {"type": "object", "default": null}}}}, "paths": {}} {'type': 'object', 'properties': {'prop': {'type': 'object', 'default': {}}}} {'type': 'object', 'properties': {'prop': {'type': 'object', 'default': None}}} Traceback (most recent call last): File "C:\Users\YouheiSakurai\Desktop\poc.py", line 20, in <module> assert test1 == test2 ^^^^^^^^^^^^^^ AssertionError
Environment
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Issue: Empty dict values in the definitions are rendered not to
{}
but tonull
incorrectly.PoC code:
Expectation:
"default": {}
.test2
extracted from the generated doc shall be equal totest1
from the original definitions.Observation:
"default": null
.test2
extracted from the generated doc isn't equal totest1
from the original definitions.Environment
The text was updated successfully, but these errors were encountered: