Jira (PDOC-294) Improve Type Alias Docs - Parameter Support

11 views
Skip to first unread message

Bryan Stopp (JIRA)

unread,
Oct 11, 2019, 10:39:03 PM10/11/19
to puppe...@googlegroups.com
Bryan Stopp created an issue
 
Puppet Strings / Improvement PDOC-294
Improve Type Alias Docs - Parameter Support
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: DOCS
Created: 2019/10/11 7:38 PM
Labels: experiment
Priority: Normal Normal
Reporter: Bryan Stopp

As a Module Developer
I want to be able to document my type alias struct parameters
So that my module consumers can understand the purpose of the struct and each parameter within it.

Possibly related to PDOC-226 & PDOC-215

Glenn Sarti asked me to C/P our slack discussion so that there would be context of the desired feature capability. (see Below).

 
bstopp 10:07 PM
I was thinking that the alias could/should be replaced if i provide any @param directives. And maybe then pdk can raise a warning about not having any custom param descriptions for type => structs and an error if one param description is provided but not all  are defined? WDYT?
10:09 PM
the alias is informational but not very useful to consumers - module developers should be providing meaningful docs on the params in the structs
 
Glenn Sarti 10:09 PMfirstly, I think I understand your concern...what I'm thinking is, that technically those are data type aliases.  So I'm trying to figure out what the ramifications are
10:10 PM
I wonder if Yard even cares ...
 
bstopp 10:10 PMmaybe i’m abusing the type aliases 
 
Glenn Sarti 10:10 PMNah... you're not
10:10 PM
as in what you're doing is legit
10:10 PM

bstopp 10:10 PM
 
Glenn Sarti 10:10 PMit's that this isn't the only case
10:10 PM
Struct, Object and I think another one will have the same problem
10:11 PM
but parsing that it going to be a major pain in the bum (edited) 
10:11 PM
e.g. what if you had nested structs 
 
bstopp 10:11 PMmakes sense - i am trying to figure out how I should be provding guidance to my module consumers about the structs, so they know what/how to build their hiera data correclty
10:11 PM
boo, Nest structs, while valid, are probably a code smell
10:11 PM
IMHO
 
Glenn Sarti 10:11 PMdoes Variant[String, Struct[....]]
10:12 PM
How would I express that ... hrmm
 
bstopp 10:12 PMAhh. i see your point.
10:12 PM
but that isn’t a named struct, so does it have the same consideration? (edited) 
 
Glenn Sarti 10:13 PM
10:13 PM
Just spitballing edge cases
 
bstopp 10:13 PMno, makes sense to consider all the possibiliites
 
Glenn Sarti 10:13 PMthat's why for my Version 1 implementation just went "Spit out a string"
 
bstopp 10:13 PM
 
Glenn Sarti 10:14 PMBetter than before - 
10:14 PM
I wonder if Yard tagging could be interspersed into the type definition
10:14 PM
Puppet may not like that
 
bstopp 10:14 PMmaybe v 1.5 a reordering? - eg: i put the params on the docs, and it spit out yard info, here’s what the markdown looks like:
 
Glenn Sarti 10:15 PMSo something like
Type xxx = Variant[
  String,
  Struct[
      # @param ....
      blah =>
  ]
]
 
bstopp 10:15 PM
Entry. 
### Dispatcher::Farm::RendererRenderer attributes hash. Defines the parameters used to configure the /renderer directive of a farm.Alias of `Struct[{
Click to expand inline (22 lines)
 
10:15 PM
oh, i didn’t do it that way, i was doing it like….
 
Glenn Sarti 10:15 PMI know I don't have the code for that
 
bstopp 10:16 PM
 

  1. Renderer attributes hash. Defines the parameters used to configure the /renderer directive of a farm.
    #
  2. @summary A hash of renderer attributes.
  3. Used to configure the `/renderer` parameter instance of a Farm.
    #
  4. @param hostname
  5. The hostname for the renderer.
    #
    type Dispatcher::Farm::Renderer = Struct[

 
 
10:16 PM
puppet strings did the rest - i was just seeing what happend when i did this - 
 
Glenn Sarti 10:16 PMThat example you give is fine if and only if it's an alias of Struct
 
bstopp 10:16 PMYeah i think you just lost me 
 
Glenn Sarti 10:17 PMS'all good
 
bstopp 10:17 PMooh, i get you
10:17 PM
your type is either a string or a struct
 
Glenn Sarti 10:17 PMYeah
 
bstopp 10:17 PMHuh. Never thought of doing that
 
Glenn Sarti 10:17 PMwhich wouldn't be that common ... but
10:17 PM
it's still legit
10:17 PM
or Optional[Struct...]
10:18 PM
which would be more common
 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Glenn Sarti (JIRA)

unread,
Oct 11, 2019, 10:42:03 PM10/11/19
to puppe...@googlegroups.com
Glenn Sarti updated an issue
Change By: Glenn Sarti
*As a* Module Developer
*I want* to be able to document my type alias struct parameters
*So that* my module consumers can understand the purpose of the struct and each parameter within it.


Possibly related to PDOC-226 & PDOC-215

[~ Glenn Sarti glenn.sarti ] asked me to C/P our slack discussion so that there would be context of the desired feature capability. (see Below).

 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:07 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846078031300]
I was thinking that the {{alias}} could/should be replaced if i provide any {{@param}} directives. And maybe then pdk can raise a warning about not having any custom param descriptions for {{type => structs}} and an error if one param description is provided but not _all_  are defined? WDYT?
[10:09 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846151033100]

the alias is informational but not very useful to consumers - module developers should be providing meaningful docs on the params in the structs
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:09 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846155033200]firstly, I think I understand your concern...what I'm thinking is, that _technically_ those are data type aliases.  So I'm trying to figure out what the ramifications are
[10:10 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846206033900]

I wonder if Yard even cares ...
 

as in what you're doing is legit

Struct, Object and I think another one will have the same problem

but parsing that it going to be a major pain in the bum (edited) 
[10:11 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846282037300]
e.g. what if you had nested structs !https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-medium/1f...@2x.png!
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:11 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846288037400]makes sense - i am trying to figure out how I should be provding guidance to my module consumers about the structs, so they know what/how to build their hiera data correclty
[10:11 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846313038200]

boo, Nest structs, while valid, are probably a code smell

How would I express that ... hrmm
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:12 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846341039200]Ahh. i see your point.
[10:12 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846370040000]
but that isn’t a _named_ struct, so does it have the same consideration? (edited) 
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:13 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846381040400]!https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-large/1f...@2x.png!
[10:13 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846387040600]
Just spitballing edge cases
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:13 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846403041100]no, makes sense to consider all the possibiliites
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:13 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846417041500]that's why for my Version 1 implementation just went "Spit out a string"
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:13 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846428041700]!https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-large/1f...@2x.png!
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:14 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846441041900]Better than before - !https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-medium/1f...@2x.png!
[10:14 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846462042700]

I wonder if Yard tagging could be interspersed into the type definition

Puppet may not like that
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:14 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846474043200]maybe v 1.5 a reordering? - eg: i put the params on the docs, and it spit out yard info, here’s what the markdown looks like:
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:15 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846521044200]So something like

Type xxx = Variant[
  String,
  Struct[
      # @param ....
      blah =>
  ]
]
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:15 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846524044300]
Entry. 
{{### Dispatcher::Farm::Renderer}}{{​}}{{Renderer attributes hash. Defines the parameters used to configure the */renderer* directive of a farm.}}{{​}}{{Alias of `Struct[{}}

Click to expand inline (22 lines)
 

oh, i didn’t do it that way, i was doing it like….
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:15 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846545045100]I know I don't have the code for that
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:16 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846564045300]
 
{quote}# Renderer attributes hash. Defines the parameters used to configure the */renderer* directive of a farm.

#
# @summary A hash of renderer attributes.
# Used to configure the `/renderer` parameter instance of a Farm.
#
# @param hostname
# The hostname for the renderer.
#
type Dispatcher::Farm::Renderer = Struct[{quote}
 
 
[10:16 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846589046200]
puppet strings did the rest - i was just seeing what happend when i did this - !https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-medium/1f...@2x.png!
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:16 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846599046400]That example you give is fine if and only if it's an alias of Struct
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:16 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846619046900]Yeah i think you just lost me !https://a.slack-edge.com/production-standard-emoji-assets/10.2/apple-medium/1f...@2x.png!
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846630047300]S'all good
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846631047600]ooh, i get you
[10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846642048000]
your type is either a string _or_ a struct
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846647048200]Yeah
 
[bstopp|https://app.slack.com/team/U7C8ALC4T] [10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846654048500]Huh. Never thought of doing that
 
[Glenn Sarti|https://app.slack.com/team/U1154M24W] [10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846656048700]which wouldn't be _that_ common ... but
[10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846660048900]
it's still legit
[10:17 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846677049400]
or {{Optional[Struct...]}}
[10:18 PM|https://puppetcommunity.slack.com/archives/C11LCKKQ9/p1570846681049600]

which would be more common
 

Randell Pelak (JIRA)

unread,
Jan 9, 2020, 7:01:04 PM1/9/20
to puppe...@googlegroups.com
Randell Pelak commented on Improvement PDOC-294
 
Re: Improve Type Alias Docs - Parameter Support

I think you may have used the wrong template for this ticket... This template is for requesting a performance experiment. Let me know if I am wrong, otherwise I will clear out the stuff that is making this show up on SLV.

Bryan Stopp (JIRA)

unread,
Jan 10, 2020, 10:47:04 AM1/10/20
to puppe...@googlegroups.com
Bryan Stopp commented on Improvement PDOC-294

AFAIR I didn't pick any template when creating this ticket, so i'm not sure what is/isn't needed. 

 

Randell Pelak (JIRA)

unread,
Jan 10, 2020, 11:30:04 AM1/10/20
to puppe...@googlegroups.com
Randell Pelak updated an issue
 
Change By: Randell Pelak
Labels: experiment
Team: System Level Validation

Randell Pelak (JIRA)

unread,
Jan 10, 2020, 11:33:04 AM1/10/20
to puppe...@googlegroups.com
Randell Pelak commented on Improvement PDOC-294
 
Re: Improve Type Alias Docs - Parameter Support

Sometimes Jira saves settings from the previous ticket you used, or in really fun cases, that someone else used... Anyway, I removed the things the template did that made this show up on the SLV board, but I don't know if there is anything that needs to be done to get this seen by the right people (every team does it differently). And I can't remove the template, but that shouldn't really matter.

Reply all
Reply to author
Forward
0 new messages