From aaa43bb1547f68ce97f305354cbd1fa80bc42930 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 29 Mar 2021 00:47:17 +0300 Subject: [PATCH] Added JWT example --- src/Appwrite/Specification/Format/OpenAPI3.php | 6 +++++- src/Appwrite/Specification/Format/Swagger2.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index f28cdd597..16a0de3b3 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -74,6 +74,10 @@ class OpenAPI3 extends Format if (isset($output['components']['securitySchemes']['Key'])) { $output['components']['securitySchemes']['Key']['x-appwrite'] = ['demo' => '919c2d18fb5d4...a2ae413da83346ad2']; } + + if (isset($output['securityDefinitions']['JWT'])) { + $output['securityDefinitions']['JWT']['x-appwrite'] = ['demo' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...']; + } if (isset($output['components']['securitySchemes']['Locale'])) { $output['components']['securitySchemes']['Locale']['x-appwrite'] = ['demo' => 'en']; @@ -171,7 +175,7 @@ class OpenAPI3 extends Format $securities[$security] = []; } } - + $temp['x-appwrite']['auth'] = array_slice($securities, 0, 2); $temp['security'][] = $securities; } diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 8df08d1d4..5538b5e5a 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -73,6 +73,10 @@ class Swagger2 extends Format $output['securityDefinitions']['Key']['x-appwrite'] = ['demo' => '919c2d18fb5d4...a2ae413da83346ad2']; } + if (isset($output['securityDefinitions']['JWT'])) { + $output['securityDefinitions']['JWT']['x-appwrite'] = ['demo' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...']; + } + if (isset($output['securityDefinitions']['Locale'])) { $output['securityDefinitions']['Locale']['x-appwrite'] = ['demo' => 'en']; } @@ -169,7 +173,7 @@ class Swagger2 extends Format $securities[$security] = []; } } - + $temp['x-appwrite']['auth'] = array_slice($securities, 0, 2); $temp['security'][] = $securities; }