-
-
Notifications
You must be signed in to change notification settings - Fork 753
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
Error with enums containing the value 'no' #646
Comments
This is a property of the yaml file format. you will need to quote your
string types.
…On Mon, Jul 30, 2018, 5:59 AM Alon Diamant ***@***.***> wrote:
Description
An enum that contains the value 'no' has that value converted to False in
the schema validator, causing validation errors.
Expected behaviour
'no' means 'no'.
Actual behaviour
'no' is cast to False.
Steps to reproduce
Just create an enum like this:
Countries:
type: string
enum:
- ad
- ae
- af
- ag
- ai
- al
- am
- ao
- aq
- ar
- as
- at
- au
- aw
- ax
- az
- ba
- bb
- bd
- be
- bf
- bg
- bh
- bi
- bj
- bl
- bm
- bn
- bo
- bq
- br
- bs
- bt
- bv
- bw
- by
- bz
- ca
- cc
- cd
- cf
- cg
- ch
- ci
- ck
- cl
- cm
- cn
- co
- cr
- cu
- cv
- cw
- cx
- cy
- cz
- de
- dj
- dk
- dm
- do
- dz
- ec
- ee
- eg
- eh
- er
- es
- et
- fi
- fj
- fk
- fm
- fo
- fr
- ga
- gb
- gd
- ge
- gf
- gg
- gh
- gi
- gl
- gm
- gn
- gp
- gq
- gr
- gs
- gt
- gu
- gw
- gy
- hk
- hm
- hn
- hr
- ht
- hu
- id
- ie
- il
- im
- in
- io
- iq
- ir
- is
- it
- je
- jm
- jo
- jp
- ke
- kg
- kh
- ki
- km
- kn
- kp
- kr
- kw
- ky
- kz
- la
- lb
- lc
- li
- lk
- lr
- ls
- lt
- lu
- lv
- ly
- ma
- mc
- md
- me
- mf
- mg
- mh
- mk
- ml
- mm
- mn
- mo
- mp
- mq
- mr
- ms
- mt
- mu
- mv
- mw
- mx
- my
- mz
- na
- nc
- ne
- nf
- ng
- ni
- nl
- no
- np
- nr
- nu
- nz
- om
- pa
- pe
- pf
- pg
- ph
- pk
- pl
- pm
- pn
- pr
- ps
- pt
- pw
- py
- qa
- re
- ro
- rs
- ru
- rw
- sa
- sb
- sc
- sd
- se
- sg
- sh
- si
- sk
- sl
- sm
- sn
- so
- sr
- ss
- st
- sv
- sx
- sy
- sz
- tc
- td
- tf
- tg
- th
- tj
- tk
- tl
- tm
- tn
- to
- tr
- tt
- tv
- tw
- tz
- ua
- ug
- um
- us
- uy
- uz
- va
- vc
- ve
- vg
- vi
- vn
- vu
- wf
- ws
- ye
- yt
- za
- zm
- zw
and send it as a parameter and as a response - you'll see it occur.
Additional info:
Example error from Connexion validator:
2018-07-27 11:56:33,268 [15/#7fc7bc797638] ERROR in validation.validate_schema:131: validation error: 'no' is not one of ['ww', 'eu', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'bq', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mf', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', False, 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st', 'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm', 'zw']
I am guessing this is caused by some automatic code that casts 'no' to
False and 'yes' to True, but I did not have enough time to go deeper into
the code.
Output of the commands:
-
python --version
Python 3.6.3
-
pip show connexion | grep "^Version\:"
Version: 2016.0.dev1 (yeah, old, but it happens in latest too)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#646>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAlPSbDrv5AocLyMGZKe2WPOLbUAMk_Eks5uLhQogaJpZM4VljBk>
.
|
Yeah, I've figured it out: Kinda silly. Alright, will quote and hope it works. Thanks! |
I guess we can close this issue? We/Connexion cannot fix the YAML spec.. 😏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
An enum that contains the value
'no'
has that value converted to False in the schema validator, causing validation errors.Expected behaviour
'no'
means'no'
.Actual behaviour
'no'
is cast to False.Steps to reproduce
Just create an enum like this:
and send it as a parameter and as a response - you'll see it occur.
Additional info:
Example error from Connexion validator:
I am guessing this is caused by some automatic code that casts
'no'
to False and'yes'
to True, but I did not have enough time to go deeper into the code.Output of the commands:
python --version
Python 3.6.3
pip show connexion | grep "^Version\:"
Version: 2016.0.dev1 (yeah, old, but it happens in latest too)
The text was updated successfully, but these errors were encountered: