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

Creation of dynamic property for composed item validators on properties #77

Closed
wol-soft opened this issue Sep 14, 2023 · 0 comments · Fixed by #78
Closed

Creation of dynamic property for composed item validators on properties #77

wol-soft opened this issue Sep 14, 2023 · 0 comments · Fixed by #78
Assignees
Labels
bug Something isn't working

Comments

@wol-soft
Copy link
Owner

Describe the bug
Composed item validators on properties use the _propertyValidationState property inside the validator which is used for base validators to determine whether a property change must trigger a re-evaluation of the base validator. As the _propertyValidationState property is only added to the model when a composed item base validator is found the property might not be present and the access will trigger a deprecation warning in PHP >= 8.2.

Expected behavior
Don't use the _propertyValidationState outside of base validators.

Schema

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "type": "object",
  "definitions": {
    "number": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000
    },
    "values": {
      "type": "array",
      "items": {
        "allOf": [
          { "$ref": "#/definitions/number" },
          { "minimum": 1 }
        ]
      },
      "minItems": 1
    },
    "pet": {
      "oneOf": [
        { "$ref": "#/definitions/pets/dog" },
        { "$ref": "#/definitions/pets/spider" }
      ]
    },
    "pets": {
      "dog": {
        "type": "object",
        "properties": {
          "age": {
            "$ref": "#/definitions/number"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "spider": {
        "type": "object",
        "properties": {
          "age": {
            "$ref": "#/definitions/number"
          },
          "weight": {
            "type": "number"
          }
        }
      }
    }
  },
  "properties": {
    "values": {
      "$ref": "#/definitions/values"
    },
    "pet": {
      "$ref": "#/definitions/pet"
    }
  },
  "additionalProperties": false
}

Version:
0.23.4

@wol-soft wol-soft self-assigned this Sep 14, 2023
@wol-soft wol-soft added the bug Something isn't working label Sep 14, 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
1 participant