Skip to content
New issue

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

Bug in open api rules processing - AnyConverter #81

Open
doug-granular opened this issue Jun 5, 2024 · 1 comment
Open

Bug in open api rules processing - AnyConverter #81

doug-granular opened this issue Jun 5, 2024 · 1 comment

Comments

@doug-granular
Copy link

Hello,
Thank you for this repo.

Discovered a bug when trying to add some documentation to route parameters.

In our use case we want to document an enumerated list of possible values for a url path parameter like so:

/<any(\"enum1\", \"enum2\", \"enum3\"):parameter_name>

This works, but the problem is the generated openapi.json also pulls in some other schema info from the request body, which ends up looking very strange in swagger.

The cause of this bug is the schema dictionary variable is reused from the above code. See https://github.com/pgjones/quart-schema/blob/main/src/quart_schema/extension.py#L590

I am attaching a patch file. Tried to submit a PR but couldn't

Note: should also consider setting the type at line 590 like so:
params_schema.update({"type": "string", "enum": list(converter.items)})

Patch file:
fix_bug_-_do_not_reuse_schema_dictionary_from_above_logic_Improve_the_decorator_typing.patch

@pgjones
Copy link
Owner

pgjones commented Jun 5, 2024

Thanks fixed in 125e218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants