承接 senskysh/swagger-processors 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

senskysh/swagger-processors

最新稳定版本:v0.1.1

Composer 安装命令:

composer require senskysh/swagger-processors

包简介

README 文档

README

  1. 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)),
        ]
    )]
  2. 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)
        ]
    )]
  3. 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-08