hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Input schema's incorrect relation optionality

Open ondratra opened this issue 3 years ago • 0 comments

The following input schema:

type Book {
  library: Library!

  ...
}

type Library @entity {
  books: [Book!]! @derivedFrom(field: "library")

  ...
}

incorrectly generates property as optional in library.model.d.ts:

export declare class Library extends BaseModel {
  books?: Book[]; // this should be required property, but it's optional
  ...
}

The similar issue seems to occur with variant's single relation:

type MyVariant @variant {
  book: Book!
}

// generating model
export declare class MyVariant {
  book?: Book;
  ...
}

ondratra avatar Oct 04 '21 22:10 ondratra