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

Advise on "open enums" #26

Open
codefromthecrypt opened this issue May 22, 2021 · 1 comment
Open

Advise on "open enums" #26

codefromthecrypt opened this issue May 22, 2021 · 1 comment

Comments

@codefromthecrypt
Copy link
Contributor

We have a part of our json schema which prescribes values based on what's supported now. ex.

        "os": {
          "title": "OS",
          "description": "OS is the supported operating system (runtime.GOOS)",
          "type": "string",
          "enum": [
            "darwin",
            "linux",
            "windows"
          ]
        },

However, if we added another value later, we would want old code to not fail. Right now enums are validated by default.. We still want to know what the constants should be... Any advise?

@jdimeo
Copy link

jdimeo commented Aug 12, 2021

I think this is more a question for JSON schemas. I think the "right" way is to use a choice, either a "closed" enum or an open string for future values:
json-schema-org/json-schema-spec#665

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