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

Minor issues with field2choices #198

Open
lafrech opened this issue Apr 9, 2018 · 0 comments
Open

Minor issues with field2choices #198

lafrech opened this issue Apr 9, 2018 · 0 comments
Labels

Comments

@lafrech
Copy link
Member

lafrech commented Apr 9, 2018

I think that in marshmallow swagger, some pathological cases are not handled the best way.

This

        field = fields.Str(validate=[
            validate.Equal('only choice'),
            validate.Equal('only choice_2')])

produces

    ['enum'] = ['only choice', 'only_choice_2']

which is wrong. Admittedly, the field declaration does not make much sense.

Also

        field = fields.Str(validate=[
            validate.Equal('only choice'),
            validate.OneOf(['freddie', 'brian', 'john'])])

produces

    ['enum'] = ['only choice']

which is wrong too. This field declaration is a big dodgy as well.

Those are corner cases that might happen, perhaps, in some complex inheritance scenarios.

apispec should at least return the correct output. Maybe raising a warning is out of scope, as if we engage in consistency validation in apispec, this could end up being a lot of work.

No time and interest to address this right now but I thought I'd leave a note here.

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

No branches or pull requests

1 participant