graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Handle List and User defined property types using from Json directive

Open vickytr44 opened this issue 2 years ago • 4 comments

Currently, we are not handling List and user-defined property types.

In the below example, we have a recent address that is of user-defined type "Address" and an address history is a List of Address. With the proposed changes these fields will be resolved.

type Author {
    id: Int! @fromJson
    name: String! @fromJson
    birthdate: DateTime @fromJson
    recentaddress: Address @fromJson
    addresshistory: [Address] @fromJson
}

type Address{
    id: Int! @fromJson
    state: String! @fromJson
    pincode: String! @fromJson
}

extend type Book {
    author: Author
}

vickytr44 avatar Jan 25 '23 15:01 vickytr44

Hey @vickytr44,

great to have you back for another contribution.

Can you add a test that shows what you are fixing?

michaelstaib avatar Jan 30 '23 07:01 michaelstaib

Yes i will write unit test for this.

vickytr44 avatar Feb 01 '23 09:02 vickytr44

I have added unit test for the changes.

vickytr44 avatar Feb 06 '23 17:02 vickytr44

Thank you ... will have a look at it today.

michaelstaib avatar Feb 07 '23 09:02 michaelstaib