From 25ded7e3bfa4e970fd8bc07177ff92f32dedcd9b Mon Sep 17 00:00:00 2001 From: Luciano Righetti Date: Fri, 14 Jan 2022 17:43:53 +0100 Subject: [PATCH] add: more sharing groups api tests, add broods api tests, extend openapi spec --- tests/Fixture/BroodsFixture.php | 55 ++++ tests/Fixture/OrganisationsFixture.php | 1 - tests/Fixture/SharingGroupsFixture.php | 4 +- tests/TestCase/Api/Broods/AddBroodApiTest.php | 91 ++++++ .../Api/Broods/DeleteBroodsApiTest.php | 60 ++++ .../TestCase/Api/Broods/EditBroodApiTest.php | 83 ++++++ .../Api/Broods/IndexBroodsApiTest.php | 45 +++ .../TestCase/Api/Broods/ViewBroodApiTest.php | 46 +++ .../SharingGroups/AddSharingGroupApiTest.php | 90 ++++++ .../SharingGroups/ViewSharingGroupApiTest.php | 4 +- tests/bootstrap.php | 3 +- webroot/docs/openapi.yaml | 280 +++++++++++++++++- 12 files changed, 750 insertions(+), 12 deletions(-) create mode 100644 tests/Fixture/BroodsFixture.php create mode 100644 tests/TestCase/Api/Broods/AddBroodApiTest.php create mode 100644 tests/TestCase/Api/Broods/DeleteBroodsApiTest.php create mode 100644 tests/TestCase/Api/Broods/EditBroodApiTest.php create mode 100644 tests/TestCase/Api/Broods/IndexBroodsApiTest.php create mode 100644 tests/TestCase/Api/Broods/ViewBroodApiTest.php create mode 100644 tests/TestCase/Api/SharingGroups/AddSharingGroupApiTest.php diff --git a/tests/Fixture/BroodsFixture.php b/tests/Fixture/BroodsFixture.php new file mode 100644 index 0000000..adc035c --- /dev/null +++ b/tests/Fixture/BroodsFixture.php @@ -0,0 +1,55 @@ +records = [ + [ + 'id' => self::BROOD_A_ID, + 'uuid' => $faker->uuid(), + 'name' => 'Brood A', + 'url' => $faker->url, + 'description' => $faker->text, + 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, + 'trusted' => true, + 'pull' => true, + 'skip_proxy' => true, + 'authkey' => self::BROOD_A_API_KEY, + 'created' => $faker->dateTime()->getTimestamp(), + 'modified' => $faker->dateTime()->getTimestamp() + ], + [ + 'id' => self::BROOD_B_ID, + 'uuid' => $faker->uuid(), + 'name' => 'Brood A', + 'url' => $faker->url, + 'description' => $faker->text, + 'organisation_id' => OrganisationsFixture::ORGANISATION_B_ID, + 'trusted' => true, + 'pull' => true, + 'skip_proxy' => true, + 'authkey' => self::BROOD_B_API_KEY, + 'created' => $faker->dateTime()->getTimestamp(), + 'modified' => $faker->dateTime()->getTimestamp() + ] + ]; + parent::init(); + } +} diff --git a/tests/Fixture/OrganisationsFixture.php b/tests/Fixture/OrganisationsFixture.php index 7b7439e..8531d0c 100644 --- a/tests/Fixture/OrganisationsFixture.php +++ b/tests/Fixture/OrganisationsFixture.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace App\Test\Fixture; use Cake\TestSuite\Fixture\TestFixture; -use Authentication\PasswordHasher\DefaultPasswordHasher; class OrganisationsFixture extends TestFixture { diff --git a/tests/Fixture/SharingGroupsFixture.php b/tests/Fixture/SharingGroupsFixture.php index e12e021..79665b6 100644 --- a/tests/Fixture/SharingGroupsFixture.php +++ b/tests/Fixture/SharingGroupsFixture.php @@ -22,7 +22,7 @@ class SharingGroupsFixture extends TestFixture 'id' => self::SHARING_GROUP_A_ID, 'uuid' => $faker->uuid(), 'name' => 'Sharing Group A', - 'releasability' => 'Sharing Group A', + 'releasability' => 'Sharing Group A releasability', 'description' => 'Sharing Group A description', 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, 'user_id' => UsersFixture::USER_ADMIN_ID, @@ -35,7 +35,7 @@ class SharingGroupsFixture extends TestFixture 'id' => self::SHARING_GROUP_B_ID, 'uuid' => $faker->uuid(), 'name' => 'Sharing Group B', - 'releasability' => 'Sharing Group B', + 'releasability' => 'Sharing Group B releasability', 'description' => 'Sharing Group B description', 'organisation_id' => OrganisationsFixture::ORGANISATION_B_ID, 'user_id' => UsersFixture::USER_ADMIN_ID, diff --git a/tests/TestCase/Api/Broods/AddBroodApiTest.php b/tests/TestCase/Api/Broods/AddBroodApiTest.php new file mode 100644 index 0000000..099f3bd --- /dev/null +++ b/tests/TestCase/Api/Broods/AddBroodApiTest.php @@ -0,0 +1,91 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testAddBrood(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + + $faker = \Faker\Factory::create(); + $uuid = $faker->uuid; + + $this->post( + self::ENDPOINT, + [ + 'uuid' => $uuid, + 'name' => 'Brood A', + 'url' => $faker->url, + 'description' => $faker->text, + 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, + 'trusted' => true, + 'pull' => true, + 'skip_proxy' => true, + 'authkey' => $faker->sha1, + ] + ); + + $this->assertResponseOk(); + $this->assertResponseContains(sprintf('"uuid": "%s"', $uuid)); + $this->assertDbRecordExists('Broods', ['uuid' => $uuid]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); + } + + public function testAddBroodNotAllowedAsRegularUser(): void + { + $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); + + $faker = \Faker\Factory::create(); + $uuid = $faker->uuid; + + $this->post( + self::ENDPOINT, + [ + 'uuid' => $uuid, + 'name' => 'Brood A', + 'url' => $faker->url, + 'description' => $faker->text, + 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, + 'trusted' => true, + 'pull' => true, + 'skip_proxy' => true, + 'authkey' => $faker->sha1, + ] + ); + + $this->assertResponseCode(405); + $this->assertDbRecordNotExists('Broods', ['uuid' => $uuid]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); + } +} diff --git a/tests/TestCase/Api/Broods/DeleteBroodsApiTest.php b/tests/TestCase/Api/Broods/DeleteBroodsApiTest.php new file mode 100644 index 0000000..1b8d2ce --- /dev/null +++ b/tests/TestCase/Api/Broods/DeleteBroodsApiTest.php @@ -0,0 +1,60 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testDeleteBrood(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_A_ID); + $this->delete($url); + + $this->assertResponseOk(); + $this->assertDbRecordNotExists('Broods', ['id' => BroodsFixture::BROOD_A_ID]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec($url, 'delete'); + $this->addWarning('TODO: CRUDComponent::delete() sets some view variables, does not take into account `isRest()`, fix it.'); + } + + public function testDeleteBroodNotAllowedAsRegularUser(): void + { + $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); + $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_A_ID); + $this->delete($url); + + $this->assertResponseCode(405); + $this->assertDbRecordExists('Broods', ['id' => BroodsFixture::BROOD_A_ID]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec($url, 'delete'); + $this->addWarning('TODO: CRUDComponent::delete() sets some view variables, does not take into account `isRest()`, fix it.'); + } +} diff --git a/tests/TestCase/Api/Broods/EditBroodApiTest.php b/tests/TestCase/Api/Broods/EditBroodApiTest.php new file mode 100644 index 0000000..bd15a39 --- /dev/null +++ b/tests/TestCase/Api/Broods/EditBroodApiTest.php @@ -0,0 +1,83 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testEditBrood(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + + $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_A_ID); + $this->put( + $url, + [ + 'name' => 'Test Brood 4321', + ] + ); + + $this->assertResponseOk(); + $this->assertDbRecordExists( + 'Broods', + [ + 'id' => BroodsFixture::BROOD_A_ID, + 'name' => 'Test Brood 4321', + ] + ); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec($url, 'put'); + } + + public function testEditBroodNotAllowedAsRegularUser(): void + { + $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); + + $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_B_ID); + $this->put( + $url, + [ + 'name' => 'Test Brood 1234' + ] + ); + + $this->assertResponseCode(405); + $this->assertDbRecordNotExists( + 'Broods', + [ + 'id' => BroodsFixture::BROOD_B_ID, + 'name' => 'Test Brood 1234' + ] + ); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec($url, 'put'); + } +} diff --git a/tests/TestCase/Api/Broods/IndexBroodsApiTest.php b/tests/TestCase/Api/Broods/IndexBroodsApiTest.php new file mode 100644 index 0000000..97d0df8 --- /dev/null +++ b/tests/TestCase/Api/Broods/IndexBroodsApiTest.php @@ -0,0 +1,45 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testIndexBroods(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + $this->get(self::ENDPOINT); + + $this->assertResponseOk(); + $this->assertResponseContains(sprintf('"id": %d', BroodsFixture::BROOD_A_ID)); + // TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT); + } +} diff --git a/tests/TestCase/Api/Broods/ViewBroodApiTest.php b/tests/TestCase/Api/Broods/ViewBroodApiTest.php new file mode 100644 index 0000000..b3f520d --- /dev/null +++ b/tests/TestCase/Api/Broods/ViewBroodApiTest.php @@ -0,0 +1,46 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testViewBroodGroupById(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_A_ID); + $this->get($url); + + $this->assertResponseOk(); + $this->assertResponseContains(sprintf('"id": %d', BroodsFixture::BROOD_A_ID)); + // TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec($url); + } +} diff --git a/tests/TestCase/Api/SharingGroups/AddSharingGroupApiTest.php b/tests/TestCase/Api/SharingGroups/AddSharingGroupApiTest.php new file mode 100644 index 0000000..45a79aa --- /dev/null +++ b/tests/TestCase/Api/SharingGroups/AddSharingGroupApiTest.php @@ -0,0 +1,90 @@ +initializeValidator(APP . '../webroot/docs/openapi.yaml'); + } + + public function testAddSharingGroup(): void + { + $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); + + $faker = \Faker\Factory::create(); + $uuid = $faker->uuid; + + $this->post( + self::ENDPOINT, + [ + 'uuid' => $uuid, + 'name' => 'Test Sharing Group', + 'releasability' => 'Test Sharing Group releasability', + 'description' => 'Test Sharing Group description', + 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, + 'user_id' => UsersFixture::USER_ADMIN_ID, + 'active' => true, + 'local' => true + ] + ); + + $this->assertResponseOk(); + $this->assertResponseContains(sprintf('"uuid": "%s"', $uuid)); + $this->assertDbRecordExists('SharingGroups', ['uuid' => $uuid]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); + } + + public function testAddSharingGroupNotAllowedAsRegularUser(): void + { + $this->setAuthToken(AuthKeysFixture::REGULAR_USER_API_KEY); + + $faker = \Faker\Factory::create(); + $uuid = $faker->uuid; + + $this->post( + self::ENDPOINT, + [ + 'uuid' => $uuid, + 'name' => 'Test Sharing Group', + 'releasability' => 'Sharing Group A', + 'description' => 'Sharing Group A description', + 'organisation_id' => OrganisationsFixture::ORGANISATION_A_ID, + 'user_id' => UsersFixture::USER_ADMIN_ID, + 'active' => true, + 'local' => true + ] + ); + + $this->assertResponseCode(405); + $this->assertDbRecordNotExists('SharingGroups', ['uuid' => $uuid]); + //TODO: $this->assertRequestMatchesOpenApiSpec(); + $this->assertResponseMatchesOpenApiSpec(self::ENDPOINT, 'post'); + } +} diff --git a/tests/TestCase/Api/SharingGroups/ViewSharingGroupApiTest.php b/tests/TestCase/Api/SharingGroups/ViewSharingGroupApiTest.php index 5f5e6d1..0e86fc7 100644 --- a/tests/TestCase/Api/SharingGroups/ViewSharingGroupApiTest.php +++ b/tests/TestCase/Api/SharingGroups/ViewSharingGroupApiTest.php @@ -32,14 +32,14 @@ class ViewSharingGroupApiTest extends TestCase $this->initializeValidator(APP . '../webroot/docs/openapi.yaml'); } - public function testVieSharingGroupById(): void + public function testViewSharingGroupById(): void { $this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY); $url = sprintf('%s/%d', self::ENDPOINT, SharingGroupsFixture::SHARING_GROUP_A_ID); $this->get($url); $this->assertResponseOk(); - $this->assertResponseContains('"name": "Sharing Group A"'); + $this->assertResponseContains(sprintf('"id": %d', SharingGroupsFixture::SHARING_GROUP_A_ID)); // TODO: $this->assertRequestMatchesOpenApiSpec(); $this->assertResponseMatchesOpenApiSpec($url); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6df9c27..c9a8b8c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -56,6 +56,7 @@ session_id('cli'); // hacky way to skip migrations if (!in_array('skip-migrations', $_SERVER['argv'])) { + echo "[ * ] Running DB migrations, it may take some time ...\n"; $migrator = new Migrator(); $migrator->runMany([ ['connection' => 'test'], @@ -63,5 +64,5 @@ if (!in_array('skip-migrations', $_SERVER['argv'])) { ['plugin' => 'ADmad/SocialAuth', 'connection' => 'test'] ]); } else { - echo "[ * ] Skipping migrations ...\n"; + echo "[ * ] Skipping DB migrations ...\n"; } diff --git a/webroot/docs/openapi.yaml b/webroot/docs/openapi.yaml index c8a8c70..81ac9aa 100644 --- a/webroot/docs/openapi.yaml +++ b/webroot/docs/openapi.yaml @@ -21,6 +21,8 @@ tags: description: "Inbox messages represent A list of requests to be manually processed." - name: SharingGroups description: "Sharing groups are distribution lists usable by tools that can exchange information with a list of trusted partners. Create recurring or ad hoc sharing groups and share them with the members of the sharing group." + - name: Broods + description: "Cerebrate can connect to other Cerebrate instances to exchange trust information and to instrument interconnectivity between connected local tools. Each such Cerebrate instance with its connected tools is considered to be a brood." paths: /api/v1/individuals/index: @@ -66,7 +68,7 @@ paths: tags: - Users requestBody: - $ref: "#/components/requestBodies/AddIndividualRequest" + $ref: "#/components/requestBodies/CreateIndividualRequest" responses: "200": $ref: "#/components/responses/IndividualResponse" @@ -174,7 +176,7 @@ paths: tags: - Users requestBody: - $ref: "#/components/requestBodies/AddUserRequest" + $ref: "#/components/requestBodies/CreateUserRequest" responses: "200": $ref: "#/components/responses/UserResponse" @@ -248,7 +250,7 @@ paths: tags: - Organisations requestBody: - $ref: "#/components/requestBodies/AddOrganisationRequest" + $ref: "#/components/requestBodies/CreateOrganisationRequest" responses: "200": $ref: "#/components/responses/OrganisationResponse" @@ -445,6 +447,24 @@ paths: default: $ref: "#/components/responses/ApiErrorResponse" + /api/v1/sharingGroups/add: + post: + summary: "Add sharing group" + operationId: addSharingGroup + tags: + - SharingGroups + requestBody: + $ref: "#/components/requestBodies/CreateSharingGroupRequest" + responses: + "200": + $ref: "#/components/responses/IndividualResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + /api/v1/sharingGroups/view/{sharingGroupId}: get: summary: "Get sharing group by ID" @@ -501,6 +521,98 @@ paths: default: $ref: "#/components/responses/ApiErrorResponse" + /api/v1/broods/index: + get: + summary: "Get broods list" + operationId: getBroods + tags: + - Broods + parameters: + - $ref: "#/components/parameters/quickFilter" + responses: + "200": + $ref: "#/components/responses/BroodListResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + + /api/v1/broods/view/{broodId}: + get: + summary: "Get brood by ID" + operationId: getBroodById + tags: + - Broods + parameters: + - $ref: "#/components/parameters/broodId" + responses: + "200": + $ref: "#/components/responses/BroodResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + + /api/v1/broods/add: + post: + summary: "Add brood" + operationId: addBrood + tags: + - Broods + requestBody: + $ref: "#/components/requestBodies/CreateBroodRequest" + responses: + "200": + $ref: "#/components/responses/BroodResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + + /api/v1/broods/edit/{sharingGroupId}: + put: + summary: "Edit brood" + operationId: editBrood + tags: + - Broods + parameters: + - $ref: "#/components/parameters/broodId" + requestBody: + $ref: "#/components/requestBodies/EditBroodRequest" + responses: + "200": + $ref: "#/components/responses/BroodResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + + /api/v1/broods/delete/{broodId}: + delete: + summary: "Delete brood by ID" + operationId: deleteBroodById + tags: + - Broods + parameters: + - $ref: "#/components/parameters/broodId" + responses: + "200": + $ref: "#/components/responses/BroodResponse" + "403": + $ref: "#/components/responses/UnauthorizedApiErrorResponse" + "405": + $ref: "#/components/responses/MethodNotAllowedApiErrorResponse" + default: + $ref: "#/components/responses/ApiErrorResponse" + components: schemas: # General @@ -525,6 +637,9 @@ components: format: email example: "user@example.com" + AuthKey: + type: string + # Individuals IndividualFirstName: type: string @@ -906,6 +1021,59 @@ components: items: $ref: "#/components/schemas/SharingGroup" + # Broods + BroodName: + type: string + + BroodDescription: + type: string + + BroodUrl: + type: string + + BroodIsTrusted: + type: boolean + description: "Trusted upstream source" + + BroodIsPull: + type: boolean + description: "Enable pulling of trust information" + + Brood: + type: object + properties: + id: + $ref: "#/components/schemas/ID" + uuid: + $ref: "#/components/schemas/UUID" + name: + $ref: "#/components/schemas/BroodName" + url: + $ref: "#/components/schemas/BroodUrl" + description: + $ref: "#/components/schemas/BroodDescription" + organisation_id: + $ref: "#/components/schemas/ID" + trusted: + $ref: "#/components/schemas/BroodIsTrusted" + pull: + $ref: "#/components/schemas/BroodIsPull" + skip_proxy: + type: boolean + authkey: + $ref: "#/components/schemas/AuthKey" + created: + $ref: "#/components/schemas/DateTime" + modified: + $ref: "#/components/schemas/DateTime" + organisation: + $ref: "#/components/schemas/Organisation" + + BroodList: + type: array + items: + $ref: "#/components/schemas/Brood" + # Errors ApiError: type: object @@ -1007,6 +1175,14 @@ components: schema: $ref: "#/components/schemas/ID" + broodId: + name: broodId + in: path + description: "Numeric ID of the Brood" + required: true + schema: + $ref: "#/components/schemas/ID" + quickFilter: name: quickFilter in: query @@ -1027,7 +1203,7 @@ components: requestBodies: # Individuals - AddIndividualRequest: + CreateIndividualRequest: required: true content: application/json: @@ -1064,7 +1240,7 @@ components: $ref: "#/components/schemas/IndividualPosition" # Users - AddUserRequest: + CreateUserRequest: required: true content: application/json: @@ -1107,7 +1283,7 @@ components: type: string # Organisations - AddOrganisationRequest: + CreateOrganisationRequest: required: true content: application/json: @@ -1190,6 +1366,30 @@ components: type: string # SharingGroups + CreateSharingGroupRequest: + required: true + content: + application/json: + schema: + type: object + properties: + uuid: + $ref: "#/components/schemas/UUID" + name: + $ref: "#/components/schemas/SharingGroupName" + releasability: + $ref: "#/components/schemas/SharingGroupReleasability" + description: + $ref: "#/components/schemas/SharingGroupDescription" + organisation_id: + $ref: "#/components/schemas/ID" + user_id: + $ref: "#/components/schemas/ID" + active: + type: boolean + local: + type: boolean + EditSharingGroupRequest: required: true content: @@ -1214,6 +1414,59 @@ components: local: type: boolean + # Broods + CreateBroodRequest: + required: true + content: + application/json: + schema: + type: object + properties: + uuid: + $ref: "#/components/schemas/UUID" + name: + $ref: "#/components/schemas/BroodName" + url: + $ref: "#/components/schemas/BroodUrl" + description: + $ref: "#/components/schemas/BroodDescription" + organisation_id: + $ref: "#/components/schemas/ID" + trusted: + $ref: "#/components/schemas/BroodIsTrusted" + pull: + $ref: "#/components/schemas/BroodIsPull" + skip_proxy: + type: boolean + authkey: + $ref: "#/components/schemas/AuthKey" + + EditBroodRequest: + required: true + content: + application/json: + schema: + type: object + properties: + uuid: + $ref: "#/components/schemas/UUID" + name: + $ref: "#/components/schemas/BroodName" + url: + $ref: "#/components/schemas/BroodUrl" + description: + $ref: "#/components/schemas/BroodDescription" + organisation_id: + $ref: "#/components/schemas/ID" + trusted: + $ref: "#/components/schemas/BroodIsTrusted" + pull: + $ref: "#/components/schemas/BroodIsPull" + skip_proxy: + type: boolean + authkey: + $ref: "#/components/schemas/AuthKey" + responses: # Individuals IndividualResponse: @@ -1337,6 +1590,21 @@ components: schema: $ref: "#/components/schemas/SharingGroupList" + # Broods + BroodResponse: + description: "Brood response" + content: + application/json: + schema: + $ref: "#/components/schemas/Brood" + + BroodListResponse: + description: "Brood list response" + content: + application/json: + schema: + $ref: "#/components/schemas/BroodList" + # Errors ApiErrorResponse: description: "Unexpected API error"