Closed nimi-kaushal closed 1 year ago
Here is an example.
@GraphQLMutation(name = "saveCompay", description = "Saves a company.")
public CompanyDto saveCompany(
@GraphQLArgument(name = "input", description = "The company data to save.") @GraphQLNonNull final CompanyDto input,
@GraphQLEnvironment final ResolutionEnvironment resolutionEnvironment) {
return execSaveCompany(input, resolutionEnvironment);
}
@GraphQLType(name = "Company", description = "Represents a business")
public class CompanyDto extends OrganizationDto {
@GraphQLQuery(description = "An easier to read name for the company")
private String friendlyName;
@GraphQLQuery(description = "If the company does business under a different name")
private String dba;
}
The resulting schema is:
"""Saves a company."""
saveCompany(
"""The company data to save."""
input: CompanyInput!
): Company
"""
Represents a business.
"""
input CompanyInput {
dba: String
friendlyName: String
}
Notice there is no description showing in the schema under CompanyInput.
We figured out the problem... we had to have separate annotations on the getter and setter, e.g.
@GraphQLQuery(description = FIELD_DESCRIPTION_DBA)
public String getDba() {
return dba;
}
@GraphQLInputField(description = FIELD_DESCRIPTION_DBA)
public void setDba(final String dba) {
this.dba = dba;
}
Yes, this is correct. Sorry for not responding.
I'm having issue of custom descriptions for nested fields are not showing even though descriptions are added as @GraphQLQuery descriptions.