Skip to content

minLength > 0 adds NotBlank Constraint without consideration for nullable: true #697

@func0der

Description

@func0der

Jane version(s) affected: 7.4.0

Description
A string property with a minLength > 0 adds a NotBlank constraints and ignores the nullable: true property in the schema.

if ($object->getMinLength() > 0) {
$guess->addValidatorGuess(new ValidatorGuess(NotBlank::class));

How to reproduce

    Shop:
      type: object
      properties
        name:
          type: string
          minLength: 1
          nullable: true

Possible Solution
NotBlank constraint got an option called allowNull , which could be used to mitigate this.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions