doc(api): document la route pour publier et les contraintes sur le modèle

This commit is contained in:
2022-11-26 11:59:56 +01:00
parent f549ba8b35
commit f8e81801dc

View File

@@ -11,6 +11,11 @@ paths:
get: get:
summary: List all available packages summary: List all available packages
parameters: parameters:
- in: query
name: search
schema:
type: string
required: false
- in: query - in: query
name: limit name: limit
schema: schema:
@@ -59,7 +64,7 @@ paths:
description: Invalid package name description: Invalid package name
/api/version/{package}/{version}: /api/version/{package}/{version}:
get: get:
summary: Get a download url summary: Get version metadata
parameters: parameters:
- name: package - name: package
in: path in: path
@@ -75,14 +80,36 @@ paths:
type: string type: string
responses: responses:
200: 200:
description: The download url description: Version metadata
content: content:
application/json: application/json:
schema: schema:
type: string $ref: '#/components/schemas/PackageVersion'
example: packages/l/linked-list_1.3.zip
400: 400:
description: Invalid package name or version description: Invalid package name or version
/api/publish:
post:
summary: Publish a new version of a package
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
manifest:
$ref: '#/components/schemas/PackageManifest'
description: The package manifest for this version
package:
type: string
format: binary
description: The version content with an application/zip Content-Type
responses:
201:
description: The version has been created
400:
description: Invalid manifest or version content
409:
description: The version already exists
components: components:
schemas: schemas:
@@ -92,9 +119,17 @@ components:
short_name: short_name:
type: string type: string
example: linked-list example: linked-list
maxLength: 64
pattern: '^[a-z0-9_-]+$'
description: description:
type: string type: string
example: Implementation of an int linked list data structure in C example: Implementation of an int linked list data structure in C
dependencies:
type: object
additionalProperties:
type: string
example:
malloc: ^1.0.0
PackageDetails: PackageDetails:
allOf: allOf:
- $ref: '#/components/schemas/Package' - $ref: '#/components/schemas/Package'
@@ -104,6 +139,14 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/PackageVersion' $ref: '#/components/schemas/PackageVersion'
PackageManifest:
allOf:
- $ref: '#/components/schemas/Package'
- type: object
properties:
version:
type: string
example: 1.2.3
PackageVersion: PackageVersion:
type: object type: object
properties: properties: