feat: first commit
This commit is contained in:
6
api/todo/cfg.yaml
Normal file
6
api/todo/cfg.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
package: handler
|
||||
generate:
|
||||
fiber-server: true
|
||||
strict-server: true
|
||||
models: true
|
||||
output: gen.go
|
||||
133
api/todo/todo.yaml
Normal file
133
api/todo/todo.yaml
Normal file
@ -0,0 +1,133 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Todo CRUD API
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: https://api.example.com/v1
|
||||
paths:
|
||||
/todos:
|
||||
get:
|
||||
summary: Get all todos
|
||||
responses:
|
||||
'200':
|
||||
description: A list of todos
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Todo'
|
||||
post:
|
||||
summary: Create a new todo
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TodoCreate'
|
||||
responses:
|
||||
'201':
|
||||
description: Todo created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Todo'
|
||||
/todos/{todoId}:
|
||||
get:
|
||||
summary: Get a todo by ID
|
||||
parameters:
|
||||
- name: todoId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Todo details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Todo'
|
||||
'404':
|
||||
description: Todo not found
|
||||
put:
|
||||
summary: Update a todo by ID
|
||||
parameters:
|
||||
- name: todoId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TodoUpdate'
|
||||
responses:
|
||||
'200':
|
||||
description: Todo updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Todo'
|
||||
'404':
|
||||
description: Todo not found
|
||||
delete:
|
||||
summary: Delete a todo by ID
|
||||
parameters:
|
||||
- name: todoId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'204':
|
||||
description: Todo deleted successfully
|
||||
'404':
|
||||
description: Todo not found
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Todo:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
example: "1"
|
||||
title:
|
||||
type: string
|
||||
example: "Buy groceries"
|
||||
description:
|
||||
type: string
|
||||
example: "Milk, Bread, Eggs"
|
||||
completed:
|
||||
type: boolean
|
||||
example: false
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- completed
|
||||
TodoCreate:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
example: "Buy groceries"
|
||||
description:
|
||||
type: string
|
||||
example: "Milk, Bread, Eggs"
|
||||
required:
|
||||
- title
|
||||
TodoUpdate:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
example: "Buy more groceries"
|
||||
description:
|
||||
type: string
|
||||
example: "Milk, Bread, Eggs, Cheese"
|
||||
completed:
|
||||
type: boolean
|
||||
example: true
|
||||
6
api/user/cfg.yaml
Normal file
6
api/user/cfg.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
package: handler
|
||||
generate:
|
||||
fiber-server: true
|
||||
strict-server: true
|
||||
models: true
|
||||
output: gen.go
|
||||
138
api/user/user.yaml
Normal file
138
api/user/user.yaml
Normal file
@ -0,0 +1,138 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: User CRUD API
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: https://api.example.com/v1
|
||||
paths:
|
||||
/users:
|
||||
get:
|
||||
summary: Get all users
|
||||
responses:
|
||||
'200':
|
||||
description: A list of users
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
post:
|
||||
summary: Create a new user
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserCreate'
|
||||
responses:
|
||||
'201':
|
||||
description: User created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
/users/{userId}:
|
||||
get:
|
||||
summary: Get a user by ID
|
||||
parameters:
|
||||
- name: userId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: User details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
summary: Update a user by ID
|
||||
parameters:
|
||||
- name: userId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserUpdate'
|
||||
responses:
|
||||
'200':
|
||||
description: User updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'404':
|
||||
description: User not found
|
||||
delete:
|
||||
summary: Delete a user by ID
|
||||
parameters:
|
||||
- name: userId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'204':
|
||||
description: User deleted successfully
|
||||
'404':
|
||||
description: User not found
|
||||
|
||||
components:
|
||||
schemas:
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
example: "123"
|
||||
username:
|
||||
type: string
|
||||
example: "johndoe"
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: "johndoe@example.com"
|
||||
required:
|
||||
- id
|
||||
- username
|
||||
- email
|
||||
UserCreate:
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
example: "johndoe"
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: "johndoe@example.com"
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
- password
|
||||
UserUpdate:
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
example: "john_doe_updated"
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: "johnupdated@example.com"
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
Reference in New Issue
Block a user