zircote / swagger-php

A php swagger annotation and parsing library
http://zircote.github.io/swagger-php/
Apache License 2.0
5.08k stars 933 forks source link

All properties for all schemas became Deprecated #1607

Open antonrinas opened 3 months ago

antonrinas commented 3 months ago

Screenshot from 2024-06-19 15-32-33 I noted that from some moment, all properties for certain schemas were marked as Deprecated.

I found the reason. Before the Schema description, I also have some class annotations. Within these annotations, one of the class properties is marked as @deprecated. In this case, all properties in the Schema after doc generation are marked as deprecated.

/**
 * @property int $id
 * ...
 * @property int $general_id @deprecated
 * ...
 */
#[OA\Schema(
    schema: 'Client',
    title: 'Client',
    description: 'Client',
    properties: [
        new OA\Property(property: 'id', description: 'ID', type: 'integer'),
        ...
    ]
)]
class ClientRecord {
...

For now, as a temporary decision, I marked all properties as deprecated: false.

new OA\Property(property: 'id', description: 'ID', type: 'integer', deprecated: false),
DerManoMann commented 3 months ago

I think this is a problem with how you use @deprecated? The tag applies to the associated structural element - in this case the schema.

https://docs.phpdoc.org/guide/references/phpdoc/tags/deprecated.html The @deprecated tag declares that the associated Structural Element(s) will be removed in a future version...

https://phpstan.org/writing-php-code/phpdocs-basics#deprecations Use @deprecated tag to mark declarations as deprecated:...