senskysh/swagger-processors
最新稳定版本:v0.1.1
Composer 安装命令:
composer require senskysh/swagger-processors
包简介
README 文档
README
-
AddSchemaToQueryParameters
Добавляет свойства схемы как query параметры
Пример:#[Schema( properties: [ new Property(property: 'page', type: 'integer', default: 1), new Property(property: 'perPage', type: 'integer', default: 50) ] )] class Pagination{...} #[Get( path: "/api/v1/posts", x: [ AddSchemaToQueryParameters::REF => [Pagination::class] ] )]Преобразуется в
#[Get( path: "/api/v1/posts", parameters: [ new Parameter(name: 'page', in: 'query', schema: new Schema(type: 'integer', default: 1)), new Parameter(name: 'perPage', in: 'query', schema: new Schema(type: 'integer', default: 50)), ] )] -
EnsureRequiredProperties
Проставляет в схему обязательность свойства
Пример:#[Schema( properties: [ new Property(property: 'requiredProp1', type: 'integer'), new Property(property: 'requiredProp2', type: 'integer'), new Property(property: 'requiredProp3', type: 'integer'), new Property(property: 'nonRequiredProp', type: 'integer', nullable: true) ] )]Преобразуется в
#[Schema( required: ['requiredProp1', 'requiredProp2', 'requiredProp3'], properties: [ new Property(property: 'requiredProp1', type: 'integer'), new Property(property: 'requiredProp2', type: 'integer'), new Property(property: 'requiredProp3', type: 'integer'), new Property(property: 'nonRequiredProp', type: 'integer', nullable: true) ] )] -
GenerateSchemaProperties
Добавляет аннотации свойств публичным свойствам класса с атрибутом GenerateSchema
Пример:#[GenerateSchema] class Pagination { public function __construct( public int $page = 1, public int $perPage = 50, ) { } }
Преобразуется в
#[Schema] class Pagination { public function __construct( #[Property] public int $page = 1, #[Property] public int $perPage = 50, ) { } }
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-08