Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Base struct fields are not recognized #260

Open
jjacobson93 opened this issue Jun 9, 2019 · 2 comments
Open

Base struct fields are not recognized #260

jjacobson93 opened this issue Jun 9, 2019 · 2 comments

Comments

@jjacobson93
Copy link

I'm using a base struct for some common fields in my model, for example, an ID field. It seems when using a struct that has the base struct, those fields are not recognized by the library.

For example, this will not work:

type Base struct {
    ID string
}

type User struct {
    Base
    Email string
}

The query here fails with unknown field "id"

query {
    users {
        id
    }
}
@jjacobson93
Copy link
Author

jjacobson93 commented Jun 9, 2019

I dug into the code a bit. Since the base/embedded struct is just another field, it probably needs to be handled here.

The field Anonymous on reflect.StructField could possibly be used to determine whether or not to recursively look for additional base struct fields.

@oscartbeaumont
Copy link

Has any progress been made as this would be usefull for my project?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants