Implement swagger

This commit is contained in:
zardzul
2026-03-13 21:03:01 +01:00
parent 30298390a0
commit 0deee355c1
10 changed files with 652 additions and 4 deletions
+114
View File
@@ -0,0 +1,114 @@
basePath: /
definitions:
handlers.CreateUserRequest:
properties:
password:
minLength: 12
type: string
user_mail:
type: string
user_name:
type: string
required:
- password
- user_mail
- user_name
type: object
handlers.CreateUserResponse:
properties:
id:
type: string
message:
type: string
type: object
handlers.ErrorResponse:
properties:
error:
type: string
type: object
handlers.UsernameResponse:
properties:
user_name:
type: string
type: object
info:
contact: {}
description: API for managing users and artists in Music Index.
title: Music Index API
version: "1.0"
paths:
/artist/getAll:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List all artists
tags:
- artist
/user/create:
post:
consumes:
- application/json
parameters:
- description: User payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/handlers.CreateUserRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/handlers.CreateUserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Create a user
tags:
- user
/user/getUserNameByID/{id}:
get:
parameters:
- description: User ID (UUID)
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.UsernameResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get username by user ID
tags:
- user
swagger: "2.0"