-
Notifications
You must be signed in to change notification settings - Fork 4
feat(scopes): Allow apps to define different API scopes for different… #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
0993565
feat(scopes): Allow apps to define different API scopes for different…
nickvergessen 36ab954
feat(scopes): Allow multiple scopes
nickvergessen fff1bd9
fix(scopes): Only list schemas that are used in this Scope
nickvergessen 288914d
feat(scopes): Move admin-only routes to administration scope when def…
nickvergessen e065a7c
feat(scopes): Handle tags defined by the scopes
nickvergessen 481ca1c
fix(scopes): Don't break on files responses
nickvergessen a369adb
fix(scopes): Deduplicate logic
nickvergessen f6ad18f
fix(scopes): Also export schemas that are only referenced by other sc…
nickvergessen 6ef6a4b
fix(scopes): Don't warn when we deal with binary return types
nickvergessen 7aa0bac
fix(scopes): Correctly add schemas references by nested schemas
nickvergessen 886b55f
fix(scopes): Don't break with \stdClass returns
nickvergessen 59826d7
fix(scopes): Handle all possible cases of other Schemas when importin…
nickvergessen 2cf5e13
fix(scopes): Add tests for the scope and tag features
nickvergessen 2cd80cf
fix(scopes): Fix tag variable name
nickvergessen f76700f
fix(scopes): Remove attribute name from parameter as it's always the …
nickvergessen 42f15fb
fix(scopes): Panic when a controller/route is ignored but has other s…
nickvergessen 03ccc56
fix(scopes): Better log levels for schema detection
nickvergessen 3729e5a
fix(scopes): Reduce nesting of the scope loops
nickvergessen 9833a75
fix(scopes): Deduplicate finding used schemas
nickvergessen a698329
fix(scopes): Allow scopes and tags without parameter names
nickvergessen 2125e85
feat(scopes): Add a "full" scope when more than 1 is used
nickvergessen 84c976b
fix(tests): Adjust some copy-paste description and add openapi-full.json
nickvergessen 0d8fb4b
fix(scopes): Improve help when not reading schemas
nickvergessen 5d78669
fix(tags): Panic when the tags are not an array list
nickvergessen 4d20003
fix(scopes): Inspect all responses for schemas
nickvergessen ed40c15
fix(scopes): Fix counting the routes
nickvergessen 79517db
fix(scopes): Fix empty path arrays
nickvergessen 443740f
fix(schemas): Make sure schemas are always a dictionary
nickvergessen a479a34
fix(scopes): Don't generate "full" scope when there is none
nickvergessen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * @copyright Copyright (c) 2021, Julien Barnoin <[email protected]> | ||
| * | ||
| * @author Julien Barnoin <[email protected]> | ||
| * | ||
| * @license AGPL-3.0-or-later | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCA\Notifications\Controller; | ||
|
|
||
| use OCA\Notifications\ResponseDefinitions; | ||
| use OCP\AppFramework\Http; | ||
| use OCP\AppFramework\Http\Attribute\OpenAPI; | ||
| use OCP\AppFramework\Http\DataResponse; | ||
| use OCP\AppFramework\OCSController; | ||
|
|
||
| /** | ||
| * @psalm-import-type NotificationsPushDevice from ResponseDefinitions | ||
| * @psalm-import-type NotificationsNotification from ResponseDefinitions | ||
| * @psalm-import-type NotificationsCollection from ResponseDefinitions | ||
| */ | ||
| #[OpenAPI(scope: OpenAPI::SCOPE_FEDERATION)] | ||
| class FederationController extends OCSController { | ||
|
|
||
| /** | ||
| * @NoAdminRequired | ||
| * | ||
| * Route is in federation scope as per controller scope | ||
| * | ||
| * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> | ||
| * | ||
| * 200: OK | ||
| */ | ||
| public function federationByController(): DataResponse { | ||
| return new DataResponse(); | ||
| } | ||
|
|
||
| /** | ||
| * @NoAdminRequired | ||
| * | ||
| * Route is only in the default scope (moved from federation) | ||
| * | ||
| * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> | ||
| * | ||
| * 200: Personal settings updated | ||
| */ | ||
| #[OpenAPI] | ||
| public function movedToDefaultScope(): DataResponse { | ||
| return new DataResponse(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.