Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lmestel opened this issue Nov 10, 2023 · 0 comments
Open

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

lmestel opened this issue Nov 10, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@lmestel
Copy link
Contributor

lmestel commented Nov 10, 2023

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"
            }
          ]
        },
        
      }
    },
    
  }
}
@julrich julrich added the bug Something isn't working label Nov 13, 2023
@julrich julrich added this to the Release 09/2023 milestone Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants