You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Metadata] Incorrect api schema for path variable #8646
Description
I noticed that all path variables have the default schema ['type' => 'string'], even when the variable is linked to a class property that does have a type / format.
This means that the swagger-ui will display it as a string input field, and miss the correct validation.
Possible Solution
The ApiPlatform\Metadata\Resource\Factory\LinkFactory class is used to generate Link instances based on things like the Operation's uriTemplate.
Here I can use the propertyMetadataFactory to get the schema of the linked property.
Questions
Is this something that should be fixed/implemented at all? For me this would save me from having to add the uriVariables parameter with Link classes everytime.
Is this considered a bug (pull request towards 5.0 branch), or a missing feature (pull request towards main branch?
This is a missing feature, not a bug, so it'd target main. Changing the OpenAPI document in a patch release already bit us with #8600.
Today you can declare it with new Link(schema: ['type' => 'integer']), the default string comes from https://github.com/api-platform/core/blob/5.0/src/OpenApi/Factory/OpenApiFactory.php#L309. I'd rather infer it there than in the LinkFactory so the Link metadata stays untouched: when the Link has no schema and a single identifier, use the identifier property's schema (type/format only, so integer or string + uuid), and keep string for composite identifiers. Note that the Link schema isn't used for validation on uri variables, so this is documentation only.
4. This is a missing feature, not a bug, so it'd target main. Changing the OpenAPI document in a patch release already bit us with #8600.
Today you can declare it with new Link(schema: ['type' => 'integer']), the default string comes from https://github.com/api-platform/core/blob/5.0/src/OpenApi/Factory/OpenApiFactory.php#L309. I'd rather infer it there than in the LinkFactory so the Link metadata stays untouched: when the Link has no schema and a single identifier, use the identifier property's schema (type/format only, so integer or string + uuid), and keep string for composite identifiers. Note that the Link schema isn't used for validation on uri variables, so this is documentation only.
Do you want to open a PR?
Activity
[-][Metadata] Incorrect path variable schemas[/-][+][Metadata] Incorrect api schema for path variable[/+]soyuka commentedon Oct 13, 2026
This is a missing feature, not a bug, so it'd target
main. Changing the OpenAPI document in a patch release already bit us with #8600.Today you can declare it with
new Link(schema: ['type' => 'integer']), the defaultstringcomes from https://github.com/api-platform/core/blob/5.0/src/OpenApi/Factory/OpenApiFactory.php#L309. I'd rather infer it there than in theLinkFactoryso the Link metadata stays untouched: when the Link has no schema and a single identifier, use the identifier property's schema (type/formatonly, sointegerorstring+uuid), and keepstringfor composite identifiers. Note that the Link schema isn't used for validation on uri variables, so this is documentation only.Do you want to open a PR?
bram123 commentedon Oct 16, 2026
Yes ofc, I'm working on it in #8677