-
Notifications
You must be signed in to change notification settings - Fork 280
Enums can't be nullable #507
Comments
We are running into the same issue, would be great to get this fixed. |
Any updates on this? |
Not yet, thanks for bumping this. I didn't have time to investigate exactly what's the root cause of the problem. Since in apiaryio/mson#61 they report it should not be an issue in the parser, my first guess would be that dredd-transactions do not transform API Elements to transactions correctly. Any help or at least failing tests appreciated. |
I've got an example reproducing this issue. I believe it is the generated JSON schema that is incorrect. My apib file:
Generated schema versus the tested response: If I add null (without quotes) as one of the possible enum types, the generated JSON schema includes "null" (with quotes) as a possible enum type. So, this:
results in this generate schema versus the tested response: Finally, I'd like to conclude with a working combination: |
@JeppeKnockaert Awesome! Thanks for the investigation and for filing apiaryio/drafter#455! |
This was fixed in Drafter. Soon it should propagate to Dredd. |
The fix from Drafter should be in Dredd by now, is there any remaining problems? Perhaps this issue can be closed. |
As your "QA guy" (quoting @pksunkara) I'd like to have this (and this #283 (comment)) tested, at least superficially, in Dredd. |
I think I'm still having an issue with this and swagger:
I get:
But if I add null to the enum, it works. Both x-nullable and null in the enum have to exist though. |
@apiaryio/adt is the behavior described by @octalmage expected? |
Yes, |
The x-nullable flag only adds |
I'm still having this issue whether I'm including null in the enum list or not. Swagger example:
Testing:
|
@andybarilla I've prepared a fix in apiaryio/api-elements.js#59, I hope you don't mind that I've taken parts of your example Swagger 2 document to reproduce in our test fixtures. |
This is done, the only thing missing is an integration or e2e test in Dredd verifying this works as intended. |
It would seem that in OpenAPI 3, the exact opposite to my prior comment on making
Thus, nullable would only apply to the
|
Note that the
|
Problems with
nullable
enums were reported by multiple users in apiaryio/mson#61. We should investigate the problem.The text was updated successfully, but these errors were encountered: