Merge pull request #9774 from appwrite/fix-multi-method-auth

Fix specs
This commit is contained in:
Jake Barnby 2025-05-17 08:06:22 +00:00 committed by GitHub
commit 75f2619ab3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 6274 additions and 4250 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4465,6 +4465,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -4485,6 +4490,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/components\/schemas\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

View file

@ -8024,6 +8024,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -8044,6 +8049,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/components\/schemas\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

View file

@ -7505,6 +7505,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -7525,6 +7530,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/components\/schemas\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4605,6 +4605,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -4625,6 +4630,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/definitions\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

View file

@ -8153,6 +8153,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -8173,6 +8178,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/definitions\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

View file

@ -7624,6 +7624,11 @@
"methods": [
{
"name": "createDocument",
"auth": {
"Session": [],
"Key": [],
"JWT": []
},
"parameters": [
"databaseId",
"collectionId",
@ -7644,6 +7649,29 @@
}
],
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
},
{
"name": "createDocuments",
"auth": {
"Key": []
},
"parameters": [
"databaseId",
"collectionId",
"documents"
],
"required": [
"databaseId",
"collectionId",
"documents"
],
"responses": [
{
"code": 201,
"model": "#\/definitions\/documentList"
}
],
"description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console."
}
],
"auth": {

View file

@ -3201,25 +3201,25 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents')
new Parameter('permissions', optional: true),
]
),
// new Method(
// namespace: 'databases',
// group: 'documents',
// name: 'createDocuments',
// description: '/docs/references/databases/create-documents.md',
// auth: [AuthType::KEY],
// responses: [
// new SDKResponse(
// code: Response::STATUS_CODE_CREATED,
// model: Response::MODEL_DOCUMENT_LIST,
// )
// ],
// contentType: ContentType::JSON,
// parameters: [
// new Parameter('databaseId', optional: false),
// new Parameter('collectionId', optional: false),
// new Parameter('documents', optional: false),
// ]
// )
new Method(
namespace: 'databases',
group: 'documents',
name: 'createDocuments',
description: '/docs/references/databases/create-documents.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_CREATED,
model: Response::MODEL_DOCUMENT_LIST,
)
],
contentType: ContentType::JSON,
parameters: [
new Parameter('databaseId', optional: false),
new Parameter('collectionId', optional: false),
new Parameter('documents', optional: false),
]
)
]
)
->param('databaseId', '', new UID(), 'Database ID.')

28
composer.lock generated
View file

@ -3499,16 +3499,16 @@
},
{
"name": "utopia-php/database",
"version": "0.69.2",
"version": "0.69.4",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "60591ab073bb80bb9843338754b679bb8169e4ed"
"reference": "31f913a9c5c363e6427e69a0b8bbb9b8d901e061"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/60591ab073bb80bb9843338754b679bb8169e4ed",
"reference": "60591ab073bb80bb9843338754b679bb8169e4ed",
"url": "https://api.github.com/repos/utopia-php/database/zipball/31f913a9c5c363e6427e69a0b8bbb9b8d901e061",
"reference": "31f913a9c5c363e6427e69a0b8bbb9b8d901e061",
"shasum": ""
},
"require": {
@ -3549,9 +3549,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.69.2"
"source": "https://github.com/utopia-php/database/tree/0.69.4"
},
"time": "2025-05-14T07:51:44+00:00"
"time": "2025-05-16T13:51:43+00:00"
},
{
"name": "utopia-php/detector",
@ -4814,16 +4814,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.40.16",
"version": "0.40.17",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d"
"reference": "7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/f1f506da74033f0cb5a11e3dffcfd1ee8daf237d",
"reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de",
"reference": "7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de",
"shasum": ""
},
"require": {
@ -4859,9 +4859,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.16"
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.17"
},
"time": "2025-05-09T12:06:09+00:00"
"time": "2025-05-16T15:10:54+00:00"
},
{
"name": "doctrine/annotations",
@ -8240,7 +8240,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -8264,5 +8264,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}

View file

@ -178,6 +178,7 @@ class OpenAPI3 extends Format
$desc = $method->getDescriptionFilePath();
$additionalMethod = [
'name' => $method->getMethodName(),
'auth' => \array_merge(...\array_map(fn ($auth) => [$auth->value => []], $method->getAuth())),
'parameters' => [],
'required' => [],
'responses' => [],

View file

@ -184,6 +184,7 @@ class Swagger2 extends Format
$additionalMethod = [
'name' => $method->getMethodName(),
'auth' => \array_merge(...\array_map(fn ($auth) => [$auth->value => []], $method->getAuth())),
'parameters' => [],
'required' => [],
'responses' => [],
@ -286,13 +287,13 @@ class Swagger2 extends Format
$securities = ['Project' => []];
foreach ($sdk->getAuth() as $security) {
/** @var \Appwrite\SDK\AuthType $security */
if (array_key_exists($security->value, $this->keys)) {
/** @var AuthType $security */
if (\array_key_exists($security->value, $this->keys)) {
$securities[$security->value] = [];
}
}
$temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount);
$temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount);
$temp['security'][] = $securities;
}