Skip to content

Commit cc41504

Browse files
committed
Minimal auth scheme support added.
1 parent 4481f14 commit cc41504

File tree

5 files changed

+331
-90
lines changed

5 files changed

+331
-90
lines changed

plugin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = "com.github.raymank26"
8-
version = project.findProperty("version")?.takeIf { it != "unspecified" } ?: "1.12-SNAPSHOT"
8+
version = project.findProperty("version")?.takeIf { it != "unspecified" } ?: "1.13-SNAPSHOT"
99

1010
repositories {
1111
mavenCentral()

plugin/src/functionalTest/kotlin/com/github/raymank26/functional/FunctionalTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class FunctionalTest {
4646
}
4747
GradleRunner.create()
4848
.withProjectDir(projectDir)
49+
.withDebug(true)
4950
.withArguments("generateOpenApiClasses")
5051
.forwardOutput()
5152
.withPluginClasspath()
Lines changed: 259 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,281 @@
1-
swagger: "2.0"
1+
openapi: "3.0.0"
22
info:
33
version: 1.0.0
4-
title: Swagger Petstore
5-
license:
6-
name: MIT
7-
host: petstore.swagger.io
8-
basePath: /v1
9-
schemes:
10-
- http
11-
consumes:
12-
- application/json
13-
produces:
14-
- application/json
4+
title: FameFlow API
5+
servers:
6+
- url: https://api.fameflow.ai
7+
- url: https://apitest.fameflow.ai
8+
- url: http://localhost:7070
159
paths:
16-
/pets:
17-
get:
18-
summary: List all pets
19-
operationId: listPets
10+
/admin-api/task:
11+
post:
2012
tags:
21-
- pets
13+
- Task
14+
summary: Runs a task
15+
operationId: runTask
2216
parameters:
23-
- name: limit
17+
- name: ff-service-key
18+
in: header
19+
required: true
20+
schema:
21+
type: string
22+
- name: task_name
2423
in: query
25-
description: How many items to return at one time (max 100)
26-
required: false
27-
type: integer
28-
format: int32
24+
required: true
25+
schema:
26+
type: string
27+
requestBody:
28+
required: true
29+
content:
30+
application/json:
31+
schema:
32+
$ref: '#/components/schemas/TaskParameters'
2933
responses:
3034
"200":
31-
description: A paged array of pets
32-
headers:
33-
x-next:
34-
type: string
35-
description: A link to the next page of responses
36-
schema:
37-
$ref: '#/definitions/Pets'
35+
description: OK
3836
default:
39-
description: unexpected error
40-
schema:
41-
$ref: '#/definitions/Error'
42-
post:
43-
summary: Create a pet
44-
operationId: createPets
37+
description: Unexpected error
38+
content:
39+
application/json:
40+
schema:
41+
$ref: '#/components/schemas/Error'
42+
/admin-api/influencer/pending-moderation:
43+
get:
4544
tags:
46-
- pets
45+
- Admin
46+
security:
47+
- BearerAuth: [ ]
48+
summary: Returns a list of influencers with pending moderation
49+
operationId: getPendingModerationInfluencersPage
50+
parameters:
51+
- name: page
52+
in: query
53+
schema:
54+
type: integer
55+
- name: per_page
56+
in: query
57+
schema:
58+
type: integer
4759
responses:
48-
"201":
49-
description: Null response
60+
"200":
61+
description: OK
62+
content:
63+
application/json:
64+
schema:
65+
$ref: '#/components/schemas/InfluencerAdminPage'
5066
default:
51-
description: unexpected error
52-
schema:
53-
$ref: '#/definitions/Error'
54-
/pets/{petId}:
67+
description: Unexpected error
68+
content:
69+
application/json:
70+
schema:
71+
$ref: '#/components/schemas/Error'
72+
/admin-api/influencer/{influencer_id}/photo:
5573
get:
56-
summary: Info for a specific pet
57-
operationId: showPetById
5874
tags:
59-
- pets
75+
- Admin
76+
summary: Returns a list of photos by an influencer
77+
operationId: getInfluencerPhotos
6078
parameters:
61-
- name: petId
79+
- name: Authorization
80+
in: header
81+
required: true
82+
schema:
83+
type: string
84+
- name: influencer_id
6285
in: path
6386
required: true
64-
description: The id of the pet to retrieve
65-
type: string
87+
schema:
88+
type: string
89+
format: uuid
90+
- name: page
91+
in: query
92+
schema:
93+
type: integer
94+
- name: per_page
95+
in: query
96+
schema:
97+
type: integer
6698
responses:
6799
"200":
68-
description: Expected response to a valid request
100+
description: OK
101+
content:
102+
application/json:
103+
schema:
104+
$ref: '#/components/schemas/InfluencerPhotosAdminPage'
105+
default:
106+
description: Unexpected error
107+
content:
108+
application/json:
109+
schema:
110+
$ref: '#/components/schemas/Error'
111+
post:
112+
tags:
113+
- Admin
114+
summary: Updates status of a specific photo of an influencer photo set
115+
operationId: updateInfluencerPhoto
116+
parameters:
117+
- name: Authorization
118+
in: header
119+
required: true
69120
schema:
70-
$ref: '#/definitions/Pet'
121+
type: string
122+
- name: influencer_id
123+
in: path
124+
required: true
125+
schema:
126+
type: string
127+
format: uuid
128+
requestBody:
129+
required: true
130+
content:
131+
application/json:
132+
schema:
133+
$ref: '#/components/schemas/InfluencerPhotoUpdate'
134+
responses:
135+
"200":
136+
description: OK
137+
content:
138+
application/json:
139+
schema:
140+
$ref: '#/components/schemas/InfluencerPhotoAdmin'
71141
default:
72-
description: unexpected error
142+
description: Unexpected error
143+
content:
144+
application/json:
145+
schema:
146+
$ref: '#/components/schemas/Error'
147+
/admin-api/influencer/{influencer_id}/dataset:
148+
post:
149+
tags:
150+
- Admin
151+
summary: Requests creation of a dataset on influencer approved photos
152+
operationId: requestInfluencerDatasetCreation
153+
parameters:
154+
- name: Authorization
155+
in: header
156+
required: true
73157
schema:
74-
$ref: '#/definitions/Error'
75-
definitions:
76-
Pet:
77-
type: "object"
78-
required:
79-
- id
80-
- name
81-
properties:
82-
id:
83-
type: integer
84-
format: int64
85-
name:
86-
type: string
87-
tag:
88-
type: string
89-
Pets:
90-
type: array
91-
items:
92-
$ref: '#/definitions/Pet'
93-
Error:
94-
type: "object"
95-
required:
96-
- code
97-
- message
98-
properties:
99-
code:
100-
type: integer
101-
format: int32
102-
message:
103-
type: string
158+
type: string
159+
- name: influencer_id
160+
in: path
161+
required: true
162+
schema:
163+
type: string
164+
format: uuid
165+
responses:
166+
"200":
167+
description: OK
168+
content:
169+
application/json:
170+
schema:
171+
$ref: '#/components/schemas/InfluencerDatasetCreation'
172+
default:
173+
description: Unexpected error
174+
content:
175+
application/json:
176+
schema:
177+
$ref: '#/components/schemas/Error'
178+
components:
179+
securitySchemes:
180+
BearerAuth:
181+
type: http
182+
scheme: bearer
183+
schemas:
184+
TaskParameters:
185+
type: "object"
186+
InfluencerAdminPage:
187+
type: "object"
188+
required:
189+
- items
190+
- total
191+
properties:
192+
items:
193+
type: array
194+
items:
195+
$ref: '#/components/schemas/InfluencerAdminItem'
196+
total:
197+
type: integer
198+
InfluencerAdminItem:
199+
type: "object"
200+
required:
201+
- id
202+
- first_name
203+
- last_name
204+
properties:
205+
id:
206+
type: string
207+
format: uuid
208+
first_name:
209+
type: string
210+
last_name:
211+
type: string
212+
avatar:
213+
type: string
214+
InfluencerPhotosAdminPage:
215+
type: "object"
216+
required:
217+
- items
218+
- total
219+
properties:
220+
items:
221+
type: array
222+
items:
223+
$ref: '#/components/schemas/InfluencerPhotoAdmin'
224+
total:
225+
type: integer
226+
InfluencerPhotoAdmin:
227+
type: "object"
228+
required:
229+
- id
230+
- influencer_id
231+
- status
232+
- url
233+
- photo_type
234+
- created_at_utc
235+
properties:
236+
id:
237+
type: string
238+
format: uuid
239+
influencer_id:
240+
type: string
241+
format: uuid
242+
status:
243+
type: string
244+
enum: [ approved, declined, waiting_approval ]
245+
url:
246+
type: string
247+
photo_type:
248+
type: string
249+
created_at_utc:
250+
type: string
251+
InfluencerPhotoUpdate:
252+
type: "object"
253+
required:
254+
- photo_id
255+
- status
256+
properties:
257+
photo_id:
258+
type: string
259+
format: uuid
260+
status:
261+
type: string
262+
enum: [ approved, declined ]
263+
InfluencerDatasetCreation:
264+
type: "object"
265+
required:
266+
- id
267+
properties:
268+
id:
269+
type: string
270+
format: uuid
271+
Error:
272+
type: "object"
273+
required:
274+
- code
275+
- message
276+
properties:
277+
code:
278+
type: integer
279+
format: int32
280+
message:
281+
type: string

plugin/src/main/kotlin/com/github/raymank26/Descriptor.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ data class RequestBody(
3939
val required: Boolean
4040
)
4141

42+
sealed interface SecurityScheme {
43+
44+
data object BearerToken : SecurityScheme
45+
46+
data class SecurityHeader(val headerName: String) : SecurityScheme
47+
}
48+
4249
sealed class RequestBodyMediaType(val clsName: String, val mediaType: String) {
4350
data object Json : RequestBodyMediaType("Json", "application/json")
4451
data object Xml : RequestBodyMediaType("Xml", "application/xml")

0 commit comments

Comments
 (0)