OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
vendor
/
zircote
/
swagger-php
/
docs
/
guide
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:25 AM
rwxr-xr-x
📄
annotations.md
3.44 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
attributes.md
1.14 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
common-techniques.md
6.98 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
cookbook.md
15.6 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
faq.md
5.25 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
generating-openapi-documents.md
1.91 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
index.md
990 bytes
08/07/2024 04:34:24 AM
rw-r--r--
📄
installation.md
455 bytes
08/07/2024 04:34:24 AM
rw-r--r--
📄
migrating-to-v3.md
1.74 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
migrating-to-v4.md
5.33 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
required-elements.md
1.11 KB
08/07/2024 04:34:24 AM
rw-r--r--
📄
under-the-hood.md
1.8 KB
08/07/2024 04:34:24 AM
rw-r--r--
Editing: attributes.md
Close
# Attributes ::: tip Namespace Using a namespace alias simplifies typing and improves readability. All attributes are in the `OpenApi\Attributes` namespace. ::: ## Nesting Similar to annotations attributes can be top level or nested. However, attributes **may be put at the same level** if there is no ambiguity. `swagger-php` will then merge attributes according to the defined rules about parent/child relationships. **Example** Nested: ```php #[OA\Get( path: '/api/users', responses: [ new OA\Response(response: 200, description: 'AOK'), new OA\Response(response: 401, description: 'Not allowed'), ] )] public function users() { /* ... */ } ``` Not nested: ```php #[OA\Get(path: '/api/users')] #[OA\Response(response: 200, description: 'AOK')] #[OA\Response(response: 401, description: 'Not allowed')] public function users() { /* ... */ } ``` Depending on how much nesting there is this can make things a bit simpler and easier to read. ::: warning Top level only Automatic merging of attributes works only at the top level - in the example that would be the method `users()`. :::