openapi: Add /search/packages route to the openapi schema

The request is similar to a depsolve request, it must include the
distribution and architecture. It can optionally include a list of
repositories to search, but if they are not included it searches the
default repos for the distro:arch

Related: RHEL-60136
This commit is contained in:
Brian C. Lane 2025-01-24 14:07:23 -08:00 committed by Tomáš Hozza
parent bd55670dd9
commit 234e8a09eb
2 changed files with 353 additions and 188 deletions

View file

@ -441,6 +441,50 @@ paths:
schema:
$ref: '#/components/schemas/Error'
/search/packages:
post:
operationId: postSearchPackages
summary: Search for detailed information on a list of package names
security:
- Bearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SearchPackagesRequest'
responses:
'200':
description: Search response with package details
content:
application/json:
schema:
$ref: '#/components/schemas/SearchPackagesResponse'
'400':
description: Invalid search request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Auth token is invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Unauthorized to perform operation
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Unexpected error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/errors/{id}:
get:
operationId: getError
@ -2287,6 +2331,71 @@ components:
$ref: '#/components/schemas/PackageMetadata'
description: 'Package list including NEVRA'
SearchPackagesRequest:
additionalProperties: false
required:
- packages
- distribution
- architecture
properties:
repositories:
type: array
items:
$ref: '#/components/schemas/Repository'
distribution:
type: string
example: 'rhel-8'
architecture:
type: string
example: 'x86_64'
packages:
type: array
description: |
Array of package names to search for. Supports * wildcards for
names, but not for versions.
items:
type: string
SearchPackagesResponse:
type: object
required:
- packages
properties:
packages:
type: array
items:
$ref: '#/components/schemas/PackageDetails'
description: 'Detailed package information from DNF'
PackageDetails:
type: object
required:
- name
- version
- release
- arch
properties:
name:
type: string
summary:
type: string
description:
type: string
url:
type: string
version:
type: string
release:
type: string
epoch:
type: string
arch:
type: string
buildtime:
type: string
license:
type: string
parameters:
page:
name: page