Grokzen / Grokzen/pykwalify

Support 'default' rule for sequence and mapping.

Open
#144 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
297
Forks
84
PR merge metrics
No merged PRs in 30d

Description

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:
```yaml
---
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:
```yaml
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:
```yaml
eggs:
foo: hello
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.