Skip to content

Commit 8e66b27

Browse files
committed
feat: Add OpenAPI schemas for UserStory, Organization, Continent, File, and UserStoriesIndustry models
1 parent 7651ec1 commit 8e66b27

6 files changed

Lines changed: 125 additions & 27 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'Continent',
10+
type: 'object',
11+
properties: [
12+
new OA\Property(property: 'id', type: 'integer', example: 1),
13+
new OA\Property(property: 'created', type: 'integer', example: 1),
14+
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
15+
new OA\Property(property: 'name', type: 'string', example: 'Example Organization'),
16+
17+
])
18+
]
19+
class ContinentSchema
20+
{
21+
}

app/Swagger/Models/FileSchema.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'File',
10+
type: 'object',
11+
properties: [
12+
new OA\Property(property: 'id', type: 'integer', example: 1),
13+
new OA\Property(property: 'created', type: 'integer', example: 1),
14+
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
15+
new OA\Property(property: 'name', type: 'string', example: 'example.png'),
16+
new OA\Property(property: 'title', type: 'string', example: 'Awesome Picture'),
17+
new OA\Property(property: 'url', type: 'string', example: 'https://example.com/files/example.png'),
18+
])
19+
]
20+
class FileSchema
21+
{
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'Organization',
10+
type: 'object',
11+
properties: [
12+
new OA\Property(property: 'id', type: 'integer', example: 1),
13+
new OA\Property(property: 'created', type: 'integer', example: 1),
14+
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
15+
new OA\Property(property: 'name', type: 'string', example: 'Example Organization'),
16+
17+
])
18+
]
19+
class OrganizationSchema
20+
{
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'UserStoriesIndustry',
10+
type: 'object',
11+
properties: [
12+
new OA\Property(property: 'id', type: 'integer', example: 1),
13+
new OA\Property(property: 'created', type: 'integer', example: 1),
14+
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
15+
new OA\Property(property: 'name', type: 'string', example: 'Example Organization'),
16+
new OA\Property(property: 'active', type: 'boolean', example: true),
17+
18+
])
19+
]
20+
class UserStoriesIndustrySchema
21+
{
22+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
9+
#[OA\Schema(
10+
schema: 'UserStory',
11+
type: 'object',
12+
properties: [
13+
new OA\Property(property: 'id', type: 'integer', example: 1),
14+
new OA\Property(property: 'created', type: 'integer', example: 1633024800, description: 'Unix timestamp when created'),
15+
new OA\Property(property: 'last_edited', type: 'integer', example: 1633111200, description: 'Unix timestamp when last updated'),
16+
new OA\Property(property: 'name', type: 'string', example: 'Large Scale Cloud Infrastructure'),
17+
new OA\Property(property: 'description', type: 'string', example: 'Full description of how this organization uses OpenStack...'),
18+
new OA\Property(property: 'short_description', type: 'string', example: 'Brief overview of the use case'),
19+
new OA\Property(property: 'link', type: 'string', nullable: true, example: 'https://example.com/case-study'),
20+
new OA\Property(property: 'active', type: 'boolean', example: true),
21+
new OA\Property(property: 'is_million_core_club', type: 'boolean', example: false, description: 'Whether this is a million core club member'),
22+
new OA\Property(property: 'organization_id', type: 'integer', example: 14),
23+
new OA\Property(property: 'industry_id', type: 'integer', example: 14),
24+
new OA\Property(property: 'location_id', type: 'integer', example: 14),
25+
new OA\Property(property: 'image_id', type: 'integer', example: 14),
26+
new OA\Property(property: 'organization', ref: '#/components/schemas/Organization', description: 'Organization object, only available if expanded via ?expand=organization'),
27+
new OA\Property(property: 'industry', ref: '#/components/schemas/UserStoriesIndustry', description: 'UserStoriesIndustry object, only available if expanded via ?expand=industry'),
28+
new OA\Property(property: 'location', ref: '#/components/schemas/Continent', description: 'Continent object, only available if expanded via ?expand=location'),
29+
new OA\Property(property: 'image', ref: '#/components/schemas/File', description: 'File object, only available if expanded via ?expand=image'),
30+
new OA\Property(
31+
property: 'tags',
32+
type: 'array',
33+
description: 'Array of tag IDs, available only if included in ?relations=tags, use expand=tags for full objects instead of IDs',
34+
items: new OA\Items(type: 'integer'),
35+
example: [1, 2, 3]
36+
),
37+
]
38+
)]
39+
class UserStorySchema {}

app/Swagger/schemas.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -419,33 +419,6 @@ class ChunkedFileUploadRequestSchema {}
419419

420420
// User Stories
421421

422-
#[OA\Schema(
423-
schema: 'UserStory',
424-
type: 'object',
425-
properties: [
426-
new OA\Property(property: 'id', type: 'integer', example: 1),
427-
new OA\Property(property: 'created', type: 'integer', example: 1633024800, description: 'Unix timestamp when created'),
428-
new OA\Property(property: 'last_edited', type: 'integer', example: 1633111200, description: 'Unix timestamp when last updated'),
429-
new OA\Property(property: 'name', type: 'string', example: 'Large Scale Cloud Infrastructure'),
430-
new OA\Property(property: 'description', type: 'string', example: 'Full description of how this organization uses OpenStack...'),
431-
new OA\Property(property: 'short_description', type: 'string', example: 'Brief overview of the use case'),
432-
new OA\Property(property: 'link', type: 'string', nullable: true, example: 'https://example.com/case-study'),
433-
new OA\Property(property: 'active', type: 'boolean', example: true),
434-
new OA\Property(property: 'is_million_core_club', type: 'boolean', example: false, description: 'Whether this is a million core club member'),
435-
new OA\Property(property: 'organization', type: 'Organization'),
436-
new OA\Property(property: 'industry', type: 'Industry'),
437-
new OA\Property(property: 'location', type: 'Location'),
438-
new OA\Property(property: 'image', type: 'Image'),
439-
new OA\Property(
440-
property: 'tags',
441-
type: 'array',
442-
description: 'Array of tag IDs (use expand=tags for full details)',
443-
items: new OA\Items(type: 'integer'),
444-
example: [1, 2, 3]
445-
),
446-
]
447-
)]
448-
class UserStorySchema {}
449422

450423
#[OA\Schema(
451424
schema: 'PaginatedUserStoriesResponse',

0 commit comments

Comments
 (0)