question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extensible enumerations (growable lists)

See original GitHub issue

Hey all, I did some searching in the OAI repo, and it didn’t jump out at me as an existing feature request.

The issues with enum being “non-growable” without making a major semver change for an API have been talked about in several places. Zalando came up with nice framework within their API guidelines to handle this, which would be incredibly useful to upstream into the specification itself

https://zalando.github.io/restful-api-guidelines/#112

Should: Used Open-Ended List of Values (x-extensible-enum) Instead of Enumerations [112] Enumerations are per definition closed sets of values, that are assumed to be complete and not intended for extension. This closed principle of enumerations imposes compatibility issues when an enumeration must be extended. To avoid these issues, we strongly recommend to use an open-ended list of values instead of an enumeration unless:

the API has full control of the enumeration values, i.e. the list of values does not depend on any external tool or interface, and

the list of value is complete with respect to any thinkable and unthinkable future feature.

To specify an open-ended list of values use the marker x-extensible-enum as follows:

deliver_methods:
  type: string
  x-extensible-enum:
    - parcel
    - letter
    - email

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:11
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

16reactions
himanshumpscommented, May 21, 2020

Any update on on how to do it in openapi 3.0. Is this the way to go for extensible enum in opanAPI 3.0

        type:
          type: string
          anyOf:
          - enum: 
            - PRODUCT_ARRANGEMENT
            - OFFERED_ARRANGEMENT
          - {}

9reactions
sepanniemicommented, Dec 31, 2021

Any decisions on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extensible Enumerations 2.0 - XBRL
Extensible Enumerations 1.0 allows the definition of concepts that take a value that is one of a defined list of options.
Read more >
java - Can enums be subclassed to add new elements?
Actually, when you extend your enum with new values, you're creating not subclass, but superclass. You can use base enum values everywhere instead...
Read more >
Extensible Enumerations A Guide for Preparers - FASB
Extensible Enumerations use elements for reporting values in an XBRL filing. One or multiple elements could be entered as values. The elements ...
Read more >
Extending a list in Python (5 different ways) - GeeksforGeeks
The list is the widely used Python data structure and it can be extended by adding elements to the list. There are various...
Read more >
Effective Java! Emulate Extensible Enums With Interfaces.
Earlier in this series we considered the alternatives to the use of enum s. Throughout the preceding chapters we have shown that enums...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found