Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api): unify API input/output #24

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 117 additions & 6 deletions cmd/laas/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ const docTemplate = `{
"required": true
},
{
"description": "Update license body",
"description": "Update license body (requires only the fields to be updated)",
"name": "license",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LicenseDB"
"$ref": "#/definitions/models.LicenseUpdate"
}
}
],
Expand Down Expand Up @@ -479,6 +479,15 @@ const docTemplate = `{
],
"summary": "Get all active obligations",
"operationId": "GetAllObligation",
"parameters": [
{
"type": "boolean",
"description": "Active obligation only",
"name": "active",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -791,6 +800,17 @@ const docTemplate = `{
],
"summary": "Create new user",
"operationId": "CreateUser",
"parameters": [
{
"description": "User to create",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.UserInput"
}
}
],
"responses": {
"201": {
"description": "Created",
Expand Down Expand Up @@ -1149,6 +1169,76 @@ const docTemplate = `{
}
}
},
"models.LicenseUpdate": {
"type": "object",
"properties": {
"marydone": {
"type": "boolean"
},
"rf_FSFfree": {
"type": "boolean"
},
"rf_Fedora": {
"type": "string"
},
"rf_GPLv2compatible": {
"type": "boolean"
},
"rf_GPLv3compatible": {
"type": "boolean"
},
"rf_OSIapproved": {
"type": "boolean"
},
"rf_active": {
"type": "boolean"
},
"rf_add_date": {
"type": "string",
"example": "2023-12-01T18:10:25.00+05:30"
},
"rf_copyleft": {
"type": "boolean"
},
"rf_detector_type": {
"type": "integer",
"example": 1
},
"rf_flag": {
"type": "integer",
"example": 1
},
"rf_fullname": {
"type": "string",
"example": "MIT License"
},
"rf_notes": {
"type": "string",
"example": "This license has been superseded."
},
"rf_risk": {
"type": "integer"
},
"rf_source": {
"type": "string"
},
"rf_spdx_id": {
"type": "string",
"example": "MIT"
},
"rf_text": {
"type": "string",
"example": "MIT License Text here"
},
"rf_text_updatable": {
"type": "boolean"
},
"rf_url": {
"type": "string",
"example": "https://opensource.org/licenses/MIT"
}
}
},
"models.Obligation": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1373,25 +1463,46 @@ const docTemplate = `{
"models.User": {
"type": "object",
"required": [
"password",
"userlevel",
"username",
"userpassword"
"username"
],
"properties": {
"id": {
"type": "integer",
"example": 123
},
"password": {
"type": "string"
},
"userlevel": {
"type": "string",
"example": "admin"
},
"username": {
"type": "string",
"example": "fossy"
},
"userpassword": {
}
}
},
"models.UserInput": {
"type": "object",
"required": [
"password",
"userlevel",
"username"
],
"properties": {
"password": {
"type": "string"
},
"userlevel": {
"type": "string",
"example": "admin"
},
"username": {
"type": "string",
"example": "fossy"
}
}
},
Expand Down
123 changes: 117 additions & 6 deletions cmd/laas/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@
"required": true
},
{
"description": "Update license body",
"description": "Update license body (requires only the fields to be updated)",
"name": "license",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LicenseDB"
"$ref": "#/definitions/models.LicenseUpdate"
}
}
],
Expand Down Expand Up @@ -473,6 +473,15 @@
],
"summary": "Get all active obligations",
"operationId": "GetAllObligation",
"parameters": [
{
"type": "boolean",
"description": "Active obligation only",
"name": "active",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -785,6 +794,17 @@
],
"summary": "Create new user",
"operationId": "CreateUser",
"parameters": [
{
"description": "User to create",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.UserInput"
}
}
],
"responses": {
"201": {
"description": "Created",
Expand Down Expand Up @@ -1143,6 +1163,76 @@
}
}
},
"models.LicenseUpdate": {
"type": "object",
"properties": {
"marydone": {
"type": "boolean"
},
"rf_FSFfree": {
"type": "boolean"
},
"rf_Fedora": {
"type": "string"
},
"rf_GPLv2compatible": {
"type": "boolean"
},
"rf_GPLv3compatible": {
"type": "boolean"
},
"rf_OSIapproved": {
"type": "boolean"
},
"rf_active": {
"type": "boolean"
},
"rf_add_date": {
"type": "string",
"example": "2023-12-01T18:10:25.00+05:30"
},
"rf_copyleft": {
"type": "boolean"
},
"rf_detector_type": {
"type": "integer",
"example": 1
},
"rf_flag": {
"type": "integer",
"example": 1
},
"rf_fullname": {
"type": "string",
"example": "MIT License"
},
"rf_notes": {
"type": "string",
"example": "This license has been superseded."
},
"rf_risk": {
"type": "integer"
},
"rf_source": {
"type": "string"
},
"rf_spdx_id": {
"type": "string",
"example": "MIT"
},
"rf_text": {
"type": "string",
"example": "MIT License Text here"
},
"rf_text_updatable": {
"type": "boolean"
},
"rf_url": {
"type": "string",
"example": "https://opensource.org/licenses/MIT"
}
}
},
"models.Obligation": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1367,25 +1457,46 @@
"models.User": {
"type": "object",
"required": [
"password",
"userlevel",
"username",
"userpassword"
"username"
],
"properties": {
"id": {
"type": "integer",
"example": 123
},
"password": {
"type": "string"
},
"userlevel": {
"type": "string",
"example": "admin"
},
"username": {
"type": "string",
"example": "fossy"
},
"userpassword": {
}
}
},
"models.UserInput": {
"type": "object",
"required": [
"password",
"userlevel",
"username"
],
"properties": {
"password": {
"type": "string"
},
"userlevel": {
"type": "string",
"example": "admin"
},
"username": {
"type": "string",
"example": "fossy"
}
}
},
Expand Down
Loading