admin icon indicating copy to clipboard operation
admin copied to clipboard

Using the Schema.org Vocabulary

Open laurent-bientz opened this issue 1 year ago • 0 comments

API Platform version(s) affected: 3.2.13

Description

With the default HydraAdmin, according to the documentation, we can customize some fields automatically, unfortunately this has no effect on the admin field.

For example, with the schema type #[ApiProperty(types: ['https://schema.org/email'])], I expect to get an input type="email".

<input 
	aria-invalid="false" 
	aria-describedby="email-helper-text" 
	id="email" 
	name="email" 
	type="text" 
	class="MuiInputBase-input MuiFilledInput-input MuiInputBase-inputSizeSmall css-1zuho2-MuiInputBase-input-MuiFilledInput-input" 
	value="[email protected]"
>

image

Do I miss something or the documentation isn't up to date?

How to reproduce

#[ApiProperty(types: ['https://schema.org/email'])]
#[ORM\Column(length: 180, unique: true)]
#[Assert\NotNull]
#[Assert\Email]
#[Groups(['user-read', 'user-write', 'user-create'])]
private ?string $email = null;

Possible Solution
No idea.

Additional Context

This other documentation mentions that constraints are automatically "casted" into the correct schema.

I also have an #[Assert\Email] on my property but still a basic text input on admin.

My hydra:ApiDocumentation https://localhost/docs.jsonld

image

laurent-bientz avatar Feb 13 '24 18:02 laurent-bientz