Skip to content

Configuration Documentation  #4

Description

@k8orade

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions