Skip to content

Commit

Permalink
feat(SPV-793): prepare common way for generating swagger for search e…
Browse files Browse the repository at this point in the history
…ndpoints (#678)
  • Loading branch information
dorzepowski authored Aug 28, 2024
1 parent f2cf688 commit 193c652
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 118 deletions.
7 changes: 4 additions & 3 deletions actions/access_keys/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ func (a *Action) oldSearch(c *gin.Context) {
// @Description Search access key
// @Tags Access-key
// @Produce json
// @Param PageParams query swagger.PageParams false "Supports options for pagination and sorting to streamline data exploration and analysis"
// @Param MetadataParams query swagger.MetadataParams false "Supports targeted resource searches with metadata"
// @Param AccessKeyParams query swagger.AccessKeyParams false "Supports targeted resource searches with filters"
// @Param SwaggerCommonParams query swagger.CommonFilteringQueryParams false "Supports options for pagination and sorting to streamline data exploration and analysis"
// @Param AccessKeyParams query filter.AccessKeyFilter false "Supports targeted resource searches with filters"
// @Param revokedRange[from] query string false "Specifies the start time of the range to query by date of revoking" format(date-time) example:"2024-02-26T11:01:28Z"`
// @Param revokedRange[to] query string false "Specifies the end time of the range to query by date of revoking" format(date-time) example:"2024-02-26T11:01:28Z"`
// @Success 200 {object} response.PageModel[response.AccessKey] "List of access keys"
// @Failure 400 "Bad request - Error while SearchAccessKeys from request query"
// @Failure 500 "Internal server error - Error while searching for access keys"
Expand Down
88 changes: 53 additions & 35 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,14 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"default": "desc",
"example": "desc",
"name": "order",
"in": "query"
},
{
"type": "integer",
"default": 1,
"example": 2,
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 50,
"example": 5,
"name": "size",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[from]",
"in": "query"
},
{
"type": "string",
"default": "created_at",
"example": "id",
"name": "sortBy",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[to]",
"in": "query"
},
{
Expand All @@ -69,50 +53,62 @@ const docTemplate = `{
"metadata[key]=value",
"metadata[key2]=value2"
],
"description": "Metadata is a list of key-value pairs that can be used to filter the results. !ATTENTION! Unfortunately this parameter won't work from swagger UI.",
"name": "metadata",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[from]",
"name": "order",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[to]",
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "boolean",
"default": false,
"example": true,
"name": "includeDeleted",
"type": "integer",
"name": "size",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "revokedRange[from]",
"name": "sortBy",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "revokedRange[to]",
"name": "updatedRange[from]",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "updatedRange[from]",
"name": "updatedRange[to]",
"in": "query"
},
{
"type": "boolean",
"default": false,
"example": true,
"description": "IncludeDeleted is a flag whether or not to include deleted items in the search results",
"name": "includeDeleted",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "updatedRange[to]",
"format": "date-time",
"description": "Specifies the start time of the range to query by date of revoking",
"name": "revokedRange[from]",
"in": "query"
},
{
"type": "string",
"format": "date-time",
"description": "Specifies the end time of the range to query by date of revoking",
"name": "revokedRange[to]",
"in": "query"
}
],
Expand Down Expand Up @@ -5593,6 +5589,17 @@ const docTemplate = `{
1000000,
1000000000,
60000000000,
3600000000000,
1,
1000,
1000000,
1000000000,
60000000000,
1,
1000,
1000000,
1000000000,
60000000000,
3600000000000
],
"x-enum-varnames": [
Expand All @@ -5611,6 +5618,17 @@ const docTemplate = `{
"Millisecond",
"Second",
"Minute",
"Hour",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour"
]
},
Expand Down
88 changes: 53 additions & 35 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,14 @@
"parameters": [
{
"type": "string",
"default": "desc",
"example": "desc",
"name": "order",
"in": "query"
},
{
"type": "integer",
"default": 1,
"example": 2,
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 50,
"example": 5,
"name": "size",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[from]",
"in": "query"
},
{
"type": "string",
"default": "created_at",
"example": "id",
"name": "sortBy",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[to]",
"in": "query"
},
{
Expand All @@ -60,50 +44,62 @@
"metadata[key]=value",
"metadata[key2]=value2"
],
"description": "Metadata is a list of key-value pairs that can be used to filter the results. !ATTENTION! Unfortunately this parameter won't work from swagger UI.",
"name": "metadata",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[from]",
"name": "order",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "createdRange[to]",
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "boolean",
"default": false,
"example": true,
"name": "includeDeleted",
"type": "integer",
"name": "size",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "revokedRange[from]",
"name": "sortBy",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "revokedRange[to]",
"name": "updatedRange[from]",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "updatedRange[from]",
"name": "updatedRange[to]",
"in": "query"
},
{
"type": "boolean",
"default": false,
"example": true,
"description": "IncludeDeleted is a flag whether or not to include deleted items in the search results",
"name": "includeDeleted",
"in": "query"
},
{
"type": "string",
"example": "2024-02-26T11:01:28Z",
"name": "updatedRange[to]",
"format": "date-time",
"description": "Specifies the start time of the range to query by date of revoking",
"name": "revokedRange[from]",
"in": "query"
},
{
"type": "string",
"format": "date-time",
"description": "Specifies the end time of the range to query by date of revoking",
"name": "revokedRange[to]",
"in": "query"
}
],
Expand Down Expand Up @@ -5584,6 +5580,17 @@
1000000,
1000000000,
60000000000,
3600000000000,
1,
1000,
1000000,
1000000000,
60000000000,
1,
1000,
1000000,
1000000000,
60000000000,
3600000000000
],
"x-enum-varnames": [
Expand All @@ -5602,6 +5609,17 @@
"Millisecond",
"Second",
"Minute",
"Hour",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Nanosecond",
"Microsecond",
"Millisecond",
"Second",
"Minute",
"Hour"
]
},
Expand Down
Loading

0 comments on commit 193c652

Please sign in to comment.