edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

MissingRequiredError for required property with default

Open dvv opened this issue 1 year ago • 0 comments

Describe the bug

Given the schema

  type ResourceType {
    required name: str {}
    comment: str {}
    required is_material: bool { default := true }
  }

using the edgedb-js client I can not insert an instance of ResourceType without explicitly specifying is_material. Neverless, inserting via edgedb command line tool succeeds:

insert into ResourceType { name := "Box" };

Reproduction

client.queryRequiredSingle(`
  insert ResourceType {
    name := <str>$name,
    comment := <optional str>$comment,
    is_material := <optional bool>$is_material
  };
`, { name: "Box" })

The above throws MissingRequiredError: missing value for required property 'is_material' of object type 'default::ResourceType'.

Expected behavior The object should be inserted well with properties { name: "Box", is_material: true }

Versions:

  • OS: Linux hp 6.1.59-1-lts SMP PREEMPT_DYNAMIC Fri, 20 Oct 2023 05:42:57 +0000 x86_64 GNU/Linux
  • EdgeDB version: 5.0-dev.8009+703ad9d
  • EdgeDB CLI version: 4.1.0-dev.1064+190a209
  • edgedb-js version: 1) deno's port v1.3.0, 2) https://raw.githubusercontent.com/edgedb/edgedb-deno/main/mod.ts
  • Deno version: 1.37.2

Additional context I tried both edgedb-deno versions from above.

dvv avatar Nov 03 '23 17:11 dvv