Changes: - forbid to overwrite secrets of other users - add some logs of success - add validation on code (length 50) - use same limiter for POST requests
78 lines
1.7 KiB
YAML
78 lines
1.7 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: CodeVault API
|
|
version: "1.0.0"
|
|
paths:
|
|
/api/v1/getValue:
|
|
post:
|
|
operationId: getValue
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/GetValueRequest'
|
|
responses:
|
|
'200':
|
|
description: Value found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/GetValueResponse'
|
|
'400':
|
|
description: Invalid request body
|
|
'404':
|
|
description: Value not found
|
|
/api/v1/setValue:
|
|
post:
|
|
operationId: setValue
|
|
security:
|
|
- basicAuth: []
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/SetValueRequest'
|
|
responses:
|
|
'204':
|
|
description: Value stored
|
|
'400':
|
|
description: Invalid request body
|
|
'401':
|
|
description: Missing or invalid credentials
|
|
'403':
|
|
description: Code owned by another user
|
|
components:
|
|
securitySchemes:
|
|
basicAuth:
|
|
type: http
|
|
scheme: basic
|
|
schemas:
|
|
GetValueRequest:
|
|
type: object
|
|
required:
|
|
- code
|
|
properties:
|
|
code:
|
|
type: string
|
|
maxLength: 50
|
|
GetValueResponse:
|
|
type: object
|
|
required:
|
|
- value
|
|
properties:
|
|
value:
|
|
type: string
|
|
SetValueRequest:
|
|
type: object
|
|
required:
|
|
- code
|
|
- value
|
|
properties:
|
|
code:
|
|
type: string
|
|
maxLength: 50
|
|
value:
|
|
type: string
|