References PropertySchemaRestrictionMetadataInterface
Reference
I
Interface

ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaRestrictionMetadataInterface

Interface PropertySchemaRestrictionsInterface. This interface is autoconfigured with the api_platform.metadata.property_schema_restriction tag. It is used to generate a Resource schema using property restrictions based on the Symfony’s built-in validator. For example, the Regex constraint uses a pattern type within the JSON schema.

interface ApiPlatform\Symfony\Validator\Metadata\Property\Restriction\PropertySchemaRestrictionMetadataInterface
{
    public create(Symfony\Component\Validator\Constraint $constraint, ApiPlatform\Metadata\ApiProperty $propertyMetadata): array
    public supports(Symfony\Component\Validator\Constraint $constraint, ApiPlatform\Metadata\ApiProperty $propertyMetadata): bool
}

Methods

create

Creates json schema restrictions based on the validation constraints.

public create(Symfony\Component\Validator\Constraint $constraint, ApiPlatform\Metadata\ApiProperty $propertyMetadata): array

Parameters

constraintSymfony\Component\Validator\ConstraintThe validation constraint
propertyMetadata`ApiPlatform\Metadata\ApiProperty`The property metadata

Returns

array

supports

Is the constraint supported by the schema restriction?

public supports(Symfony\Component\Validator\Constraint $constraint, ApiPlatform\Metadata\ApiProperty $propertyMetadata): bool

Parameters

constraintSymfony\Component\Validator\ConstraintThe validation constraint
propertyMetadata`ApiPlatform\Metadata\ApiProperty`The property metadata

Returns

bool

Made with love by

Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.

Learn more

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop