-
Notifications
You must be signed in to change notification settings - Fork 88
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
Optionally add nodoc #261
Optionally add nodoc #261
Conversation
Oops, was on wrong branch Final cleanup Remove extra return Allow comment on primary key
{% else %} | ||
{{stmt.id}} | ||
{% end %} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever. I like that the logic is centralized.
noDoc
feels like a command though, which would prevent anything from being documented. Also it's snakeCased, which doesn't feel very Crystal.
Naming isn't my forte, but is there another name that would work better here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea...i'll think of something better
src/granite/table.cr
Outdated
@@ -1,8 +1,18 @@ | |||
# Adds a :nodoc: to granite methods/constants if `DISABLE_GRANTE_DOCS` ENV var is true | |||
macro noDoc(stmt) | |||
{% if env("DISABLE_GRANTE_DOCS") == "true" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose here is to make the docs more terse and relevant by default, right? Should this logic default to nodoc then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on how you look at it. Was trying to allow you to disable the docs if you wanted while retaining current behavior.
But if we are okay with having them off by default i can do that.
Docs off by default Fix typo
@robacarp how about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Blacksmoke16
This PR resolves #251.
It provides the ability to skip generation of Granite methods, macros, constants etc when using
crystal docs
. It will only not include the docs when the ENV varDISABLE_GRANITE_DOCS=true
, if it is not set, or set to false it will include the Granite stuff.The reasoning behind this; before this change on a just primary key model:
There is so much here that it almost makes the docs for the user's project unusable.
The same model skipping Granite stuff:
As you may notice this also adds the ability to define a comment to use on the getter/setter of each property with the following syntax:
field name : String, comment: "# The name of person"
or in this case:
primary id : Int64, comment: "# The primary key"