Skip to content

Commit

Permalink
feat: openapi for application management
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Dec 4, 2023
1 parent 997e270 commit 36df0ba
Showing 1 changed file with 204 additions and 0 deletions.
204 changes: 204 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
openapi: 3.0.0
info:
title: Cartesi Rollups Node Management API
description: |-
This is a management API for the Cartesi Rollups Node. It allows to dinamically add and remove applications managed by the node, or query the list of managed applications.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
tags:
- name: applications
description: Cartesi applications
paths:
/applications:
get:
tags:
- applications
summary: Fetches list of applications managed by the node
description: List of managed applications
operationId: getApplications
parameters:
- name: status
in: query
description: Filter by application status
schema:
type: string
enum:
- started
- starting
- stopping
- stopped
- name: offset
in: query
description: Items to skip for pagination
required: false
schema:
type: integer
minimum: 0
default: 0
- name: limit
in: query
description: Maximum number of items per page
required: false
schema:
type: integer
minimum: 1
default: 100
responses:
"200":
description: Success
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/PaginatedResult"
- type: object
properties:
results:
type: array
items:
$ref: "#/components/schemas/Application"
/applications/{address}:
get:
tags:
- applications
summary: Find application by address
description: Returns a single application by its address
operationId: getApplicationByAddress
parameters:
- name: address
in: path
description: Address of application to return
required: true
schema:
type: string
format: address
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/Application"
"400":
description: Invalid address supplied
"404":
description: Application not found
put:
tags:
- applications
summary: Adds an application
description: Adds an application by its address
operationId: addApplication
parameters:
- name: address
in: path
description: Application address
required: true
schema:
type: string
format: address
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
requestBody:
$ref: "#/components/requestBodies/Application"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/Application"
delete:
tags:
- applications
summary: Deletes an application
description: delete an application
operationId: deleteApplication
parameters:
- name: address
in: path
description: Application address to delete
required: true
schema:
type: string
format: address
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
responses:
"202":
description: Delete request accepted
"400":
description: Invalid address value
"404":
description: Application not found
components:
schemas:
PaginatedResult:
type: object
properties:
total_count:
type: integer
offset:
type: integer
limit:
type: integer
data:
type: array
items: {}
Application:
required:
- address
- blockNumber
- templateHash
- snapshotUrl
type: object
properties:
address:
type: string
format: address
example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
pattern: "^0x([0-9a-fA-F]{40})$"
blockNumber:
type: integer
example: 456311
templateHash:
type: string
format: hash
pattern: "^([0-9a-fA-F]{64})$"
example: "9a8d6ce861c71b592c236013b5c3fa167501431def4ad86ff59a3b12aa331dfc"
snapshotUrl:
type: string
format: url
status:
type: string
description: application status
enum:
- started
- starting
- stopping
- stopped
- error
requestBodies:
Application:
description: Application to be added to the node
required: true
content:
application/json:
schema:
type: object
properties:
blockNumber:
type: integer
example: 456311
templateHash:
type: string
format: hash
pattern: "^([0-9a-fA-F]{64})$"
example: "9a8d6ce861c71b592c236013b5c3fa167501431def4ad86ff59a3b12aa331dfc"
snapshotUrl:
type: string
format: url

0 comments on commit 36df0ba

Please sign in to comment.