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
Description
When I specify an openapiContext in my #[ApiProperty], the typing of the same property is no longer used, and I am forced to explicitly specify it within the openapiContext array.
As a result, both Swagger and ReDoc documentation display the field as any.
We have observed this issue with several strictly typed fields in PHP, such as bool, DateTimeImmutable, and others.
How to reproduce
this configuration provide a any type in the documentation
#[ApiProperty(
openapiContext: [
'description' => 'The date on which the Article was created or the item was added to a feed.'
],
types: ['https://schema.org/datePublished']
)]
#[Groups(['Article:Read:List'])]
public ?\DateTimeImmutable $publishedAt = null,
Additional Context
Here is the dump of $propertySchema in ApiPlatform\JsonSchema\SchemaFactory
array:2 [▼
"externalDocs" => array:1 [▼
"url" => "https://schema.org/datePublished"
]
"description" => "The date on which the News was created or the item was added to a feed."
]
if i remove the openapiContext in my ApiProperty attribute
#[ApiProperty]
#[Groups(['Article:Read:List'])]
public ?\DateTimeImmutable $publishedAt = null,
The text was updated successfully, but these errors were encountered:
SebLevDev
changed the title
[OpenAPI] Typing Issue with openapiContext in `#[ApiProperty] Leading to *any* in Documentation
[OpenAPI] Typing Issue with openapiContext in #[ApiProperty] Leading to *any* in Documentation
Jan 7, 2025
SebLevDev
changed the title
[OpenAPI] Typing Issue with openapiContext in #[ApiProperty] Leading to *any* in Documentation
[OpenAPI] Typing Issue with openapiContext in #[ApiProperty] Leading to **any** in Documentation
Jan 7, 2025
SebLevDev
changed the title
[OpenAPI] Typing Issue with openapiContext in #[ApiProperty] Leading to **any** in Documentation
[OpenAPI] Typing Issue with openapiContext in #[ApiProperty] Leading to any in Documentation
Jan 7, 2025
SebLevDev
added a commit
to SebLevDev/api-platform-core
that referenced
this issue
Jan 10, 2025
…ing to any in Documentation
Cfr api-platform#6893
When specify an openapiContext in #[ApiProperty], the typing of the same property is no longer used, and force to explicitly specify it within the openapiContext array.
SebLevDev
added a commit
to SebLevDev/api-platform-core
that referenced
this issue
Jan 10, 2025
…Leading to `any` in Documentation
When specify an `openapiContext` in #`[ApiProperty]`, the typing of the same property is no longer used, and force to explicitly specify it within the openapiContext array.
Cfr: api-platform#6893
API Platform version(s) affected: 4.x
Description
When I specify an
openapiContext
in my#[ApiProperty]
, the typing of the same property is no longer used, and I am forced to explicitly specify it within theopenapiContext
array.As a result, both Swagger and ReDoc documentation display the field as any.
We have observed this issue with several strictly typed fields in PHP, such as
bool
,DateTimeImmutable
, and others.How to reproduce
this configuration provide a any type in the documentation
Additional Context
Here is the dump of
$propertySchema
inApiPlatform\JsonSchema\SchemaFactory
if i remove the
openapiContext
in myApiProperty
attributeThe dump returned is good
The text was updated successfully, but these errors were encountered: