Skip to content

Commit

Permalink
Merge components file into dapp and dispatcher
Browse files Browse the repository at this point in the history
We are making this modification because the library that we are using
for the Python example DApp does not properly support referencing other
yaml files. See spec-first/connexion#967.
  • Loading branch information
gligneul committed Dec 29, 2021
1 parent 916e83b commit 95d5bcb
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 85 deletions.
69 changes: 0 additions & 69 deletions components.yaml

This file was deleted.

84 changes: 78 additions & 6 deletions dapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0

info:
title: Cartesi HTTP DApp API
version: 0.1.0
version: 0.1.1
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
Expand All @@ -28,9 +28,9 @@ paths:
type: object
properties:
metadata:
$ref: 'components.yaml#/Metadata'
$ref: '#/components/schemas/Metadata'
payload:
$ref: 'components.yaml#/Payload'
$ref: '#/components/schemas/Payload'

responses:
'202':
Expand All @@ -41,7 +41,7 @@ paths:
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

/inspect/{payload}:
get:
Expand Down Expand Up @@ -71,11 +71,83 @@ paths:
reports:
type: array
items:
$ref: 'components.yaml#/Report'
$ref: '#/components/schemas/Report'

default:
description: Error response
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

components:
schemas:
Id:
type: integer
format: uint64
description: Identifier encoded as integer.
example: 123

Index:
type: integer
format: uint64
description: Position in the Merkle tree.
example: 123

Payload:
type: string
description: |
Payload in the Ethereum hex binary format.
The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.
For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.
example: '0xdeadbeef'

Timestamp:
type: integer
format: uint64
description: Unix timestamp in milliseconds.
example: 1609459200000

Address:
type: string
description: Ethereum address.
example: '0x1111111111111111111111111111111111111111'

Metadata:
type: object
properties:
address:
$ref: '#/components/schemas/Address'
epoch_number:
$ref: '#/components/schemas/Id'
input_number:
$ref: '#/components/schemas/Id'
block_number:
$ref: '#/components/schemas/Id'
timestamp:
$ref: '#/components/schemas/Timestamp'

Voucher:
type: object
properties:
address:
$ref: '#/components/schemas/Address'
payload:
$ref: '#/components/schemas/Payload'

Notice:
type: object
properties:
payload:
$ref: '#/components/schemas/Payload'

Report:
type: object
properties:
payload:
$ref: '#/components/schemas/Payload'

Error:
type: string
description: Detailed error message.
example: "The request could not be understood by the server due to malformed syntax"
92 changes: 82 additions & 10 deletions dispatcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0

info:
title: Cartesi HTTP Dispatcher API
version: 0.1.0
version: 0.1.1
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
Expand All @@ -29,7 +29,7 @@ paths:
content:
application/json:
schema:
$ref: 'components.yaml#/Voucher'
$ref: '#/components/schemas/Voucher'

responses:
'201':
Expand All @@ -40,14 +40,14 @@ paths:
type: object
properties:
index:
$ref: 'components.yaml#/Index'
$ref: '#/components/schemas/Index'

default:
description: Error response.
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

/notice:
post:
Expand All @@ -67,7 +67,7 @@ paths:
content:
application/json:
schema:
$ref: 'components.yaml#/Notice'
$ref: '#/components/schemas/Notice'

responses:
'201':
Expand All @@ -78,14 +78,14 @@ paths:
type: object
properties:
index:
$ref: 'components.yaml#/Index'
$ref: '#/components/schemas/Index'

default:
description: Error response.
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

/report:
post:
Expand All @@ -102,7 +102,7 @@ paths:
content:
application/json:
schema:
$ref: 'components.yaml#/Report'
$ref: '#/components/schemas/Report'

responses:
'201':
Expand All @@ -113,7 +113,7 @@ paths:
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

/finish:
post:
Expand Down Expand Up @@ -149,4 +149,76 @@ paths:
content:
text/plain:
schema:
$ref: 'components.yaml#/Error'
$ref: '#/components/schemas/Error'

components:
schemas:
Id:
type: integer
format: uint64
description: Identifier encoded as integer.
example: 123

Index:
type: integer
format: uint64
description: Position in the Merkle tree.
example: 123

Payload:
type: string
description: |
Payload in the Ethereum hex binary format.
The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.
For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.
example: '0xdeadbeef'

Timestamp:
type: integer
format: uint64
description: Unix timestamp in milliseconds.
example: 1609459200000

Address:
type: string
description: Ethereum address.
example: '0x1111111111111111111111111111111111111111'

Metadata:
type: object
properties:
address:
$ref: '#/components/schemas/Address'
epoch_number:
$ref: '#/components/schemas/Id'
input_number:
$ref: '#/components/schemas/Id'
block_number:
$ref: '#/components/schemas/Id'
timestamp:
$ref: '#/components/schemas/Timestamp'

Voucher:
type: object
properties:
address:
$ref: '#/components/schemas/Address'
payload:
$ref: '#/components/schemas/Payload'

Notice:
type: object
properties:
payload:
$ref: '#/components/schemas/Payload'

Report:
type: object
properties:
payload:
$ref: '#/components/schemas/Payload'

Error:
type: string
description: Detailed error message.
example: "The request could not be understood by the server due to malformed syntax"

0 comments on commit 95d5bcb

Please sign in to comment.