-
Notifications
You must be signed in to change notification settings - Fork 190
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
support field custom documentation strings #394
Conversation
Adds support for extending the documentation strings for fields and setting docstrings for custom fields. A new `FieldConfig.Documentation` configuration option is now supported. When present, this string *extends* any documentation provided for the existing field by the doc-2.json files. If no such documentation is provided by the existing field OR if the field is a custom field, the `FieldConfig.Documentation` configuration option is used for the field's docstring in the Go type files. Example usage for an existing nested field (from a hypothetical ec2 generator.yaml file). The `LaunchTemplateData.HibernationOptions.Configured` field has a docstring already that contains the following: ``` // If you set this parameter to true, the instance is enabled for hibernation. // // Default: false ``` Setting the `generator.yaml` file to the following: ```yaml resources: LaunchTemplate: fields: LaunchTemplateData.HibernationOptions.Configured: documentation: XXX extended docs XXX ``` would cause the field's Documentation string to look like this: ``` // If you set this parameter to true, the instance is enabled for hibernation. // // Default: false // // XXX extended docs XXX", ``` Issue aws-controllers-k8s/community#1223 Signed-off-by: Jay Pipes <jaypipes@gmail.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jaypipes The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @jaypipes. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@RedbackThomson @jljaco @a-hilaly please note the changes to comment formatting is from using go1.19 gofmt changes... |
I have some concerns about how unruly the resource:
Cluster:
documentation_file: docs/cluster.yaml and then a field1: >
Multi-line
Documentation
Here
field2: ... Or we could have a per-controller version of that where we define a top-level config in the documentation_file: docs.yaml Then at Cluster:
field1: ...
Addons:
field1: ... |
@RedbackThomson I guess I see where you're coming from if the controller has a LOT of custom fields. s3-controller only actually has 4 fields though :) So not too onerous to have the docs in a single generator.yaml file IMHO. Then again, I do like your suggestion about having a |
Both sound great! How about: resources:
Cluster:
fields:
MyCustomField:
documentation: # Supports XOR `from_sdk` and `from_custom`
from_sdk:
operation: ...
path: ...
from_custom: ... |
I'm a bit mixed regarding using new files different than resources:
User:
fields:
newField:
documentation:
from: X
Group:
fields:
newField:
documentation:
from: X
documentation:
X: is an option that does ... # This can be reused many times (thinking resources that have similar fields like ARN etc...)
Y: is an option that does ... |
/ok-to-test |
/test all |
/retest |
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.
👍
/retest |
Even though I still think there should be some UX changes to this feature, I am going to merge this because I want to use it to inject deprecation notices into fields. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, jaypipes, RedbackThomson The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@jaypipes: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Closes aws-controllers-k8s/community#1223 Expands upon #394 Description of changes: This pull request moves the custom GoDoc overrides from inside the `generator.yaml` file to a new, separate `documentation.yaml` file. This `documentation.yaml` file currently supports modify field GoDocs (but could be extended to modify resource GoDocs as well) in the following ways: - Prepend: Add a comment before the existing shape ref GoDoc - Append: Add a comment after the existing shape ref GoDoc - Override: Completely replace the existing shape ref GoDoc The current RDS documentation modifications are now modeled in the `documentation.yaml` like so: ```yaml resources: DBClusterParameterGroup: fields: Parameters: override: | DEPRECATED - do not use. Prefer ParameterOverrides instead. ParameterOverrides: append: | These are ONLY user-defined parameter overrides for the DB cluster parameter group. This does not contain default or system parameters. DBParameterGroup: fields: ParameterOverrides: append: | These are ONLY user-defined parameter overrides for the DB parameter group. This does not contain default or system parameters. ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Adds support for extending the documentation strings for fields and setting docstrings for custom fields.
A new
FieldConfig.Documentation
configuration option is now supported. When present, this string extends any documentation provided for the existing field by the doc-2.json files. If no such documentation is provided by the existing field OR if the field is a custom field, theFieldConfig.Documentation
configuration option is used for the field's docstring in the Go type files.Example usage for an existing nested field (from a hypothetical ec2 generator.yaml file). The
LaunchTemplateData.HibernationOptions.Configured
field has a docstring already that contains the following:Setting the
generator.yaml
file to the following:would cause the field's Documentation string to look like this:
Issue aws-controllers-k8s/community#1223
Signed-off-by: Jay Pipes jaypipes@gmail.com
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.