elements icon indicating copy to clipboard operation
elements copied to clipboard

NOT Enums Ignored - Supported by JSON Schema

Open kentbulza opened this issue 1 year ago • 4 comments

To support reserved values, JSON Schema permits the use of "not":{"enum":[...]} syntax. However, nothing displays in Stoplight when this syntax is used. I've attached a sample OpenAPI 3.1 document to demonstrate.

not_permitted_value.json

I suppose this is a bug, but only if one decides all JSON Schema is supported.

Context

I'd like Stoplight to notate the non-permitted values. This is useful for situations like an endpoint that creates a new resource with a caller-defined code, but which has reserved values that cannot be used.

Current Behavior

Nothing displays for NOT enums.

Expected Behavior

Something should display.

Possible Solution(s)

Perhaps display these as strikethrough badges, e.g. the opposite of permitted enums.

kentbulza avatar Apr 27 '24 03:04 kentbulza

As far as I know Elements doesn't support OpenAPI 3.1 documents yet?

weyert avatar Apr 29 '24 10:04 weyert

Yes...that is the version that introduced Webhooks, and those are supported.

But this is JSON Schema syntax, so it has nothing to do with the version of Open API. I apologize if something I said indicated NOT Enums were specific to OpenAPI 3.1.

On Mon, Apr 29, 2024, 3:29 AM Weyert de Boer @.***> wrote:

As far as I know Elements doesn't support OpenAPI 3.1 documents yet?

— Reply to this email directly, view it on GitHub https://github.com/stoplightio/elements/issues/2576#issuecomment-2082377428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3EL5RBPKO67GSXC4HD333Y7YOKLAVCNFSM6AAAAABG3X25ESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBSGM3TONBSHA . You are receiving this because you authored the thread.Message ID: @.***>

kentbulza avatar Apr 29 '24 15:04 kentbulza

this is an enhancement of stoplight's json-schema-viewer

daniel-white avatar May 03 '24 15:05 daniel-white

Ok, but what should be displayed?

Just tried the stoplight elements demo, and it generally works, just no information is shown about the restriction.

saper avatar Jun 26 '24 15:06 saper