An issue has been identified with the function "requestFieldType2gql". This function takes an entity as a parameter, and if that entity extends BaseEntity, we append the string "Input" to the property type in GraphQL. For example:
mutation createUser(name: String, age: Number, Address: EntityAddressInput)
The relevant line of code can be found here.
However, when attempting to execute this operation, GraphQL fails to find the "Input" type, resulting in the following error:
Error: Unknown type "CustomerSubscriptionInput". Did you mean "CustomerSubscription"?
A preliminary solution could be to create Inputs for entities and also create an Input for request objects within usecases. However, this might not be the best approach, as we might end up creating Inputs that aren't necessary or that don't necessarily fit what's expected in a usecase's "request" field.
usecase('create user'
[...]
request: {
name: String
age: Number,
address: AddressEntity
}
[...]
For instance, in the usecase create user
, where the request includes an entity-based field (e.g., address: AddressEntity), creating an Input for it solves the problem, but this Input would also include an "ID" field. This is a potential issue as we don't want the ID in the address field during user creation.
My proposed solution works for most scenarios, but not all. The suggestion is to proceed with this preliminary solution for the beta release and open up a discussion for a more definitive solution.