OpenAPI.NET
OpenAPI.NET copied to clipboard
Recent version broke enums with oneOf which is part of the standard
Describe the bug Previous versions didn't validate that enums didn't have oneOf, which was fine. But now it's broken, despite this being part of the V3.0+ standard
OpenApi File To Reproduce This is valid OpenAPI 3.1:
"DocumentPurposes": {
"type": "integer",
"description": "Known purposes for a document",
"x-enumNames": [
"IRSFormSchema",
"IRSFormBusinessRules",
"IRSFormStyleSheets",
"IRSFormPDF",
"IRSFormInstructions",
"Other"
],
"enum": [
1,
2,
3,
4,
5,
999
],
"oneOf": [
{
"const": 1,
"title": "IRSFormSchema"
},
{
"const": 2,
"title": "IRSFormBusinessRules"
},
{
"const": 3,
"title": "IRSFormStyleSheets"
},
{
"const": 4,
"title": "IRSFormPDF"
},
{
"const": 5,
"title": "IRSFormInstructions"
},
{
"const": 999,
"title": "Other"
}
]
},
Expected behavior It should validate this and validate as correct because it is THE standard way of defining enums with key/value pairs.
Note: Using "enum": [ array here that is the value in the enums list] works as far as it goes reading the file and getting around the validation. However that promptly breaks kiota.
@jhancock-taxa thank you for bringing this up. I'll investigate this and get back to you on it.
@MaggieKimani1 Is there a resolution to this? Would love to add support for enum descriptions in our new openapi spec (using dotnet9).
@jhancock-taxa Can I confirm that the JSON Schema you used here is correctly read and written by OpenAPI, however Kiota has problems processing this schema?
If so, we can transfer this to the Kiota repo.
/cc @baywet
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.