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

Use godoc for descriptions #2

Open
shreyas44 opened this issue Oct 5, 2021 · 2 comments
Open

Use godoc for descriptions #2

shreyas44 opened this issue Oct 5, 2021 · 2 comments

Comments

@shreyas44
Copy link
Owner

shreyas44 commented Oct 5, 2021

Currently, to provide descriptions for fields we need to use the description struct tag. While this is fine, the lines would be really long for long descriptions, and it might be easier to use regular docstrings for descriptions.

Instead of

type User struct {
  ID string `description:"user id"`
}

We do

type User struct {
  // user id
  ID string
}

Using docstrings would also allow us to support descriptions for enums and type definitions. We should continue to support the description struct tag as an override in case the user wants to use different descriptions on the GraphQL and Go sides.

@shreyas44
Copy link
Owner Author

Just realised this isn't possible since there's no way to get the descriptions at runtime without creating external dependencies.

@shreyas44
Copy link
Owner Author

We could use the json file generated by go doc for this - depends on golang/go#34293

@shreyas44 shreyas44 reopened this Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant