Skip to content

Enum merge doesn't work if property is not at root level #22

@lmestel

Description

@lmestel

Input:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://schema.project.com/section.schema.json",
  "title": "Section",
  "type": "object",
  "allOf": [
    {
      "$ref": "http://schema.kickstartds.com/base/section.schema.json"
    },
    {
      "type": "object",
      "properties": {
        "content": {
          "type": "object",
          "properties": {
            "mode": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["default", "tile", "list", "slider"],
                  "default": "default"
                },
                {
                  "$ref": "http://schema.kickstartds.com/base/section.schema.json#/properties/content/properties/mode"
                }
              ]
            }
          }
        }
      }
    }
  ]
}

Expectes output:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://schema.project.com/section.schema.json",
  "title": "Section",
  "type": "object",
  "properties": {
    "content": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "title": "Mode",
          "description": "Layout mode used for section contents",
          "enum": ["default", "tile", "list", "slider"],
          "default": "default"
        },
        
      }
    },
    
  }
}

Acutal output:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://schema.project.com/section.schema.json",
  "title": "Section",
  "type": "object",
  "properties": {
    "content": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "title": "Mode",
          "description": "Layout mode used for section contents",
          "enum": ["default", "tile", "list"],
          "default": "default",
          "anyOf": [
            {
              "type": "string",
              "enum": ["default", "tile", "list", "slider"],
              "default": "default"
            },
            {
              "type": "string",
              "title": "Mode",
              "description": "Layout mode used for section contents",
              "enum": ["default", "tile", "list"],
              "default": "default"
            }
          ]
        },
        
      }
    },
    
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions