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

feat: improve generated comments #2632

Merged
merged 1 commit into from Jun 13, 2022

Conversation

willbicks
Copy link
Contributor

This feature improves the comments generated for entities by improving the impact of the .Comment("") method on fields and edges. The details and justification are described in #2580.

The following changes are implemented:

  • If a comment is specified on a field schema with the .Comment("") method, that comment now replaces the default comment instead of being appended to it.
  • If a comment is specified on an edge schema with the .Comment("") method, that comment replaces the default comment instead of being ignored.
  • Documentation of the .Comment("") method is added to the getting started guide, and the field and edge schema docs.

Closes #2580

@willbicks
Copy link
Contributor Author

@a8m just wanted to flag this for your review in case you hadn't seen it, would love to know if you have any input!

@a8m
Copy link
Member

a8m commented Jun 12, 2022

Thanks for the contribution @willbicks 🙏

I'll review this later today. The CI is red - you need to run go generate ./... from the root of the project.

@willbicks willbicks force-pushed the feat/improve-generated-comments branch from fb1d416 to 58fba3c Compare June 12, 2022 16:19
@willbicks
Copy link
Contributor Author

@a8m Thanks for the tip, I updated the relevant integration schemas to reflect this change and regenerated all the generated files.

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job!

I added a few small comments. Please address them and I'll merge it. Thanks <3

doc/md/getting-started.md Outdated Show resolved Hide resolved
doc/md/getting-started.md Outdated Show resolved Hide resolved
doc/md/schema-edges.mdx Outdated Show resolved Hide resolved
doc/md/schema-fields.md Outdated Show resolved Hide resolved
entc/gen/template/ent.tmpl Outdated Show resolved Hide resolved
entc/gen/template/ent.tmpl Outdated Show resolved Hide resolved
entc/integration/edgeschema/ent/schema/tweet.go Outdated Show resolved Hide resolved
* replace default field comment with user comment if defined
* use comments defined on edges in generated entities
* add docs for comment method on edges and fields
* update integration to reflect above changes
@willbicks willbicks force-pushed the feat/improve-generated-comments branch from 58fba3c to cb67632 Compare June 12, 2022 20:20
@willbicks
Copy link
Contributor Author

@a8m, I was able to push a new version that addressed your suggestions.

I have a few more places where I think the comment generation functionality could be improved, so I'll be looking into those and submit some requests when I have something.

Thanks for all your work in maintaining this project!

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent job 🚀

@a8m a8m merged commit cd1afb2 into ent:master Jun 13, 2022
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

Successfully merging this pull request may close these issues.

Improve generated comments with user defined .Comment("")
2 participants