Skip to content

Using bool values in enum and const generates a validation error for valid values #1078

@Kosta-Github

Description

@Kosta-Github

Describe the bug

When using a boolean value in an enum schema (e.g.: enum: [true]) validation fails for a valid value.

The error message is: Value is not accepted. Valid values: true.

For example, the OpenAPI 3.0 spec is using such a mechanism in its schema.

Expected Behavior

The schema validation should pass without an issue.

Current Behavior

The schema validation generates this error message: Value is not accepted. Valid values: true.

Image

Steps to Reproduce

Place these 2 files next to each other:

schema.yaml:

$schema: "http://json-schema.org/draft-07/schema#"
type: object
properties:
  value:
    enum: [true]

test.yaml:

# yaml-language-server: $schema=./schema.yaml

value: true

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Latest version of the extension: 1.18.0

Metadata

Metadata

Labels

Type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions