Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix description for Post Types and Taxonomies added to the Schema #1204

Closed
jasonbahl opened this issue Mar 30, 2020 · 5 comments · Fixed by #1232
Closed

Fix description for Post Types and Taxonomies added to the Schema #1204

jasonbahl opened this issue Mar 30, 2020 · 5 comments · Fixed by #1232
Labels
effort: low Around a day or less good first issue Issue that doesn't require previous experience with the codebase impact: med Minor performance improvements, fix broad user base issues scope: api Issues related to access functions, actions, and filters scope: docs Updating, correcting, and improving documentation

Comments

@jasonbahl
Copy link
Collaborator

jasonbahl commented Mar 30, 2020

Currently, when adding a Post Type or Taxonomy to the WPGraphQL Schema, the root field for the single node entry point isn't documented properly. The field documentation says A object.

It should instead say A $post_type Object. Additionally, it should probably include the description of the Post Type as well.

This looks like the erroneous line: https://github.com/wp-graphql/wp-graphql/blob/develop/src/Type/Object/RootQuery.php#L431

Instead of % it should be %s. That will make it go from A object to A post object, but we should also consider adding the post type description.

Maybe something like: sprintf( __( 'A %1$s object. %2$s', 'wp-graphql' ), $post_type_object->graphql_single_name, $post_type_object->description ),

@jasonbahl jasonbahl added good first issue Issue that doesn't require previous experience with the codebase effort: low Around a day or less impact: med Minor performance improvements, fix broad user base issues scope: api Issues related to access functions, actions, and filters scope: docs Updating, correcting, and improving documentation labels Mar 30, 2020
@jacobarriola
Copy link
Contributor

@jasonbahl can I take a stab at this?

@jasonbahl
Copy link
Collaborator Author

@jacobarriola that would be great! Please do. 🙏

@bahiirwa
Copy link
Contributor

bahiirwa commented Apr 9, 2020

The same behavior is noticed with taxonomies. See image below.

Screenshot 2020-04-09 at 18 54 37

It also doesn't make grammatical sense when article "a" when working with vowel beginning words like Event/Apple. So we would end up with a statements saying "A event object". See same image above.

Suggestion

  1. Make provision for an object description through args like $args['graphql_object_description'] seeing that in some cases $args['description'] is left empty.
  2. Remove 'A' before the "%1$s".

@jasonbahl
Copy link
Collaborator Author

@bahiirwa We could word it like An object of the $tyepname Type

@jasonbahl
Copy link
Collaborator Author

@jacobarriola @bahiirwa submitted PR #1232 for this. If you have thoughts on further improving the Schema docs, further PRs welcome too 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: low Around a day or less good first issue Issue that doesn't require previous experience with the codebase impact: med Minor performance improvements, fix broad user base issues scope: api Issues related to access functions, actions, and filters scope: docs Updating, correcting, and improving documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants