@@ -107,34 +107,34 @@ public static void main(String[] args) {
107
107
openApiConfiguration .setDocumentationPath (deprecatedDocsPath ); // by default it's /openapi
108
108
// Based on official example: https://swagger.io/docs/specification/authentication/oauth2/
109
109
openApiConfiguration .setSecurity (new SecurityConfiguration (
110
- Map .ofEntries (
111
- entry ("BasicAuth" , new BasicAuth ()),
112
- entry ("BearerAuth" , new BearerAuth ()),
113
- entry ("ApiKeyAuth" , new ApiKeyAuth ()),
114
- entry ("CookieAuth" , new CookieAuth ("JSESSIONID" )),
115
- entry ("OpenID" , new OpenID ("https://example.com/.well-known/openid-configuration" )),
116
- entry ("OAuth2" , new OAuth2 (
117
- "This API uses OAuth 2 with the implicit grant flow." ,
118
- List .of (
119
- new ImplicitFlow (
120
- "https://api.example.com/oauth2/authorize" ,
121
- new HashMap <>() {{
122
- put ("read_pets" , "read your pets" );
123
- put ("write_pets" , "modify pets in your account" );
124
- }}
125
- )
126
- )
127
- ))
128
- ),
129
- List .of (
130
- new Security (
131
- "oauth2" ,
132
- List .of (
133
- "write_pets" ,
134
- "read_pets"
135
- )
110
+ Map .ofEntries (
111
+ entry ("BasicAuth" , new BasicAuth ()),
112
+ entry ("BearerAuth" , new BearerAuth ()),
113
+ entry ("ApiKeyAuth" , new ApiKeyAuth ()),
114
+ entry ("CookieAuth" , new CookieAuth ("JSESSIONID" )),
115
+ entry ("OpenID" , new OpenID ("https://example.com/.well-known/openid-configuration" )),
116
+ entry ("OAuth2" , new OAuth2 (
117
+ "This API uses OAuth 2 with the implicit grant flow." ,
118
+ List .of (
119
+ new ImplicitFlow (
120
+ "https://api.example.com/oauth2/authorize" ,
121
+ new HashMap <>() {{
122
+ put ("read_pets" , "read your pets" );
123
+ put ("write_pets" , "modify pets in your account" );
124
+ }}
136
125
)
126
+ )
127
+ ))
128
+ ),
129
+ List .of (
130
+ new Security (
131
+ "oauth2" ,
132
+ List .of (
133
+ "write_pets" ,
134
+ "read_pets"
135
+ )
137
136
)
137
+ )
138
138
));
139
139
openApiConfiguration .setDocumentProcessor (docs -> { // you can add whatever you want to this document using your favourite json api
140
140
docs .set ("test" , new TextNode ("Value" ));
@@ -157,49 +157,50 @@ public static void main(String[] args) {
157
157
158
158
@ Override
159
159
@ OpenApi (
160
- path = ROUTE ,
161
- operationId = "cli" ,
162
- methods = HttpMethod .POST ,
163
- summary = "Remote command execution" ,
164
- description = "Execute command using POST request. The commands are the same as in the console and can be listed using the 'help' command." ,
165
- tags = { "Cli" },
166
- security = {
167
- @ OpenApiSecurity (name = "BasicAuth" )
168
- },
169
- requestBody = @ OpenApiRequestBody (
170
- content = {
171
- @ OpenApiContent (from = String .class ), // simple type
172
- @ OpenApiContent (from = EntityDto [].class ), // array
173
- @ OpenApiContent (from = LombokEntity .class ), // lombok
174
- @ OpenApiContent (mimeType = "image/png" , type = "string" , format = "base64" ), // single file upload,
175
- @ OpenApiContent (mimeType = "multipart/form-data" , properties = {
176
- @ OpenApiContentProperty (name = "form-element" , type = "integer" ), // random element in form-data
177
- @ OpenApiContentProperty (name = "file-name" , isArray = true , type = "string" , format = "base64" ) // multi-file upload
178
- })
179
- }
180
- ),
181
- headers = {
182
- //@OpenApiParam(name = "Authorization", description = "Alias and token provided as basic auth credentials", required = true, type = UUID.class),
183
- @ OpenApiParam (name = "Optional" ),
184
- @ OpenApiParam (name = "X-Rick" , example = "Rolled" ),
185
- @ OpenApiParam (name = "X-SomeNumber" , required = true , type = Integer .class , example = "500" )
186
- },
187
- pathParams = {
188
- @ OpenApiParam (name = "name" , description = "Name" , required = true , type = UUID .class )
189
- },
190
- responses = {
191
- @ OpenApiResponse (status = "200" , description = "Status of the executed command" , content = {
192
- @ OpenApiContent (from = EntityDto [].class )
193
- }),
194
- @ OpenApiResponse (
195
- status = "400" ,
196
- description = "Error message related to the invalid command format (0 < command length < " + 10 + ")" ,
197
- content = @ OpenApiContent (from = EntityDto [].class )
198
- ),
199
- @ OpenApiResponse (status = "401" , description = "Error message related to the unauthorized access" , content = {
200
- @ OpenApiContent (from = EntityDto [].class )
201
- })
160
+ path = ROUTE ,
161
+ operationId = "cli" ,
162
+ methods = HttpMethod .POST ,
163
+ summary = "Remote command execution" ,
164
+ description = "Execute command using POST request. The commands are the same as in the console and can be listed using the 'help' command." ,
165
+ tags = { "Cli" },
166
+ security = {
167
+ @ OpenApiSecurity (name = "BasicAuth" )
168
+ },
169
+ requestBody = @ OpenApiRequestBody (
170
+ content = {
171
+ @ OpenApiContent (from = String .class ), // simple type
172
+ @ OpenApiContent (from = EntityDto [].class ), // array
173
+ @ OpenApiContent (from = LombokEntity .class ), // lombok
174
+ @ OpenApiContent (from = KotlinEntity .class ), // kotlin
175
+ @ OpenApiContent (mimeType = "image/png" , type = "string" , format = "base64" ), // single file upload,
176
+ @ OpenApiContent (mimeType = "multipart/form-data" , properties = {
177
+ @ OpenApiContentProperty (name = "form-element" , type = "integer" ), // random element in form-data
178
+ @ OpenApiContentProperty (name = "file-name" , isArray = true , type = "string" , format = "base64" ) // multi-file upload
179
+ })
202
180
}
181
+ ),
182
+ headers = {
183
+ //@OpenApiParam(name = "Authorization", description = "Alias and token provided as basic auth credentials", required = true, type = UUID.class),
184
+ @ OpenApiParam (name = "Optional" ),
185
+ @ OpenApiParam (name = "X-Rick" , example = "Rolled" ),
186
+ @ OpenApiParam (name = "X-SomeNumber" , required = true , type = Integer .class , example = "500" )
187
+ },
188
+ pathParams = {
189
+ @ OpenApiParam (name = "name" , description = "Name" , required = true , type = UUID .class )
190
+ },
191
+ responses = {
192
+ @ OpenApiResponse (status = "200" , description = "Status of the executed command" , content = {
193
+ @ OpenApiContent (from = EntityDto [].class )
194
+ }),
195
+ @ OpenApiResponse (
196
+ status = "400" ,
197
+ description = "Error message related to the invalid command format (0 < command length < " + 10 + ")" ,
198
+ content = @ OpenApiContent (from = EntityDto [].class )
199
+ ),
200
+ @ OpenApiResponse (status = "401" , description = "Error message related to the unauthorized access" , content = {
201
+ @ OpenApiContent (from = EntityDto [].class )
202
+ })
203
+ }
203
204
)
204
205
public void handle (@ NotNull Context ctx ) { }
205
206
0 commit comments