Skip to content

Commit

Permalink
refactor: api for listing modules in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-hm19 committed Nov 13, 2024
1 parent 1801acc commit 7b81454
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 366 deletions.
101 changes: 8 additions & 93 deletions api/openapispec/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ const docTemplate = `{
],
"summary": "List module",
"operationId": "listModule",
"parameters": [
{
"type": "integer",
"description": "Workspace ID to filter module list by. Default to all workspaces.",
"name": "workspaceID",
"in": "query"
}
],
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -364,59 +372,6 @@ const docTemplate = `{
}
}
},
"/api/v1/modules/workspace/{id}": {
"get": {
"description": "List module information in the specified workspace",
"produces": [
"application/json"
],
"tags": [
"module"
],
"summary": "List modules in the workspace",
"operationId": "listWorkspaceModule",
"parameters": [
{
"type": "integer",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.ModuleWithVersion"
}
}
},
"400": {
"description": "Bad Request",
"schema": {}
},
"401": {
"description": "Unauthorized",
"schema": {}
},
"404": {
"description": "Not Found",
"schema": {}
},
"429": {
"description": "Too Many Requests",
"schema": {}
},
"500": {
"description": "Internal Server Error",
"schema": {}
}
}
}
},
"/api/v1/modules/{name}": {
"get": {
"description": "Get module information by module name",
Expand Down Expand Up @@ -2415,46 +2370,6 @@ const docTemplate = `{
}
}
},
"entity.ModuleWithVersion": {
"type": "object",
"properties": {
"description": {
"description": "Description is a human-readable description of the module.",
"type": "string"
},
"doc": {
"description": "Doc is the documentation URL of the module.",
"allOf": [
{
"$ref": "#/definitions/url.URL"
}
]
},
"name": {
"description": "Name is the module name.",
"type": "string"
},
"owners": {
"description": "Owners is a list of owners for the module.",
"type": "array",
"items": {
"type": "string"
}
},
"url": {
"description": "URL is the module oci artifact registry URL.",
"allOf": [
{
"$ref": "#/definitions/url.URL"
}
]
},
"version": {
"description": "Version is the module oci artifact version.",
"type": "string"
}
}
},
"entity.Organization": {
"type": "object",
"properties": {
Expand Down
101 changes: 8 additions & 93 deletions api/openapispec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@
],
"summary": "List module",
"operationId": "listModule",
"parameters": [
{
"type": "integer",
"description": "Workspace ID to filter module list by. Default to all workspaces.",
"name": "workspaceID",
"in": "query"
}
],
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -353,59 +361,6 @@
}
}
},
"/api/v1/modules/workspace/{id}": {
"get": {
"description": "List module information in the specified workspace",
"produces": [
"application/json"
],
"tags": [
"module"
],
"summary": "List modules in the workspace",
"operationId": "listWorkspaceModule",
"parameters": [
{
"type": "integer",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.ModuleWithVersion"
}
}
},
"400": {
"description": "Bad Request",
"schema": {}
},
"401": {
"description": "Unauthorized",
"schema": {}
},
"404": {
"description": "Not Found",
"schema": {}
},
"429": {
"description": "Too Many Requests",
"schema": {}
},
"500": {
"description": "Internal Server Error",
"schema": {}
}
}
}
},
"/api/v1/modules/{name}": {
"get": {
"description": "Get module information by module name",
Expand Down Expand Up @@ -2404,46 +2359,6 @@
}
}
},
"entity.ModuleWithVersion": {
"type": "object",
"properties": {
"description": {
"description": "Description is a human-readable description of the module.",
"type": "string"
},
"doc": {
"description": "Doc is the documentation URL of the module.",
"allOf": [
{
"$ref": "#/definitions/url.URL"
}
]
},
"name": {
"description": "Name is the module name.",
"type": "string"
},
"owners": {
"description": "Owners is a list of owners for the module.",
"type": "array",
"items": {
"type": "string"
}
},
"url": {
"description": "URL is the module oci artifact registry URL.",
"allOf": [
{
"$ref": "#/definitions/url.URL"
}
]
},
"version": {
"description": "Version is the module oci artifact version.",
"type": "string"
}
}
},
"entity.Organization": {
"type": "object",
"properties": {
Expand Down
67 changes: 5 additions & 62 deletions api/openapispec/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,6 @@ definitions:
- $ref: '#/definitions/url.URL'
description: URL is the module oci artifact registry URL.
type: object
entity.ModuleWithVersion:
properties:
description:
description: Description is a human-readable description of the module.
type: string
doc:
allOf:
- $ref: '#/definitions/url.URL'
description: Doc is the documentation URL of the module.
name:
description: Name is the module name.
type: string
owners:
description: Owners is a list of owners for the module.
items:
type: string
type: array
url:
allOf:
- $ref: '#/definitions/url.URL'
description: URL is the module oci artifact registry URL.
version:
description: Version is the module oci artifact version.
type: string
type: object
entity.Organization:
properties:
creationTimestamp:
Expand Down Expand Up @@ -1258,6 +1233,11 @@ paths:
get:
description: List module information
operationId: listModule
parameters:
- description: Workspace ID to filter module list by. Default to all workspaces.
in: query
name: workspaceID
type: integer
produces:
- application/json
responses:
Expand Down Expand Up @@ -1433,43 +1413,6 @@ paths:
summary: Update module
tags:
- module
/api/v1/modules/workspace/{id}:
get:
description: List module information in the specified workspace
operationId: listWorkspaceModule
parameters:
- description: Workspace ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: Success
schema:
items:
$ref: '#/definitions/entity.ModuleWithVersion'
type: array
"400":
description: Bad Request
schema: {}
"401":
description: Unauthorized
schema: {}
"404":
description: Not Found
schema: {}
"429":
description: Too Many Requests
schema: {}
"500":
description: Internal Server Error
schema: {}
summary: List modules in the workspace
tags:
- module
/api/v1/orgs:
get:
description: List all organizations
Expand Down
Loading

0 comments on commit 7b81454

Please sign in to comment.