We're currently using ConfigMapper::ConfigStruct classes for defining our configuration data structure, and also maintain a separate 'configuration reference' yaml document for our users.
E.g. for the following code:
class State < ConfigMapper::ConfigStruct
component :position do
attribute :x, default: 0
attribute :y, default: 0
end
end
We would also write a companion config-reference.yml document containing:
position:
type: Object
description: |
The position of our object
position.x:
type: Integer
description: |
x-coordinate
position.y:
type: Integer
description: |
y-coordinate
It would be great if ConfigStruct elements (attributes, components and component_dicts) supported some additional documentation options, so that a config reference document could be generated.
I'm thinking this would involve adding description option to all elements and a type option for attributes, e.g.
component :position, description: "The position of our object" do
attribute :x, default: 0, description: "x-coordinate", type: Integer
attribute :y, default: 0, description: "y-coordinate", type: Integer
end
Then exposing a method on ConfigStruct objects (maybe #reference_yaml?) that would return a yaml object of the config-reference data above.
Happy to make a PR but would like some feedback first :)
We're currently using ConfigMapper::ConfigStruct classes for defining our configuration data structure, and also maintain a separate 'configuration reference' yaml document for our users.
E.g. for the following code:
We would also write a companion
config-reference.ymldocument containing:It would be great if
ConfigStructelements (attributes, components and component_dicts) supported some additional documentation options, so that a config reference document could be generated.I'm thinking this would involve adding
descriptionoption to all elements and atypeoption for attributes, e.g.Then exposing a method on
ConfigStructobjects (maybe#reference_yaml?) that would return a yaml object of theconfig-referencedata above.Happy to make a PR but would like some feedback first :)