Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Update configsuite.docs.generate to handle default values #164

Description

@oyvindeide

Currently the configsuite.docs.generate function will not reflect defaults in the schema:

Small example:

import configsuite

schema = {
    configsuite.MetaKeys.Type: configsuite.types.NamedDict,
    configsuite.MetaKeys.Content: {
        "threshold": {
            configsuite.MetaKeys.Type: configsuite.types.Number,
            configsuite.MetaKeys.Default: 0.95,
        },
    },
}

configsuite.docs.generate(schema)

returns:
'\n\n**threshold:**\n \n\n :type: number

would expect:
'\n\n**threshold:**\n \n\n :type: number\n \n\n :default: 0.95

A second (perhaps unrelated issue), is that if there are more levels to this, the top level will be marked as required, even though it can be omitted in the configuration.

Example:

import configsuite

schema = {
    configsuite.MetaKeys.Type: configsuite.types.NamedDict,
    configsuite.MetaKeys.Content: {
        "content": {
            configsuite.MetaKeys.Type: configsuite.types.NamedDict,
            configsuite.MetaKeys.Content: {
                "threshold": {
                    configsuite.MetaKeys.Type: configsuite.types.Number,
                    configsuite.MetaKeys.Default: 0.95,
                },
            },
        },
    },
}

configsuite.docs.generate(schema)

gives:

'\n\n**content*:**\n \n\n **threshold:**\n \n\n :type: number'

would expect:

'\n\n**content:**\n \n\n **threshold:**\n \n\n :type: number\n \n\n :default: 0.95

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions