mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-01 23:19:51 +00:00
API: Updated docs with consistent types, fixed users response example
For #5178 and #5183
This commit is contained in:
parent
9f68ca5358
commit
1f2506221a
3 changed files with 11 additions and 12 deletions
app
dev/api/responses
|
@ -171,16 +171,16 @@ class AttachmentApiController extends ApiController
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'create' => [
|
'create' => [
|
||||||
'name' => ['required', 'min:1', 'max:255', 'string'],
|
'name' => ['required', 'string', 'min:1', 'max:255'],
|
||||||
'uploaded_to' => ['required', 'integer', 'exists:pages,id'],
|
'uploaded_to' => ['required', 'integer', 'exists:pages,id'],
|
||||||
'file' => array_merge(['required_without:link'], $this->attachmentService->getFileValidationRules()),
|
'file' => array_merge(['required_without:link'], $this->attachmentService->getFileValidationRules()),
|
||||||
'link' => ['required_without:file', 'min:1', 'max:2000', 'safe_url'],
|
'link' => ['required_without:file', 'string', 'min:1', 'max:2000', 'safe_url'],
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'name' => ['min:1', 'max:255', 'string'],
|
'name' => ['string', 'min:1', 'max:255'],
|
||||||
'uploaded_to' => ['integer', 'exists:pages,id'],
|
'uploaded_to' => ['integer', 'exists:pages,id'],
|
||||||
'file' => $this->attachmentService->getFileValidationRules(),
|
'file' => $this->attachmentService->getFileValidationRules(),
|
||||||
'link' => ['min:1', 'max:2000', 'safe_url'],
|
'link' => ['string', 'min:1', 'max:2000', 'safe_url'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,27 +37,28 @@ class UserApiController extends ApiController
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'create' => [
|
'create' => [
|
||||||
'name' => ['required', 'min:2', 'max:100'],
|
'name' => ['required', 'string', 'min:2', 'max:100'],
|
||||||
'email' => [
|
'email' => [
|
||||||
'required', 'min:2', 'email', new Unique('users', 'email'),
|
'required', 'string', 'email', 'min:2', new Unique('users', 'email'),
|
||||||
],
|
],
|
||||||
'external_auth_id' => ['string'],
|
'external_auth_id' => ['string'],
|
||||||
'language' => ['string', 'max:15', 'alpha_dash'],
|
'language' => ['string', 'max:15', 'alpha_dash'],
|
||||||
'password' => [Password::default()],
|
'password' => ['string', Password::default()],
|
||||||
'roles' => ['array'],
|
'roles' => ['array'],
|
||||||
'roles.*' => ['integer'],
|
'roles.*' => ['integer'],
|
||||||
'send_invite' => ['boolean'],
|
'send_invite' => ['boolean'],
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'name' => ['min:2', 'max:100'],
|
'name' => ['string', 'min:2', 'max:100'],
|
||||||
'email' => [
|
'email' => [
|
||||||
'min:2',
|
'string',
|
||||||
'email',
|
'email',
|
||||||
|
'min:2',
|
||||||
(new Unique('users', 'email'))->ignore($userId ?? null),
|
(new Unique('users', 'email'))->ignore($userId ?? null),
|
||||||
],
|
],
|
||||||
'external_auth_id' => ['string'],
|
'external_auth_id' => ['string'],
|
||||||
'language' => ['string', 'max:15', 'alpha_dash'],
|
'language' => ['string', 'max:15', 'alpha_dash'],
|
||||||
'password' => [Password::default()],
|
'password' => ['string', Password::default()],
|
||||||
'roles' => ['array'],
|
'roles' => ['array'],
|
||||||
'roles.*' => ['integer'],
|
'roles.*' => ['integer'],
|
||||||
],
|
],
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"updated_at": "2022-02-03T16:27:55.000000Z",
|
"updated_at": "2022-02-03T16:27:55.000000Z",
|
||||||
"external_auth_id": "abc123456",
|
"external_auth_id": "abc123456",
|
||||||
"slug": "dan-brown",
|
"slug": "dan-brown",
|
||||||
"user_id": 1,
|
|
||||||
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
||||||
"profile_url": "https://docs.example.com/user/dan-brown",
|
"profile_url": "https://docs.example.com/user/dan-brown",
|
||||||
"edit_url": "https://docs.example.com/settings/users/1",
|
"edit_url": "https://docs.example.com/settings/users/1",
|
||||||
|
@ -22,7 +21,6 @@
|
||||||
"updated_at": "2021-11-18T17:10:58.000000Z",
|
"updated_at": "2021-11-18T17:10:58.000000Z",
|
||||||
"external_auth_id": "",
|
"external_auth_id": "",
|
||||||
"slug": "benny",
|
"slug": "benny",
|
||||||
"user_id": 2,
|
|
||||||
"last_activity_at": "2022-01-31T20:39:24.000000Z",
|
"last_activity_at": "2022-01-31T20:39:24.000000Z",
|
||||||
"profile_url": "https://docs.example.com/user/benny",
|
"profile_url": "https://docs.example.com/user/benny",
|
||||||
"edit_url": "https://docs.example.com/settings/users/2",
|
"edit_url": "https://docs.example.com/settings/users/2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue