Skip to content

Default boolean values get written as a string #1205

@Johannes-Wagn3r

Description

@Johannes-Wagn3r

Describe the bug

When creating a new YAML File from scratch and using the autocompletion feature of the plugin, it genereates the right YAML for the following schema:

{
  "$schema" : "http://json-schema.org/draft-07/schema#",
  "type" : "object",
  "properties" : {
    "Test" : {
      "type" : "object",
      "properties" : {
        "test" : {
          "type" : "object",
          "properties" : {
            "foo" : {
              "type" : "boolean",
              "title" : "foo",
              "default" : "false",
              "examples" : [ "false" ]
            }
          },
          "required" : [ "foo" ]
        }
      },
      "required" : [ "test"]
    }
  },
  "required" : [ "Test" ],
  "description" : "test schema",
  "additionalProperties" : false
}

Output:
Image

Later on, when you remove the foo tag and manually add it again, it suggests to add the boolean parameter as a string which is wrong:

Image

If you change the default value of foo from "false" to false, then adding the field manually works as expected, but if you generate the new YAML from scratch, the value of foo will not be written anymore:

Image

Expected Behavior

The value of foo should be written when generating a new YAML and foo should always be written as a boolean

Current Behavior

Foo is either written as as a string when manually adding the field or not written when generating a new YAML from scratch.

Steps to Reproduce

  1. "Link" the schema to the yaml file
  2. Generate a yaml from scratch
  3. Delete the foo tag and add it via autocompletion again

Environment

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions