Skip to content

Commit

Permalink
feat: Improve documenting of routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioabreu committed Apr 7, 2024
1 parent b6ae43c commit 3fbe861
Show file tree
Hide file tree
Showing 5 changed files with 595 additions and 16 deletions.
179 changes: 178 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,195 @@ const docTemplate = `{
"application/json"
],
"summary": "Create an input",
"parameters": [
{
"description": "Input data",
"name": "input",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.Input"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.Input"
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid input data",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/inputs/{id}": {
"get": {
"description": "Get input information by ID",
"produces": [
"application/json"
],
"summary": "Get input",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
},
"delete": {
"description": "Delete input by ID",
"produces": [
"application/json"
],
"summary": "Delete input",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/notifications/package": {
"post": {
"description": "Enqueue packaging job using input URL, format and ID",
"produces": [
"application/json"
],
"summary": "Enqueue packacing job",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"api.Error": {
"type": "object",
"properties": {
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/api.ErrorDetail"
}
},
"message": {
"type": "string"
}
}
},
"api.ErrorDetail": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"reason": {
"type": "string"
}
}
},
"api.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/api.Error"
}
}
},
"api.SuccessResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
}
}
},
"model.Input": {
"type": "object",
"required": [
Expand Down
179 changes: 178 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,195 @@
"application/json"
],
"summary": "Create an input",
"parameters": [
{
"description": "Input data",
"name": "input",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.Input"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.Input"
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid input data",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/inputs/{id}": {
"get": {
"description": "Get input information by ID",
"produces": [
"application/json"
],
"summary": "Get input",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
},
"delete": {
"description": "Delete input by ID",
"produces": [
"application/json"
],
"summary": "Delete input",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/notifications/package": {
"post": {
"description": "Enqueue packaging job using input URL, format and ID",
"produces": [
"application/json"
],
"summary": "Enqueue packacing job",
"parameters": [
{
"type": "string",
"description": "Input ID",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.SuccessResponse"
}
},
"400": {
"description": "Invalid UUID format",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"api.Error": {
"type": "object",
"properties": {
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/api.ErrorDetail"
}
},
"message": {
"type": "string"
}
}
},
"api.ErrorDetail": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"reason": {
"type": "string"
}
}
},
"api.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/api.Error"
}
}
},
"api.SuccessResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
}
}
},
"model.Input": {
"type": "object",
"required": [
Expand Down
Loading

0 comments on commit 3fbe861

Please sign in to comment.