LastDragon-ru / lara-asp

Awesome Set of Packages for Laravel
MIT License
11 stars 1 forks source link

Filters stop working when using @rename directive #80

Closed denisgoryaynov closed 1 year ago

denisgoryaynov commented 1 year ago

In my GraphQL schema a lot of fields are renamed using the @rename directive to make it less verbose since the project I am working on required a specific naming convention. When adding filters I found out that

This works but requires using the name of the database column and does not match the GraphQL naming convention since the field is called id inside the schema:

input AddressFiltersInput {
    AddressId: ID
}

In this case the generated SearchByConditionAddressFiltersInput looks like this:

input {
  allOf: [SearchByConditionAddressFiltersInput!]
  anyOf: [SearchByConditionAddressFiltersInput]!
  not: SearchByConditionAddressFiltersInput
  AddressId: SearchByScalarIDOrNull
}

But when adding the @rename directive the field that is using it is not included inside the generated SearchByConditionAddressFiltersInput:

input AddressFiltersInput {
    id: ID @rename(attribute: "AddressID")
}

The generated SearchByConditionAddressFiltersInput looks like this:

input {
  allOf: [SearchByConditionAddressFiltersInput!]
  anyOf: [SearchByConditionAddressFiltersInput]!
  not: SearchByConditionAddressFiltersInput
}
LastDragon-ru commented 1 year ago

Unfortunately @rename is not supported yet (same for other FieldResolver directives)

LastDragon-ru commented 1 year ago

I've added @rename support, but our projects don't use it. So, could you please test the master branch? If all is fine, I will create a new release shortly.