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
[Feature Discussion] Graphql Documentation Generation #1516
Comments
Old: public interface IDocumentationProvider
{
string GetSummary(Type type);
string GetSummary(MemberInfo member);
string GetSummary(ParameterInfo parameter);
} New: public interface IDocumentationProvider
{
string GetDescription(Type type);
string GetDescription(MemberInfo member);
string GetDescription(ParameterInfo parameter);
} I think we should refactor the documentation provider. When we talk about documentation in the context of GraphQL we call it description. So we should rename that to With this it is more clear that we actually do not only mean the summary. We also should add to our interface some documentation and make that clear and also point to the fact that the Further, I like the proposal of your markdown structure for field documentation lets go ahead with that. I think refactor the interface and go ahead with your proposal. |
Shouldn't we use GraphQL Descriptions for documentation purposes?
|
I agree @michaelstaib Should we only add exceptions to the graphql docs that contain a "code" attribute or just all of them? @rstaib |
@John0x I think he means in your example of the sdl. """
Updates the user
**Returns:** User object of the updated user
**Errors:**
1. USER_NOT_FOUND: Couldn't find user
2. DB_NOT_NULL_VIOLATION: General database not null violation
3. DB_UNIQUE_VIOLATION: General database unique violation
4. DB_UPDATE_EXCEPTION: General database update exception
"""
updateUser(
"Email of the user"
email: String!
"User DTO"
input: UpdateUserInput!
): User! since But for consistency we should correct the examples. |
@John0x we should only include the one with a |
Okay :) Attached is an image of the current status, any suggestions for the formatting or is it okay like that? /// <summary>
/// Creates a review for a given Star Wars episode.
/// </summary>
/// <param name="episode">The episode to review.</param>
/// <param name="review">The review.</param>
/// <param name="eventSender">The event sending service.</param>
/// <exception cref="Exception" code="TEST_ERROR">Test exception dude</exception>
/// <returns>The created review.</returns> |
looks good so far |
looks nice |
One remark here regarding the exceptions, shouldn't we use an unordered list instead of an ordered list? |
@rstaib generally yes, but the Playground doesn't seem to display unordered lists properly |
@John0x but isn't this a problem inside the tool. The question is whether we should be semantically correct or working fine in a certain tool. Perhaps we should tell them. Have you tested Banana Cake Pop ;-) would be interested whether it's working fine. |
@rstaib Generally I would agree with you, but the playground is the standard and comes preinstalled so it should at least look decent in there. An unordered list would semantically make more sense but at least for me, it's not too much of a problem if it was an ordered list. We should probably tell them, haven't done so yet though 😄 I'm gonna test it with the banana |
Summary
Currently the XML Documentation is used to automatically generate graphql schema documentation, which already is pretty handy 👍
Though it can be improved in my opinion.
I personally like to include the errors/exceptions that can be thrown by the mutation/query in the documentation so that someone who consumes the API already knows what error codes he should handle.
The XML Documentation feature gives us a lot of handy elements that could be utilized to generate a great interactive documentation.
Elements that I'm interested in right now:
I'm willing to implement a more detailed documentation generation, but I might need some assistance since it would be my first hc contribution 🙂
Any thoughts on this?
Especially on how to format it and which elements should be converted.
Proposal
Current State
Gets generated to:
Suggested State
Should get generated to:
Links
Previous discussions:
Relevant documentation:
Relevant files:
The text was updated successfully, but these errors were encountered: