Skip to content

default not working in anyOf and oneOf but allOf #127

@mrx8

Description

@mrx8

Schema:

{
  "anyOf": [{
    "type" : "object",
    "properties": {
      "key1": {"type": "string", "default": "A"}
    },
    "required": ["key1"]
  }]
}

input-data:

{}

should result in:

{
  "key1": "A"
}

But it produces errors if default is used. This happens in case of "anyOf" and "oneOf". "allOf" works.
Tested with ajv version 3.4.0 on Node.js v4.2.6 on 64bit Linux.
Option useDefault: true is used

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions