Skip to content

add support for enum descriptions based on openAPI v3.1 specification#10760

Open
Arethusag wants to merge 1 commit intoswagger-api:masterfrom
Arethusag:ft/10104-enum-descriptions
Open

add support for enum descriptions based on openAPI v3.1 specification#10760
Arethusag wants to merge 1 commit intoswagger-api:masterfrom
Arethusag:ft/10104-enum-descriptions

Conversation

@Arethusag
Copy link

Hi All,

normally i would have posted on the issue to gauge appetite for this feature, but it was an easy implement and I am already using it myself, so hoping to continue discussion on this PR.

Description

Implements support for OpenAPI 3.1 enum pattern using oneOf with const values and descriptions.

Motivation and Context

  • Open API v3.1 Spec allows specifying enums such that they can have descriptions, what this PR aims to accomplish is implement this spec for swagger-ui such that users can select the descriptions in a dropdown menu rather than the enum values (which is the current behaviour).

How Has This Been Tested?

  • Added E2E Cypress test in test/e2e-cypress/e2e/features/parameter-oneof-const-descriptions.cy.js
  • Added test spec in test/e2e-cypress/static/documents/features/parameter-oneof-const-descriptions.yaml
  • All existing unit tests pass (npm run test:unit)
  • Build completes successfully (npm run build)
  • Artifact tests pass (npm run test:artifact)
  • Linting passes (npm run lint-errors)

Fixes #10104

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

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

Successfully merging this pull request may close these issues.

Support enums with descriptions as per OpenAPI v3.1

1 participant