-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: Add OpenAPI #3324
base: master
Are you sure you want to change the base?
feat: Add OpenAPI #3324
Conversation
|
||
Non-admins can access the `GET` requests to retrieve info about group folders they have access to. | ||
Admins can add `applicable=1` as a parameter to the group folder list request to get the same filtered results of only folders they have direct access to. | ||
See the [OpenAPI specification](openapi.json) to learn about all available API endpoints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum any chance at linking to a readable form of the doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how that would work since we do not have an existing documentation page for Groupfolders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you generate a .md
files from the openapi doc? Then we could link to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of a magic link like https://petstore.swagger.io/?url=https://raw.githubusercontent.com/nextcloud/groupfolders/ac3b696dbb820a5ae34039be1300c1309e58d4e1/openapi.json
tables application does that.
Using this instance is not ideal as it’s supposed to be a demo and it may even be contrary to their ToS, I did not check. But maybe there is a similar tool we can use, or we can host our own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have to go with something like that, there are no good markdown generators it seems.
}, array_keys($folder['groups']), array_values($folder['groups'])); | ||
$folder['groups'] = implode("\n", $groupStrings); | ||
} else { | ||
$folder['groups'] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$folder['groups'] = []; | |
$folder['groups'] = ''; |
|
||
use OC\Files\Cache\CacheEntry; | ||
|
||
class Folder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using the same name as core classes, it’s confusing when the class is imported with a use
statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But Groupfolder
is also not a good name. Would InternalFolder
be better as it is only used as an internal type between different methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said below this should be in Db and be an entity with a mapper ideally.
I do think Groupfolder is closer to what it is than Folder.
Could be FolderDefinition or FolderSettings if that makes sense?
$folderMap[$id] = [ | ||
$applicables = $applicableMap[$id] ?? []; | ||
if (empty($applicables)) { | ||
$applicables = new stdClass(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a controller specific thing that ends up in the manager, is there no way to avoid that?
|
||
namespace OCA\GroupFolders\Folder; | ||
|
||
class FolderMapping { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These classes should actually be entities with mappers, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so. I only made this change from array to class last minute, so I didn't give it much thought.
Signed-off-by: provokateurin <kate@provokateurin.de>
d2b504b
to
ac3b696
Compare
I will try to extract some of the changes into separate PRs to get them merged first and then come back to this PR. |
Closes #3208
This is a breaking change to the API, but since it was not usable before due to CSRF restrictions it doesn't matter.
While working on this I also had to cleanup a lot of the internal typings which resulted in this relatively large change for adding OpenAPI.
If this is too big please let me know and I will try to split it up.