Skip to content

Support 'default' rule for sequence and mapping. #144

@MrQubo

Description

@MrQubo

Currently 'default' can only be used with scalar types. It should be possible to specify a default value for mappings and sequences too.

See this schema for example:

---
type: map
mapping:
  eggs:
    type: map
    mapping:
      foo:
        type: str
        required: true
      bar:
        type: int
        required: true
    default:
      foo: hello
      bar: 42

With this schema, empty root mapping should be valid and it would default too:

eggs:
  foo: hello
  bar: 42

But if the eggs key is present then both foo and bar must be specified, so this one shouldn't be valid with above schema:

eggs:
  foo: hello

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