-
Notifications
You must be signed in to change notification settings - Fork 115
Swagger api #140
Swagger api #140
Changes from 25 commits
054b8fb
024e4fa
713f848
612b22f
9fec150
d88812f
81cb8d4
05a1ccb
9cfafda
04f2127
3637fdb
8fdbab1
df9f3db
ba3e3f6
434275e
5aa0444
5059062
1aa80b0
603e4f1
ec9a2e6
3b60395
62b2a65
5379653
29d8205
28972ab
8fc4d79
9c41b1f
674d12c
1244675
d1f0458
2c3620d
93d4307
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
openapi: "3.0.0" | ||
|
||
info: | ||
version: "0.1" | ||
title: Scorex Node API example | ||
description: API docs for example Scorex project. | ||
contact: | ||
name: Scorex framework Team | ||
email: kushi@protonmail.com | ||
url: https://github.com/scorexfoundation/scorex | ||
license: | ||
name: CC0 1.0 Universal | ||
url: https://raw.githubusercontent.com/ScorexFoundation/Scorex/master/COPYING | ||
|
||
components: | ||
schemas: | ||
# Objects | ||
ModifierId: | ||
description: Base58-encoded 32 byte modifier id | ||
type: object | ||
required: | ||
- modifierId | ||
properties: | ||
modifierId: | ||
type: string | ||
example: D2bXMwWN8P9nWJ9qqwZJLauAdcZHX9n6s91QQ9vK6Zu4 | ||
|
||
Digest32: | ||
description: Base58-encoded 32 byte digest | ||
type: object | ||
required: | ||
- digest | ||
properties: | ||
digest: | ||
type: string | ||
example: FjX5cPuwMc2ocDLPWzt6jq29BXjvU6d5w5XURDJ6dmoM | ||
Peer: | ||
type: object | ||
required: | ||
- address | ||
properties: | ||
address: | ||
type: string | ||
example: 127.0.0.1:5673 | ||
name: | ||
type: string | ||
example: mynode | ||
nonce: | ||
type: integer | ||
# int32 | ||
format: int64 | ||
example: 123456 | ||
lastSeen: | ||
type: integer | ||
# int32 | ||
format: int64 | ||
example: 123456 | ||
|
||
|
||
paths: | ||
|
||
/peers/all: | ||
get: | ||
summary: Get all known peers | ||
operationId: getAllPeers | ||
tags: | ||
- peers | ||
responses: | ||
200: | ||
description: Array of peer objects | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Peer' | ||
|
||
/peers/connected: | ||
get: | ||
summary: Get current connected peers | ||
operationId: getConnectedPeers | ||
tags: | ||
- peers | ||
responses: | ||
200: | ||
description: Array of peer objects | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Peer' | ||
|
||
/peers/connect: | ||
post: | ||
summary: Get current size of the unconfirmed transactions pool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the correct summary for this path? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ceilican I think nope. I fixed this one here https://github.com/ergoplatform/ergo/pull/108/files#diff-f11bc37099101a6156775fbde1871902R712 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your fix seems good to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ceilican But it was done in ergo repository =) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know. I think it should be done here (in Scorex, in this PR) too. And I wonder if it would be possible/desirable, in the future (in another PR), to reduce code and documentation duplication at the api level between scorex('s example) and ergo. It seems to me that right now duplication is only avoided at the network layer. All other layers remain completely abstract in Scorex's core and need to be (re-)implemented, possibly in similar ways, by every blockchain system built with Scorex. Perhaps, in the future, Scorex could provide some standard api routes/paths already pre-implemented. @Daron666, is ergo's api significantly different from the api of scorex's example? @kushti, should we include the api into the scope of that architecture review that we have discussed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ceilican Ergo's api is a superset over scorex api. |
||
operationId: connectToPeer | ||
tags: | ||
- peers | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: string | ||
example: 127.0.0.1:5673 | ||
responses: | ||
200: | ||
description: Attempt to connect to the peer | ||
default: | ||
description: Error | ||
content: | ||
application/json: | ||
schema: | ||
type: string | ||
enum: | ||
- invalid.peer.address | ||
- invalid.json | ||
|
||
/peers/blacklisted: | ||
get: | ||
summary: Get blacklisted peers | ||
operationId: getBlacklistedPeers | ||
tags: | ||
- peers | ||
responses: | ||
200: | ||
description: Array of peer objects | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Peer' | ||
|
||
/utils/seed: | ||
get: | ||
summary: Get random seed with 32 bytes size | ||
operationId: getRandomSeed | ||
tags: | ||
- utils | ||
responses: | ||
200: | ||
description: Base58-encoded 32 byte seed | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: 7yaASMijGEGTbttYHg1MrXnWB8EbzjJnFLSWvmNoHrXV | ||
|
||
/utils/seed/{length}: | ||
get: | ||
summary: Generate random seed of specified length in bytes | ||
operationId: getRandomSeedWithLength | ||
tags: | ||
- utils | ||
parameters: | ||
- in: path | ||
name: length | ||
required: true | ||
description: seed length in bytes | ||
schema: | ||
type: string | ||
responses: | ||
200: | ||
description: Base58-encoded N byte seed | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: 7yaASMijGEGTbttYHg1MrXnWB8EbzjJnFLSWvmNoHrXV | ||
|
||
/utils/hash/blake2b: | ||
post: | ||
summary: Return Blake2b hash of specified message | ||
operationId: hashBlake2b | ||
tags: | ||
- utils | ||
requestBody: | ||
required: true | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: 7yaASMijGEGTbttYHg1MrXnWB8EbzjJnFLSWvmNoHrXV | ||
responses: | ||
200: | ||
description: Base58-encoded 32 byte hash | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: 6QLZkR1RdHvF7gUw7oms1XdQM6kc9kxpmyHRADN5x7uQ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this summary correct?