[CSHARP-3020] Nullable Enums not supported Created: 23/Mar/20 Updated: 27/Oct/23 Resolved: 04/May/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Read Operations |
| Affects Version/s: | 2.10.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Mike Koziel | Assignee: | Dmitry Lukyanov (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10 Pro Bld 18363 |
||
| Description |
|
It seems like the C# driver is unable to work with Nullable Enums when I expose the IQueryable of the Collection to Microsoft's OData libraries. I've tried it with both EnumRepresentationConvention(BSonType.String) as well as BSonType.Int32.
Here is what I'm trying to achieve:
The above create an error of "InvalidOperationException. (Convert({Document} {MyEnumField}Nullable`1) == 2". Because swagger code gen marks all Enums as nullable (to support PATCHing use-cases I assume), this above error occurs. When I remove the nullable (question mark) from the model, everything works. I'd really like the models to not be touched so that they can be regenerated from a shared swagger doc at any time in the future.
|
| Comments |
| Comment by Dmitry Lukyanov (Inactive) [ 13/Apr/20 ] |
|
Hello mkoziel@gmail.com, can you please provide the following: |