|
| 1 | +<?php |
| 2 | +namespace App\Swagger\schemas; |
| 3 | + |
| 4 | +use OpenApi\Attributes as OA; |
| 5 | + |
| 6 | +#[OA\Schema( |
| 7 | + schema: 'ApiScope', |
| 8 | + type: 'object', |
| 9 | + properties: [ |
| 10 | + new OA\Property( |
| 11 | + property: 'id', |
| 12 | + type: 'integer', |
| 13 | + example: 1, |
| 14 | + description: 'Scope ID' |
| 15 | + ), |
| 16 | + new OA\Property( |
| 17 | + property: 'name', |
| 18 | + type: 'string', |
| 19 | + example: 'read-all-summit-data', |
| 20 | + description: 'Scope name' |
| 21 | + ), |
| 22 | + new OA\Property( |
| 23 | + property: 'description', |
| 24 | + type: 'string', |
| 25 | + example: 'Allows reading all summit data', |
| 26 | + description: 'Scope description' |
| 27 | + ), |
| 28 | + new OA\Property( |
| 29 | + property: 'active', |
| 30 | + type: 'boolean', |
| 31 | + example: true, |
| 32 | + description: 'Whether the scope is active' |
| 33 | + ), |
| 34 | + ] |
| 35 | +)] |
| 36 | +class ApiScopeSchema {} |
| 37 | + |
| 38 | +#[OA\Schema( |
| 39 | + schema: 'ApiEndpointAuthzGroup', |
| 40 | + type: 'object', |
| 41 | + properties: [ |
| 42 | + new OA\Property( |
| 43 | + property: 'id', |
| 44 | + type: 'integer', |
| 45 | + example: 1, |
| 46 | + description: 'Authorization group ID' |
| 47 | + ), |
| 48 | + new OA\Property( |
| 49 | + property: 'name', |
| 50 | + type: 'string', |
| 51 | + example: 'Administrators', |
| 52 | + description: 'Authorization group name' |
| 53 | + ), |
| 54 | + ] |
| 55 | +)] |
| 56 | +class ApiEndpointAuthzGroupSchema {} |
| 57 | + |
| 58 | +#[OA\Schema( |
| 59 | + schema: 'ApiEndpoint', |
| 60 | + type: 'object', |
| 61 | + properties: [ |
| 62 | + new OA\Property( |
| 63 | + property: 'id', |
| 64 | + type: 'integer', |
| 65 | + example: 1, |
| 66 | + description: 'Endpoint ID' |
| 67 | + ), |
| 68 | + new OA\Property( |
| 69 | + property: 'name', |
| 70 | + type: 'string', |
| 71 | + example: 'get-summits', |
| 72 | + description: 'Endpoint name' |
| 73 | + ), |
| 74 | + new OA\Property( |
| 75 | + property: 'description', |
| 76 | + type: 'string', |
| 77 | + example: 'Retrieve all summits', |
| 78 | + description: 'Endpoint description' |
| 79 | + ), |
| 80 | + new OA\Property( |
| 81 | + property: 'active', |
| 82 | + type: 'boolean', |
| 83 | + example: true, |
| 84 | + description: 'Whether the endpoint is active' |
| 85 | + ), |
| 86 | + new OA\Property( |
| 87 | + property: 'route', |
| 88 | + type: 'string', |
| 89 | + example: '/api/v1/summits', |
| 90 | + description: 'Endpoint route' |
| 91 | + ), |
| 92 | + new OA\Property( |
| 93 | + property: 'http_method', |
| 94 | + type: 'string', |
| 95 | + example: 'GET', |
| 96 | + description: 'HTTP method', |
| 97 | + enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] |
| 98 | + ), |
| 99 | + new OA\Property( |
| 100 | + property: 'scopes', |
| 101 | + type: 'array', |
| 102 | + items: new OA\Items(type: 'integer'), |
| 103 | + description: 'Required OAuth2 scope IDs' |
| 104 | + ), |
| 105 | + new OA\Property( |
| 106 | + property: 'authz_groups', |
| 107 | + type: 'array', |
| 108 | + items: new OA\Items(type: 'integer'), |
| 109 | + description: 'Required authorization group IDs' |
| 110 | + ), |
| 111 | + ] |
| 112 | +)] |
| 113 | +class ApiEndpointSchema {} |
| 114 | + |
| 115 | +#[OA\Schema( |
| 116 | + schema: 'Api', |
| 117 | + type: 'object', |
| 118 | + properties: [ |
| 119 | + new OA\Property( |
| 120 | + property: 'id', |
| 121 | + type: 'integer', |
| 122 | + example: 1, |
| 123 | + description: 'API ID' |
| 124 | + ), |
| 125 | + new OA\Property( |
| 126 | + property: 'name', |
| 127 | + type: 'string', |
| 128 | + example: 'summits', |
| 129 | + description: 'API name' |
| 130 | + ), |
| 131 | + new OA\Property( |
| 132 | + property: 'description', |
| 133 | + type: 'string', |
| 134 | + example: 'Summit Management API', |
| 135 | + description: 'API description' |
| 136 | + ), |
| 137 | + new OA\Property( |
| 138 | + property: 'active', |
| 139 | + type: 'boolean', |
| 140 | + example: true, |
| 141 | + description: 'Whether the API is active' |
| 142 | + ), |
| 143 | + new OA\Property( |
| 144 | + property: 'scopes', |
| 145 | + type: 'array', |
| 146 | + items: new OA\Items(type: 'integer'), |
| 147 | + description: 'API scope IDs' |
| 148 | + ), |
| 149 | + new OA\Property( |
| 150 | + property: 'endpoints', |
| 151 | + type: 'array', |
| 152 | + items: new OA\Items(type: 'integer'), |
| 153 | + description: 'API endpoint IDs' |
| 154 | + ), |
| 155 | + ] |
| 156 | +)] |
| 157 | +class ApiSchema {} |
| 158 | + |
| 159 | +#[OA\Schema( |
| 160 | + schema: 'PublicEndpoint', |
| 161 | + type: 'object', |
| 162 | + properties: [ |
| 163 | + new OA\Property( |
| 164 | + property: 'route', |
| 165 | + type: 'string', |
| 166 | + example: '/api/public/v1/timezones', |
| 167 | + description: 'Public endpoint route' |
| 168 | + ), |
| 169 | + new OA\Property( |
| 170 | + property: 'http_methods', |
| 171 | + type: 'array', |
| 172 | + items: new OA\Items(type: 'string'), |
| 173 | + example: ['GET'], |
| 174 | + description: 'Available HTTP methods' |
| 175 | + ), |
| 176 | + ] |
| 177 | +)] |
| 178 | +class PublicEndpointSchema {} |
| 179 | + |
| 180 | +#[OA\Schema( |
| 181 | + schema: 'EndpointsDefinitionsResponse', |
| 182 | + type: 'object', |
| 183 | + properties: [ |
| 184 | + new OA\Property( |
| 185 | + property: 'oauth2_endpoints', |
| 186 | + type: 'array', |
| 187 | + items: new OA\Items(ref: '#/components/schemas/Api'), |
| 188 | + description: 'List of OAuth2 protected APIs with their endpoints' |
| 189 | + ), |
| 190 | + new OA\Property( |
| 191 | + property: 'public_endpoints', |
| 192 | + type: 'array', |
| 193 | + items: new OA\Items(ref: '#/components/schemas/PublicEndpoint'), |
| 194 | + description: 'List of public endpoints' |
| 195 | + ), |
| 196 | + ] |
| 197 | +)] |
| 198 | +class EndpointsDefinitionsResponseSchema {} |
0 commit comments