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

enable documenting of Hash / Array attributes #10

Open
zhelyan opened this issue Feb 27, 2014 · 5 comments
Open

enable documenting of Hash / Array attributes #10

zhelyan opened this issue Feb 27, 2014 · 5 comments

Comments

@zhelyan
Copy link

zhelyan commented Feb 27, 2014

This is more to get the discussion started.

Is there are reason to replace Hash/Array attribute defaults with eg. {...} ?
If the Hashes/Arrays are large then it is a cookbook design issue (or feature). So why restrict it?

@realityforge
Copy link
Owner

The main reason was that this plugin was mostly developed to help document really large cookbooks and including the values of these can be particularly large - particularly when you use the attribute_driven style recipes. Hence including that made the documentation unreadable.

If we wanted to include it you could

  • Make it a command line option to include the full values, or
  • test whether the values are over a certain threshold and if they are shrink it down otherwise include the full value, or
  • combination of the above?

Thoughts?

@zhelyan
Copy link
Author

zhelyan commented Feb 28, 2014

I'd vote for a command line option. Attribute values below the attribute?:

node[:foo][:bar] - Description here. Defaults to:

       {
         foo: { 
               name: 'foo bar',
               enabled: true
                  }
       }

@freshmeat123
Copy link

Patch for parse hash/array attributes in coobook folder/attributes/*.rb might something like attached

attributes_model.txt

@trinitronx
Copy link

trinitronx commented Jul 19, 2020

Now that Chef 15 deprecated attributes from metadata.rb, it makes sense to have an alternate method for documenting the default values in comments.

I was a bit surprised that any attribute with an Array or Hash value would automatically get these Defaults to [ ... ], Defaults to { ... } appended, regardless of what I had placed in the #<> comments or inside metadata.rb. At first, I thought it was something wrong with my attribute syntax in metadata.rb, but then I found PR #47 which removed this functionality. Seems the README was a bit misleading or out of date w.r.t. that feature.

Even just a simple option to turn off the printing of those fields like default, and choice that are now unable to be filled out would be nice. Then the free-form comments could add whatever they want like: "... (Optional) Defaults to [] empty array"

@realityforge
Copy link
Owner

I am not actively working on the project atm but happy to accept PRs if they don't break existing users.

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

4 participants