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

Recent version broke enums with oneOf which is part of the standard #1757

Open
jhancock-taxa opened this issue Jul 26, 2024 · 2 comments
Open

Comments

@jhancock-taxa
Copy link

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.

@jhancock-taxa
Copy link
Author

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.

@MaggieKimani1
Copy link
Contributor

@jhancock-taxa thank you for bringing this up. I'll investigate this and get back to you on it.

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

No branches or pull requests

2 participants