add swagger
This commit is contained in:
625
docs/swagger.yaml
Normal file
625
docs/swagger.yaml
Normal file
@@ -0,0 +1,625 @@
|
||||
definitions:
|
||||
api_acladmin.createResourceErrorInvalidResourceKey:
|
||||
properties:
|
||||
details:
|
||||
example: Invalid resource key
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_CREATE_RESOURCE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createResourceErrorResourceAlreadyExists:
|
||||
properties:
|
||||
details:
|
||||
example: Resource with key 'html.view' already exists
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_CREATE_RESOURCE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createResourceRequest:
|
||||
properties:
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createResourceResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createRoleErrorInvalidRoleName:
|
||||
properties:
|
||||
details:
|
||||
example: Invalid role name
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_CREATE_ROLE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createRoleErrorRoleAlreadyExists:
|
||||
properties:
|
||||
details:
|
||||
example: Role with name 'admin' already exists
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_CREATE_ROLE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createRoleRequest:
|
||||
properties:
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.createRoleResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteResourceErrorInvalidResourceID:
|
||||
properties:
|
||||
details:
|
||||
example: Resource ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_RESOURCE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteResourceErrorResourceInUse:
|
||||
properties:
|
||||
details:
|
||||
example: Resource with ID 123 is used and cannot be deleted
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_DELETE_RESOURCE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteResourceErrorResourceNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No resource with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: RESOURCE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteRoleErrorInvalidRoleID:
|
||||
properties:
|
||||
details:
|
||||
example: Role ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_ROLE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteRoleErrorRoleInUse:
|
||||
properties:
|
||||
details:
|
||||
example: Role with ID 123 is assigned to users and cannot be deleted
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_DELETE_ROLE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.deleteRoleErrorRoleNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No role with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: ROLE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.errorInternalServerError:
|
||||
properties:
|
||||
details:
|
||||
type: string
|
||||
error:
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.errorInvalidRequestBody:
|
||||
properties:
|
||||
details:
|
||||
example: Request body is not valid JSON
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_REQUEST_BODY
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getResourceErrorInvalidResourceID:
|
||||
properties:
|
||||
details:
|
||||
example: Resource ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_RESOURCE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getResourceErrorResourceNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No resource with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: RESOURCE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getResourceResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getRoleErrorInvalidRoleID:
|
||||
properties:
|
||||
details:
|
||||
example: Role ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_ROLE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getRoleErrorRoleNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No role with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: ROLE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.getRoleResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceErrorInvalidResourceID:
|
||||
properties:
|
||||
details:
|
||||
example: Resource ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_RESOURCE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceErrorInvalidResourceKey:
|
||||
properties:
|
||||
details:
|
||||
example: Invalid resource key
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_UPDATE_RESOURCE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceErrorResourceKeyAlreadyExists:
|
||||
properties:
|
||||
details:
|
||||
example: Resource with key 'html.view' already exists
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_UPDATE_RESOURCE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceErrorResourceNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No resource with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: RESOURCE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceRequest:
|
||||
properties:
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateResourceResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleErrorInvalidRoleID:
|
||||
properties:
|
||||
details:
|
||||
example: Role ID must be positive integer
|
||||
type: string
|
||||
error:
|
||||
example: INVALID_ROLE_ID
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleErrorInvalidRoleName:
|
||||
properties:
|
||||
details:
|
||||
example: Invalid role name
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_UPDATE_ROLE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleErrorRoleNameAlreadyExists:
|
||||
properties:
|
||||
details:
|
||||
example: Role with name 'admin' already exists
|
||||
type: string
|
||||
error:
|
||||
example: FAILED_TO_UPDATE_ROLE
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleErrorRoleNotFound:
|
||||
properties:
|
||||
details:
|
||||
example: No role with ID 123
|
||||
type: string
|
||||
error:
|
||||
example: ROLE_NOT_FOUND
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleRequest:
|
||||
properties:
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
api_acladmin.updateRoleResponse:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
/api/acl/resources:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
key:
|
||||
example: html.view
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Get all resources
|
||||
tags:
|
||||
- resources
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Resource
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createResourceRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createResourceResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createResourceErrorInvalidResourceKey'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createResourceErrorResourceAlreadyExists'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Create resource
|
||||
tags:
|
||||
- resources
|
||||
/api/acl/resources/{resourceId}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: Resource ID
|
||||
example: 1
|
||||
in: path
|
||||
name: resourceId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteResourceErrorInvalidResourceID'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteResourceErrorResourceNotFound'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteResourceErrorResourceInUse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Delete resource
|
||||
tags:
|
||||
- resources
|
||||
get:
|
||||
parameters:
|
||||
- description: Resource ID
|
||||
example: 1
|
||||
in: path
|
||||
name: resourceId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getResourceResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getResourceErrorInvalidResourceID'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getResourceErrorResourceNotFound'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Get resource by ID
|
||||
tags:
|
||||
- resources
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Resource ID
|
||||
example: 1
|
||||
in: path
|
||||
name: resourceId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Resource
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateResourceRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateResourceResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateResourceErrorInvalidResourceKey'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateResourceErrorResourceNotFound'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateResourceErrorResourceKeyAlreadyExists'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Update resource
|
||||
tags:
|
||||
- resources
|
||||
/api/acl/roles:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: admin
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Get all roles
|
||||
tags:
|
||||
- roles
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Role
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createRoleRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createRoleResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInvalidRequestBody'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createRoleErrorInvalidRoleName'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.createRoleErrorRoleAlreadyExists'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Create role
|
||||
tags:
|
||||
- roles
|
||||
/api/acl/roles/{roleId}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteRoleErrorInvalidRoleID'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteRoleErrorRoleNotFound'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.deleteRoleErrorRoleInUse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Delete role
|
||||
tags:
|
||||
- roles
|
||||
get:
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getRoleResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getRoleErrorInvalidRoleID'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.getRoleErrorRoleNotFound'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Get role by ID
|
||||
tags:
|
||||
- roles
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: Role ID
|
||||
example: 1
|
||||
in: path
|
||||
name: roleId
|
||||
required: true
|
||||
type: integer
|
||||
- description: Role
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateRoleRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateRoleResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateRoleErrorInvalidRoleName'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateRoleErrorRoleNotFound'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.updateRoleErrorRoleNameAlreadyExists'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/api_acladmin.errorInternalServerError'
|
||||
summary: Update role
|
||||
tags:
|
||||
- roles
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user