sagold / json-schema-library

Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation
MIT License
164 stars 19 forks source link

Mutiple typeIds [not, oneOf] matched in subschema #52

Open joakim-ronning opened 5 months ago

joakim-ronning commented 5 months ago

Hello,

I'm trying to add the OpenAPI 3.0 schema to one of my projects using Draft04, but I'm running into an error I cannot comprehend.

Error:

Mutiple typeIds [not, oneOf] matched in {...}

Offending sub-schema:

"SchemaXORContent": {
        "description": "Schema and content are mutually exclusive, at least one is required",
        "not": {
          "required": [
            "schema",
            "content"
          ]
        },
        "oneOf": [
          {
            "required": [
              "schema"
            ]
          },
          {
            "required": [
              "content"
            ],
            "description": "Some properties are not allowed if content is present",
            "allOf": [
              {
                "not": {
                  "required": [
                    "style"
                  ]
                }
              },
              {
                "not": {
                  "required": [
                    "explode"
                  ]
                }
              },
              {
                "not": {
                  "required": [
                    "allowReserved"
                  ]
                }
              },
              {
                "not": {
                  "required": [
                    "example"
                  ]
                }
              },
              {
                "not": {
                  "required": [
                    "examples"
                  ]
                }
              }
            ]
          }
        ]
      }

If this is expected, are there any known solutions?

Best regards

sagold commented 3 months ago

Sorry for the late reply. To me it looks like not in conjunction with oneOf is unsupported. I will need to investigate this. The only possible workaround for now might be a change of the schema.