From 3cea035d6dc75023a44ae682c0ebcace9d5a2fea Mon Sep 17 00:00:00 2001 From: Sawjan Gurung Date: Fri, 23 Feb 2024 16:24:22 +0545 Subject: [PATCH] [tests-only] use new json schema assertion lib that supports latest schema drafts (#8503) * test(api): use new json schema assertion lib that supports latest schema drafts * test(api): fix json schema * test(api): fix method call * test(api): update expected failure lines * test(api): add custom schema validator * test(api): add custom schema validator * test(api): add custom schema validator * test(api): add custom schema validator * test(api): make json array validation strict * test(api): fix php code style * test(api): update expected failure lines --- ...ected-failures-localAPI-on-OCIS-storage.md | 20 +- .../features/apiGraph/userGDPRExport.feature | 18 +- .../apiGraphUserGroup/editUser.feature | 1 - .../apiGraphUserGroup/getGroup.feature | 318 ++--- .../apiGraphUserGroup/getUser.feature | 530 ++++---- .../getUserOwnInformation.feature | 53 +- .../apiSharingNg/listPermissions.feature | 283 ++-- .../apiSharingNg/shareInvitations.feature | 52 + .../features/apiSharingNg/sharedByMe.feature | 1080 +++++++-------- .../apiSharingNg/sharedWithMe.feature | 1160 +++++++++-------- .../sharedWithMeSyncDisabled.feature | 788 +++++------ .../updateShareInvitations.feature | 36 +- .../features/apiSpaces/changeSpaces.feature | 408 +++--- .../features/bootstrap/FeatureContext.php | 119 +- .../features/bootstrap/GraphContext.php | 6 +- .../coreApiCapabilities/capabilities.feature | 1 + vendor-bin/behat/composer.json | 2 +- 17 files changed, 2563 insertions(+), 2312 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index b8789d196a..4e5a90f28e 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -59,24 +59,24 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiGraphUserGroup/getUser.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L98) - [apiGraphUserGroup/getUser.feature:99](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L99) - [apiGraphUserGroup/getUser.feature:100](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L100) -- [apiGraphUserGroup/getUser.feature:650](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L650) -- [apiGraphUserGroup/getUser.feature:651](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L651) -- [apiGraphUserGroup/getUser.feature:652](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L652) -- [apiGraphUserGroup/getUser.feature:653](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L653) -- [apiGraphUserGroup/getUser.feature:654](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L654) -- [apiGraphUserGroup/getUser.feature:655](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L655) -- [apiGraphUserGroup/getUser.feature:656](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L656) - [apiGraphUserGroup/getUser.feature:657](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L657) - [apiGraphUserGroup/getUser.feature:658](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L658) - [apiGraphUserGroup/getUser.feature:659](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L659) - [apiGraphUserGroup/getUser.feature:660](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L660) - [apiGraphUserGroup/getUser.feature:661](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L661) +- [apiGraphUserGroup/getUser.feature:662](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L662) +- [apiGraphUserGroup/getUser.feature:663](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L663) +- [apiGraphUserGroup/getUser.feature:664](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L664) +- [apiGraphUserGroup/getUser.feature:665](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L665) +- [apiGraphUserGroup/getUser.feature:666](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L666) +- [apiGraphUserGroup/getUser.feature:667](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L667) +- [apiGraphUserGroup/getUser.feature:668](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getUser.feature#L668) #### [Normal user can get expanded members information of a group](https://github.com/owncloud/ocis/issues/5604) -- [apiGraphUserGroup/getGroup.feature:389](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L389) -- [apiGraphUserGroup/getGroup.feature:390](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L390) -- [apiGraphUserGroup/getGroup.feature:391](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L391) +- [apiGraphUserGroup/getGroup.feature:399](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L399) +- [apiGraphUserGroup/getGroup.feature:400](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L400) +- [apiGraphUserGroup/getGroup.feature:401](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUserGroup/getGroup.feature#L401) #### [Same users can be added in a group multiple time](https://github.com/owncloud/ocis/issues/5702) diff --git a/tests/acceptance/features/apiGraph/userGDPRExport.feature b/tests/acceptance/features/apiGraph/userGDPRExport.feature index a2a09040cf..0be645741c 100644 --- a/tests/acceptance/features/apiGraph/userGDPRExport.feature +++ b/tests/acceptance/features/apiGraph/userGDPRExport.feature @@ -389,12 +389,12 @@ Feature: user GDPR (General Data Protection Regulation) report }, "groups": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%group_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%group_id_pattern%$" + } }, "uid_number": { "type": "number", @@ -672,8 +672,10 @@ Feature: user GDPR (General Data Protection Regulation) report "opaque_id" ], "properties": { - "type": "object", - "pattern": "^%user_id_pattern%:%user_id_pattern%:%user_id_pattern%$" + "opaque_id": { + "type": "string", + "pattern": "^%user_id_pattern%:%user_id_pattern%:%user_id_pattern%$" + } } }, "Sharee": { diff --git a/tests/acceptance/features/apiGraphUserGroup/editUser.feature b/tests/acceptance/features/apiGraphUserGroup/editUser.feature index 6f1e353202..b3977290eb 100644 --- a/tests/acceptance/features/apiGraphUserGroup/editUser.feature +++ b/tests/acceptance/features/apiGraphUserGroup/editUser.feature @@ -55,7 +55,6 @@ Feature: edit user "onPremisesSamAccountName" ], "properties": { - "type": "string", "onPremisesSamAccountName": { "enum": [""] } diff --git a/tests/acceptance/features/apiGraphUserGroup/getGroup.feature b/tests/acceptance/features/apiGraphUserGroup/getGroup.feature index 5a1ccecf8d..08d6f1e64c 100644 --- a/tests/acceptance/features/apiGraphUserGroup/getGroup.feature +++ b/tests/acceptance/features/apiGraphUserGroup/getGroup.feature @@ -131,35 +131,35 @@ Feature: get groups and their members "properties": { "members": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "onPremisesSamAccountName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["brian@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Brian"] - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "onPremisesSamAccountName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["brian@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Brian"] } } - ] + } } } } @@ -174,62 +174,67 @@ Feature: get groups and their members "properties": { "members": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "onPremisesSamAccountName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Alice"] + "maxItems": 2, + "minItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "onPremisesSamAccountName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Alice"] + } + } + }, + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "onPremisesSamAccountName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Carol King"] + }, + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["carol@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Carol"] + } } } - }, - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "onPremisesSamAccountName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Carol King"] - }, - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["carol@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Carol"] - } - } - } - ] + ] + } } } } @@ -291,62 +296,67 @@ Feature: get groups and their members "properties": { "members": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "onPremisesSamAccountName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Alice"] + "maxItems": 2, + "minItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "onPremisesSamAccountName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Alice"] + } + } + }, + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "onPremisesSamAccountName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["brian@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Brian"] + } } } - }, - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "onPremisesSamAccountName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["brian@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Brian"] - } - } - } - ] + ] + } } } } @@ -471,23 +481,27 @@ Feature: get groups and their members "properties": { "value": { "type": "array", - "required": [ - "displayName", - "id", - "groupTypes" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["tea-lover"] - }, - "id": { - "type": "string", - "pattern": "%group_id_pattern%" - }, - "groupTypes": { - "type": "array", - "enum": [] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "displayName", + "id", + "groupTypes" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["tea-lover"] + }, + "id": { + "type": "string", + "pattern": "%group_id_pattern%" + }, + "groupTypes": { + "const": [] + } } } } diff --git a/tests/acceptance/features/apiGraphUserGroup/getUser.feature b/tests/acceptance/features/apiGraphUserGroup/getUser.feature index 1556cc3893..25cc4e5e3e 100644 --- a/tests/acceptance/features/apiGraphUserGroup/getUser.feature +++ b/tests/acceptance/features/apiGraphUserGroup/getUser.feature @@ -493,14 +493,16 @@ Feature: get users "user" ], "properties": { - "user": "string", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "enum": ["%user_id_pattern%"] + "user": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + } } } } @@ -583,32 +585,37 @@ Feature: get users }, "memberOf": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["tea-lover"] + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "displayName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["tea-lover"] + } + } + }, + { + "type": "object", + "required": [ + "displayName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["coffee-lover"] + } } } - }, - { - "type": "object", - "required": [ - "displayName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["coffee-lover"] - } - } - } - ] + ] + } } } } @@ -682,72 +689,76 @@ Feature: get users "properties": { "value": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "id", - "mail", - "onPremisesSamAccountName", - "accountEnabled", - "userType" - ], - "properties": { - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Alice"] - }, - "accountEnabled": { - "type": "boolean", - "enum": [true] - }, - "userType": { - "type": "string", - "enum": ["Member"] + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "id", + "mail", + "onPremisesSamAccountName", + "accountEnabled", + "userType" + ], + "properties": { + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Alice"] + }, + "accountEnabled": { + "type": "boolean", + "enum": [true] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + }, + { + "type": "object", + "required": [ + "id", + "mail", + "onPremisesSamAccountName", + "accountEnabled" + ], + "properties": { + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["brian@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Brian"] + }, + "accountEnabled": { + "type": "boolean", + "enum": [true] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } } } - }, - { - "type": "object", - "required": [ - "id", - "mail", - "onPremisesSamAccountName", - "accountEnabled" - ], - "properties": { - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["brian@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Brian"] - }, - "accountEnabled": { - "type": "boolean", - "enum": [true] - }, - "userType": { - "type": "string", - "enum": ["Member"] - } - } - } - ], - "additionalItems": false + ] + } } } } @@ -765,41 +776,40 @@ Feature: get users "properties": { "value": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "id", - "mail", - "onPremisesSamAccountName", - "accountEnabled", - "userType" - ], - "properties": { - "id" : { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["brian@example.org"] - }, - "onPremisesSamAccountName": { - "type": "string", - "enum": ["Brian"] - }, - "accountEnabled": { - "type": "boolean", - "enum": [true] - }, - "userType": { - "type": "string", - "enum": ["Member"] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "id", + "mail", + "onPremisesSamAccountName", + "accountEnabled", + "userType" + ], + "properties": { + "id" : { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["brian@example.org"] + }, + "onPremisesSamAccountName": { + "type": "string", + "enum": ["Brian"] + }, + "accountEnabled": { + "type": "boolean", + "enum": [true] + }, + "userType": { + "type": "string", + "enum": ["Member"] } } - ], - "additionalItems": false + } } } } @@ -1354,28 +1364,33 @@ Feature: get users "properties": { "value": { "type": "array", - "required": [ - "displayName", - "id", - "mail", - "userType" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "userType": { - "type": "string", - "enum": ["Member"] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } } } } @@ -1458,28 +1473,33 @@ Feature: get users "properties": { "value": { "type": "array", - "required": [ - "displayName", - "id", - "mail", - "userType" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "userType": { - "type": "string", - "enum": ["Member"] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } } } } @@ -1502,28 +1522,33 @@ Feature: get users "properties": { "value": { "type": "array", - "required": [ - "displayName", - "id", - "mail", - "userType" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "userType": { - "type": "string", - "enum": ["Member"] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } } } } @@ -1550,63 +1575,68 @@ Feature: get users ], "properties": { "value": { - "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "userType" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["alice@example.org"] - }, - "userType": { - "type": "string", - "enum": ["Member"] + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + }, + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["another-alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } } } - }, - { - "type": "object", - "required": [ - "displayName", - "id", - "mail", - "userType" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "mail": { - "type": "string", - "enum": ["another-alice@example.org"] - }, - "userType": { - "type": "string", - "enum": ["Member"] - } - } - } - ] + ] + } } } } diff --git a/tests/acceptance/features/apiGraphUserGroup/getUserOwnInformation.feature b/tests/acceptance/features/apiGraphUserGroup/getUserOwnInformation.feature index 373eb7a9c7..53a52a32e8 100644 --- a/tests/acceptance/features/apiGraphUserGroup/getUserOwnInformation.feature +++ b/tests/acceptance/features/apiGraphUserGroup/getUserOwnInformation.feature @@ -68,32 +68,37 @@ Feature: get user's own information }, "memberOf": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "displayName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["tea-lover"] + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "displayName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["tea-lover"] + } + } + }, + { + "type": "object", + "required": [ + "displayName" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["coffee-lover"] + } } } - }, - { - "type": "object", - "required": [ - "displayName" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["coffee-lover"] - } - } - } - ] + ] + } } } } diff --git a/tests/acceptance/features/apiSharingNg/listPermissions.feature b/tests/acceptance/features/apiSharingNg/listPermissions.feature index e2ee6aa775..65ecfee70a 100644 --- a/tests/acceptance/features/apiSharingNg/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg/listPermissions.feature @@ -50,148 +50,151 @@ Feature: List a sharing permissions "type": "array", "minItems": 4, "maxItems": 4, - "items": [ - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "type": "integer", - "enum": [ - 1 - ] - }, - "description": { - "type": "string", - "enum": [ - "Allows upload file or folder" - ] - }, - "displayName": { - "type": "string", - "enum": [ - "Uploader" - ] - }, - "id": { - "type": "string", - "enum": [ - "1c996275-f1c9-4e71-abdf-a42f6495e960" - ] + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "type": "integer", + "enum": [ + 1 + ] + }, + "description": { + "type": "string", + "enum": [ + "Allows upload file or folder" + ] + }, + "displayName": { + "type": "string", + "enum": [ + "Uploader" + ] + }, + "id": { + "type": "string", + "enum": [ + "1c996275-f1c9-4e71-abdf-a42f6495e960" + ] + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "type": "integer", + "enum": [ + 2 + ] + }, + "description": { + "type": "string", + "enum": [ + "Allows reading the shared file or folder" + ] + }, + "displayName": { + "type": "string", + "enum": [ + "Viewer" + ] + }, + "id": { + "type": "string", + "enum": [ + "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" + ] + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "type": "integer", + "enum": [ + 3 + ] + }, + "description": { + "type": "string", + "enum": [ + "Allows reading and updating file" + ] + }, + "displayName": { + "type": "string", + "enum": [ + "Editor" + ] + }, + "id": { + "type": "string", + "enum": [ + "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + ] + } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { + "type": "integer", + "enum": [ + 4 + ] + }, + "description": { + "type": "string", + "enum": [ + "Allows creating, reading, updating and deleting the shared file or folder" + ] + }, + "displayName": { + "type": "string", + "enum": [ + "Editor" + ] + }, + "id": { + "type": "string", + "enum": [ + "fb6c3e19-e378-47e5-b277-9732f9de6e21" + ] + } } } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "type": "integer", - "enum": [ - 2 - ] - }, - "description": { - "type": "string", - "enum": [ - "Allows reading the shared file or folder" - ] - }, - "displayName": { - "type": "string", - "enum": [ - "Viewer" - ] - }, - "id": { - "type": "string", - "enum": [ - "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" - ] - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "type": "integer", - "enum": [ - 3 - ] - }, - "description": { - "type": "string", - "enum": [ - "Allows reading and updating file" - ] - }, - "displayName": { - "type": "string", - "enum": [ - "Editor" - ] - }, - "id": { - "type": "string", - "enum": [ - "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" - ] - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "type": "integer", - "enum": [ - 4 - ] - }, - "description": { - "type": "string", - "enum": [ - "Allows creating, reading, updating and deleting the shared file or folder" - ] - }, - "displayName": { - "type": "string", - "enum": [ - "Editor" - ] - }, - "id": { - "type": "string", - "enum": [ - "fb6c3e19-e378-47e5-b277-9732f9de6e21" - ] - } - } - } - ] + ] + } } } } diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index aac62a8c60..6787c3b705 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -34,6 +34,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -48,6 +50,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -125,6 +129,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -139,6 +145,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -205,6 +213,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -219,6 +229,8 @@ Feature: Send a sharing invitations }, "@libre.graph.permissions.actions": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "string", "pattern": "^libre\\.graph\\/driveItem\\/$" @@ -296,6 +308,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -310,6 +324,8 @@ Feature: Send a sharing invitations }, "@libre.graph.permissions.actions": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^libre\\.graph\\/driveItem\\/$" @@ -396,6 +412,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -410,6 +428,8 @@ Feature: Send a sharing invitations }, "@libre.graph.permissions.actions": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^libre\\.graph\\/driveItem\\/$" @@ -493,6 +513,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -507,6 +529,8 @@ Feature: Send a sharing invitations }, "@libre.graph.permissions.actions": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^libre\\.graph\\/driveItem\\/$" @@ -589,6 +613,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -604,6 +630,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -684,6 +712,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -699,6 +729,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -773,6 +805,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -787,6 +821,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -1637,6 +1673,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -1673,6 +1711,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -1813,6 +1853,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -1849,6 +1891,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -2092,6 +2136,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2128,6 +2174,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" @@ -2181,6 +2229,8 @@ Feature: Send a sharing invitations "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2195,6 +2245,8 @@ Feature: Send a sharing invitations }, "roles": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "string", "pattern": "^%role_id_pattern%$" diff --git a/tests/acceptance/features/apiSharingNg/sharedByMe.feature b/tests/acceptance/features/apiSharingNg/sharedByMe.feature index 2732534719..9676a392bd 100644 --- a/tests/acceptance/features/apiSharingNg/sharedByMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedByMe.feature @@ -67,58 +67,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -191,58 +191,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -313,58 +313,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -437,58 +437,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -547,58 +547,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -667,58 +667,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -794,58 +794,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -919,58 +919,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -1046,58 +1046,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -1156,58 +1156,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "Brian Murphy" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "Brian Murphy" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -1281,58 +1281,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "group" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%group_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "grp1" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "group" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%group_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "grp1" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", @@ -1391,58 +1391,58 @@ Feature: resources shared by user }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "group" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "type": "string", - "enum": [ - "grp1" - ] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "group" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "type": "string", + "enum": [ + "grp1" + ] } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "name": { "type": "string", diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature index d6f9a5422d..317fd9509c 100755 --- a/tests/acceptance/features/apiSharingNg/sharedWithMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMe.feature @@ -32,6 +32,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -210,90 +212,90 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } - }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + } + }, + "invitation": { + "type": "object", + "properties": { + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] }, - "required": [ - "displayName", - "id" - ] - } - }, - "required": [ - "user" - ] - } - }, - "required": [ - "invitedBy" - ] + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + }, + "required": [ + "displayName", + "id" + ] + } + }, + "required": [ + "user" + ] + } }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "required": [ + "invitedBy" + ] + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" } } } - ] + } } } }, @@ -329,6 +331,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -500,90 +504,90 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] }, - "required": [ - "displayName", - "id" - ] - } + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + }, + "required": [ + "displayName", + "id" + ] + } + } + }, + "invitation": { + "type": "object", + "properties": { + "invitedBy": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + }, + "required": [ + "displayName", + "id" + ] + } + }, + "required": [ + "user" + ] } }, - "invitation": { - "type": "object", - "properties": { - "invitedBy": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } - }, - "required": [ - "displayName", - "id" - ] - } - }, - "required": [ - "user" - ] - } - }, - "required": [ - "invitedBy" - ] - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "required": [ + "invitedBy" + ] + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" } } } - ] + } } } } @@ -624,6 +628,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -870,12 +876,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } }, @@ -944,12 +950,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -1009,6 +1015,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -1204,12 +1212,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } }, @@ -1278,12 +1286,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -1341,6 +1349,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -1567,12 +1577,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } }, @@ -1641,12 +1651,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -1694,6 +1704,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -1869,12 +1881,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } }, @@ -1943,12 +1955,12 @@ Feature: an user gets the resources shared to them }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -1986,6 +1998,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2156,78 +2170,76 @@ Feature: an user gets the resources shared to them "type": "array", "maxItems": 1, "minItems": 1, - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties":{ - "group": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties":{ + "group": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } - } - } - } - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "size": { "type": "number", @@ -2270,6 +2282,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2392,78 +2406,76 @@ Feature: an user gets the resources shared to them "type": "array", "maxItems": 1, "minItems": 1, - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties":{ - "group": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties":{ + "group": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } - } - } - } - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } }, "size": { "type": "number", @@ -2505,6 +2517,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2645,78 +2659,76 @@ Feature: an user gets the resources shared to them "type": "array", "maxItems": 1, "minItems": 1, - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties":{ - "group": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties":{ + "group": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } - } - } - } - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } } } } @@ -2751,6 +2763,8 @@ Feature: an user gets the resources shared to them "properties": { "value": { "type": "array", + "minItems": 1, + "maxItems": 1, "items": { "type": "object", "required": [ @@ -2852,78 +2866,76 @@ Feature: an user gets the resources shared to them "type": "array", "maxItems": 1, "minItems": 1, - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties":{ - "group": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties":{ + "group": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } - }, - "id": { + } + }, + "id": { + "type": "string", + "pattern": "^%permissions_id_pattern%$" + }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "user":{ + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + } + } + } + } + }, + "roles": { + "type": "array", + "maxItems": 1, + "minItems": 1, + "items": { "type": "string", - "pattern": "^%permissions_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "user":{ - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } - } - } - } - }, - "roles": { - "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "pattern": "^%role_id_pattern%$" } } } - ] + } } } } @@ -3044,12 +3056,34 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -3059,29 +3093,7 @@ Feature: an user gets the resources shared to them "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Carol King"] - } + "enum": ["Carol King"] } } } @@ -3089,7 +3101,7 @@ Feature: an user gets the resources shared to them } } } - ] + } } } } @@ -3173,12 +3185,34 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -3188,29 +3222,7 @@ Feature: an user gets the resources shared to them "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - } + "enum": ["Alice Hansen"] } } } @@ -3218,7 +3230,7 @@ Feature: an user gets the resources shared to them } } } - ] + } } } } @@ -3341,12 +3353,34 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -3356,29 +3390,7 @@ Feature: an user gets the resources shared to them "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Carol King"] - } + "enum": ["Carol King"] } } } @@ -3386,7 +3398,7 @@ Feature: an user gets the resources shared to them } } } - ] + } } } } @@ -3470,12 +3482,34 @@ Feature: an user gets the resources shared to them }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -3485,29 +3519,7 @@ Feature: an user gets the resources shared to them "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - } + "enum": ["Alice Hansen"] } } } @@ -3515,7 +3527,7 @@ Feature: an user gets the resources shared to them } } } - ] + } } } } diff --git a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature index 08d28336f3..4e162a22e5 100644 --- a/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature +++ b/tests/acceptance/features/apiSharingNg/sharedWithMeSyncDisabled.feature @@ -33,6 +33,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -189,32 +191,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } @@ -252,15 +254,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } }, "size": { "type": "number", @@ -300,6 +302,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -434,32 +438,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } @@ -497,15 +501,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } } } } @@ -541,6 +545,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -697,32 +703,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties": { - "group": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%group_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%group_id_pattern%$" } } } @@ -760,15 +766,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } }, "size": { "type": "number", @@ -812,6 +818,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -946,32 +954,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%group_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%group_id_pattern%$" } } } @@ -1009,15 +1017,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } } } } @@ -1052,6 +1060,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -1173,35 +1183,35 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } @@ -1242,15 +1252,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } }, "size": { "type": "number", @@ -1291,6 +1301,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -1393,37 +1405,37 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": [ - "user" - ], - "properties": { - "user": { - "type": "object", - "required": [ - "displayName", - "id" - ], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "displayName", + "id" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } @@ -1466,15 +1478,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } } } } @@ -1513,6 +1525,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -1627,32 +1641,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties": { - "group": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["grp1"] - }, - "id": { - "type": "string", - "pattern": "^%group_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "group": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["grp1"] + }, + "id": { + "type": "string", + "pattern": "^%group_id_pattern%$" } } } @@ -1690,15 +1704,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } }, "size": { "type": "number", @@ -1745,6 +1759,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -1837,32 +1853,32 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "invitation", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["group"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Brian Murphy"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - } + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": [ + "grantedToV2", + "id", + "invitation", + "roles" + ], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["group"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" } } } @@ -1900,15 +1916,15 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "maxItems": 1, + "minItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } - ] + } } } } @@ -1950,6 +1966,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -2092,6 +2110,8 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "value": { "type": "array", + "maxItems": 1, + "minItems": 1, "items": { "type": "object", "required": [ @@ -2311,12 +2331,34 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -2326,29 +2368,7 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Carol King"] - } + "enum": ["Carol King"] } } } @@ -2356,7 +2376,7 @@ Feature: listing sharedWithMe when auto-sync is disabled } } } - ] + } } } } @@ -2440,12 +2460,34 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -2455,29 +2497,7 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - } + "enum": ["Alice Hansen"] } } } @@ -2485,7 +2505,7 @@ Feature: listing sharedWithMe when auto-sync is disabled } } } - ] + } } } } @@ -2608,12 +2628,34 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -2623,29 +2665,7 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Carol King"] - } + "enum": ["Carol King"] } } } @@ -2653,7 +2673,7 @@ Feature: listing sharedWithMe when auto-sync is disabled } } } - ] + } } } } @@ -2737,12 +2757,34 @@ Feature: listing sharedWithMe when auto-sync is disabled }, "permissions": { "type": "array", - "items": [ - { + "maxItems": 1, + "minItems": 1, + "items": { + "type": "object", + "required": ["grantedToV2", "id", "invitation", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["displayName", "id"], + "properties": { + "displayName": { + "type": "string", + "enum": ["Brian Murphy"] + } + } + } + } + } + }, + "invitation": { "type": "object", - "required": ["grantedToV2", "id", "invitation", "roles"], + "required": ["invitedBy"], "properties": { - "grantedToV2": { + "invitedBy": { "type": "object", "required": ["user"], "properties": { @@ -2752,29 +2794,7 @@ Feature: listing sharedWithMe when auto-sync is disabled "properties": { "displayName": { "type": "string", - "enum": ["Brian Murphy"] - } - } - } - } - } - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["displayName", "id"], - "properties": { - "displayName": { - "type": "string", - "enum": ["Alice Hansen"] - } + "enum": ["Alice Hansen"] } } } @@ -2782,7 +2802,7 @@ Feature: listing sharedWithMe when auto-sync is disabled } } } - ] + } } } } diff --git a/tests/acceptance/features/apiSharingNg/updateShareInvitations.feature b/tests/acceptance/features/apiSharingNg/updateShareInvitations.feature index f98612bed5..22be6872dd 100644 --- a/tests/acceptance/features/apiSharingNg/updateShareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/updateShareInvitations.feature @@ -71,12 +71,12 @@ Feature: Update permission of a share }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -141,12 +141,12 @@ Feature: Update permission of a share }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -212,12 +212,12 @@ Feature: Update permission of a share }, "roles": { "type": "array", - "items": [ - { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - ] + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } diff --git a/tests/acceptance/features/apiSpaces/changeSpaces.feature b/tests/acceptance/features/apiSpaces/changeSpaces.feature index 4c34faceef..f7297e2557 100644 --- a/tests/acceptance/features/apiSpaces/changeSpaces.feature +++ b/tests/acceptance/features/apiSpaces/changeSpaces.feature @@ -167,61 +167,61 @@ Feature: Change data of space }, "special": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "size", - "name", - "specialFolder", - "file", - "id", - "eTag" - ], - "properties": { - "size": { - "type": "number", - "enum": [17] - }, - "name": { - "type": "string", - "enum": ["readme.md"] - }, - "specialFolder": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "enum": ["readme"] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "size", + "name", + "specialFolder", + "file", + "id", + "eTag" + ], + "properties": { + "size": { + "type": "number", + "enum": [17] + }, + "name": { + "type": "string", + "enum": ["readme.md"] + }, + "specialFolder": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "enum": ["readme"] } - }, - "file": { - "type": "object", - "required": [ - "mimeType" - ], - "properties": { - "mimeType": { - "type": "string", - "enum": ["text/markdown"] - } - } - }, - "id": { - "type": "string", - "enum": ["%file_id%"] - }, - "tag": { - "type": "string", - "enum": ["%eTag%"] } + }, + "file": { + "type": "object", + "required": [ + "mimeType" + ], + "properties": { + "mimeType": { + "type": "string", + "enum": ["text/markdown"] + } + } + }, + "id": { + "type": "string", + "enum": ["%file_id%"] + }, + "tag": { + "type": "string", + "enum": ["%eTag%"] } } - ] + } } } } @@ -262,61 +262,61 @@ Feature: Change data of space }, "special": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "size", - "name", - "specialFolder", - "file", - "id", - "eTag" - ], - "properties": { - "size": { - "type": "number", - "enum": [0] - }, - "name": { - "type": "string", - "enum": [""] - }, - "specialFolder": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "enum": ["image"] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "size", + "name", + "specialFolder", + "file", + "id", + "eTag" + ], + "properties": { + "size": { + "type": "number", + "enum": [0] + }, + "name": { + "type": "string", + "enum": [""] + }, + "specialFolder": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "enum": ["image"] } - }, - "file": { - "type": "object", - "required": [ - "mimeType" - ], - "properties": { - "mimeType": { - "type": "string", - "enum": [""] - } - } - }, - "id": { - "type": "string", - "enum": ["%file_id%"] - }, - "tag": { - "type": "string", - "enum": ["%eTag%"] } + }, + "file": { + "type": "object", + "required": [ + "mimeType" + ], + "properties": { + "mimeType": { + "type": "string", + "enum": [""] + } + } + }, + "id": { + "type": "string", + "enum": ["%file_id%"] + }, + "tag": { + "type": "string", + "enum": ["%eTag%"] } } - ] + } } } } @@ -359,61 +359,61 @@ Feature: Change data of space }, "special": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "size", - "name", - "specialFolder", - "file", - "id", - "eTag" - ], - "properties": { - "size": { - "type": "number", - "enum": [] - }, - "name": { - "type": "string", - "enum": ["readme.md"] - }, - "specialFolder": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "enum": ["readme"] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "size", + "name", + "specialFolder", + "file", + "id", + "eTag" + ], + "properties": { + "size": { + "type": "number", + "enum": [] + }, + "name": { + "type": "string", + "enum": ["readme.md"] + }, + "specialFolder": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "enum": ["readme"] } - }, - "file": { - "type": "object", - "required": [ - "mimeType" - ], - "properties": { - "mimeType": { - "type": "string", - "enum": ["text/markdown"] - } - } - }, - "id": { - "type": "string", - "enum": ["%file_id%"] - }, - "tag": { - "type": "string", - "enum": ["%eTag%"] } + }, + "file": { + "type": "object", + "required": [ + "mimeType" + ], + "properties": { + "mimeType": { + "type": "string", + "enum": ["text/markdown"] + } + } + }, + "id": { + "type": "string", + "enum": ["%file_id%"] + }, + "tag": { + "type": "string", + "enum": ["%eTag%"] } } - ] + } } } } @@ -447,61 +447,61 @@ Feature: Change data of space }, "special": { "type": "array", - "items": [ - { - "type": "object", - "required": [ - "size", - "name", - "specialFolder", - "file", - "id", - "eTag" - ], - "properties": { - "size": { - "type": "number", - "enum": [0] - }, - "name": { - "type": "string", - "enum": ["newSpaceImage.png"] - }, - "specialFolder": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "enum": ["image"] - } + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "size", + "name", + "specialFolder", + "file", + "id", + "eTag" + ], + "properties": { + "size": { + "type": "number", + "enum": [0] + }, + "name": { + "type": "string", + "enum": ["newSpaceImage.png"] + }, + "specialFolder": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "enum": ["image"] } - }, - "file": { - "type": "object", - "required": [ - "mimeType" - ], - "properties": { - "mimeType": { - "type": "string", - "enum": ["image/png"] - } - } - }, - "id": { - "type": "string", - "enum": ["%file_id%"] - }, - "tag": { - "type": "string", - "enum": ["%eTag%"] } + }, + "file": { + "type": "object", + "required": [ + "mimeType" + ], + "properties": { + "mimeType": { + "type": "string", + "enum": ["image/png"] + } + } + }, + "id": { + "type": "string", + "enum": ["%file_id%"] + }, + "tag": { + "type": "string", + "enum": ["%eTag%"] } } - ] + } } } } diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index 0293466e0d..f6e76fe000 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -24,7 +24,6 @@ use Behat\Behat\Hook\Scope\BeforeStepScope; use GuzzleHttp\Exception\GuzzleException; -use Helmich\JsonAssert\JsonAssertions; use rdx\behatvars\BehatVariablesContext; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Behat\Hook\Scope\AfterScenarioScope; @@ -35,6 +34,7 @@ use Behat\Testwork\Hook\Scope\AfterSuiteScope; use GuzzleHttp\Cookie\CookieJar; use Psr\Http\Message\ResponseInterface; use PHPUnit\Framework\Assert; +use Swaggest\JsonSchema\Schema as JsonSchema; use TestHelpers\AppConfigHelper; use TestHelpers\OcsApiHelper; use TestHelpers\SetupHelper; @@ -55,7 +55,6 @@ class FeatureContext extends BehatVariablesContext { use Provisioning; use Sharing; use WebDav; - use JsonAssertions; /** * Unix timestamp seconds @@ -1207,6 +1206,117 @@ class FeatureContext extends BehatVariablesContext { return $a; } + /** + * Validates against the requirements that array schema should adhere to + * + * @param JsonSchema $schemaObj + * + * @return void + * @throws Exception + */ + private function validateSchemaArrayEntries(JsonSchema $schemaObj): void { + $hasTwoElementValidator = ($schemaObj->enum && $schemaObj->const) || ($schemaObj->enum && $schemaObj->items) || ($schemaObj->const && $schemaObj->items); + Assert::assertFalse($hasTwoElementValidator, "'items', 'enum' and 'const' should not be used together"); + if ($schemaObj->enum || $schemaObj->const) { + // do not try to validate of enum or const is present + return; + } + + $requiredValidators = ["maxItems", "minItems"]; + $optionalValidators = ["items", "uniqueItems"]; + $errMsg = "'%s' is required for array assertion"; + + // validate required keywords + foreach ($requiredValidators as $validator) { + Assert::assertNotNull($schemaObj->$validator, \sprintf($errMsg, $validator)); + } + + Assert::assertEquals($schemaObj->minItems, $schemaObj->maxItems, "'minItems' and 'maxItems' should be equal for strict assertion"); + + // validate optional keywords + foreach ($optionalValidators as $validator) { + $value = $schemaObj->$validator; + switch ($validator) { + case 'items': + if ($schemaObj->maxItems === 0) { + break; + } + Assert::assertNotNull($schemaObj->$validator, \sprintf($errMsg, $validator)); + if ($schemaObj->maxItems > 1) { + if (\is_array($value)) { + foreach ($value as $element) { + Assert::assertNotNull($element->oneOf, "'oneOf' is required to assert more than one elements"); + } + Assert::fail("'$validator' should be an object not an array"); + break; + } + Assert::assertFalse($value->allOf || $value->anyOf, "'allOf' and 'anyOf' are not allowed in array"); + Assert::assertNotNull($value->oneOf, "'oneOf' is required to assert more than one elements"); + Assert::assertTrue(\is_array($value->oneOf), "'oneOf' should be an array"); + Assert::assertEquals($schemaObj->maxItems, \count($value->oneOf), "There are more 'oneOf' elements than expected by 'maxItems'"); + } + Assert::assertTrue(\is_object($value), "'$validator' should be an object when expecting 1 element"); + break; + case "uniqueItems": + if ($schemaObj->minItems > 1) { + $errMsg = $value === null ? \sprintf($errMsg, $validator) : "'$validator' should be true"; + Assert::assertTrue($value, $errMsg); + } + break; + default: + break; + } + } + } + + /** + * Validates the json schema requirements + * + * @param JsonSchema $schema + * + * @return void + * @throws Exception + */ + public function validateSchemaRequirements(JsonSchema $schema): void { + $propNames = $schema->getPropertyNames(); + $props = $schema->getProperties(); + foreach ($propNames as $propName) { + switch ($props->$propName->type) { + case 'array': + $this->validateSchemaArrayEntries($props->$propName); + $items = $props->$propName->items; + if ($items && $items->oneOf) { + foreach ($items->oneOf as $oneOfItem) { + $this->validateSchemaRequirements($oneOfItem); + } + break; + } elseif ($items) { + $this->validateSchemaRequirements($items); + } + break; + default: + break; + } + // traverse for nested properties + if ($props->$propName->getProperties()) { + $this->validateSchemaRequirements($props->$propName); + } + } + } + + /** + * @param object $json + * @param object $schema + * + * @return void + * @throws Exception + */ + public function assertJsonDocumentMatchesSchema(object $json, object $schema): void { + $schema = JsonSchema::import($schema); + $this->validateSchemaRequirements($schema); + $schema->in($json); + } + /** * @When /^user "([^"]*)" sends HTTP method "([^"]*)" to URL "([^"]*)"$/ * @@ -1445,13 +1555,12 @@ class FeatureContext extends BehatVariablesContext { * @Then the JSON data of the response should match * * @param PyStringNode $schemaString - * @param ResponseInterface|null $response * * @return void * @throws Exception */ - public function theDataOfTheResponseShouldMatch(PyStringNode $schemaString, ResponseInterface $response=null): void { - $responseBody = $this->getJsonDecodedResponseBodyContent($response); + public function theJsonDataOfTheResponseShouldMatch(PyStringNode $schemaString): void { + $responseBody = $this->getJsonDecodedResponseBodyContent(); $this->assertJsonDocumentMatchesSchema( $responseBody, $this->getJSONSchema($schemaString) diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 8b8216541b..bd3b35c52b 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -206,7 +206,11 @@ class GraphContext implements Context { */ public function theUserInformationShouldMatchTheJSON(string $user, PyStringNode $schemaString): void { $response = $this->adminHasRetrievedUserUsingTheGraphApi($user); - $this->featureContext->theDataOfTheResponseShouldMatch($schemaString, $response); + $responseBody = $this->featureContext->getJsonDecodedResponseBodyContent($response); + $this->featureContext->assertJsonDocumentMatchesSchema( + $responseBody, + $this->featureContext->getJSONSchema($schemaString) + ); } /** diff --git a/tests/acceptance/features/coreApiCapabilities/capabilities.feature b/tests/acceptance/features/coreApiCapabilities/capabilities.feature index 8e6e78ac2b..410f0d87a7 100644 --- a/tests/acceptance/features/coreApiCapabilities/capabilities.feature +++ b/tests/acceptance/features/coreApiCapabilities/capabilities.feature @@ -198,6 +198,7 @@ Feature: capabilities "blacklisted_files": { "type": "array", "minItems": 1, + "maxItems": 1, "items": { "type": "string", "enum": [".htaccess"] diff --git a/vendor-bin/behat/composer.json b/vendor-bin/behat/composer.json index ba9779e161..0192865a4d 100644 --- a/vendor-bin/behat/composer.json +++ b/vendor-bin/behat/composer.json @@ -22,6 +22,6 @@ "laminas/laminas-ldap": "^2.15", "ankitpokhrel/tus-php": "^2.3", "wapmorgan/unified-archive": "^1.1.10", - "helmich/phpunit-json-assert": "^3.4" + "swaggest/json-schema": "^0.12.42" } }