From e5ad3f07dae07ffd3964b20b9ad632cf8bad0572 Mon Sep 17 00:00:00 2001 From: Mauricio Perdomo Date: Mon, 25 Feb 2019 09:52:12 -0500 Subject: [PATCH 1/6] [mauricio1802] mauricio1802_specs Create mauricio1802_specs.yml file --- mauricio1802_specs.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mauricio1802_specs.yml diff --git a/mauricio1802_specs.yml b/mauricio1802_specs.yml new file mode 100644 index 0000000..e69de29 From dcc923212fc74fce4a7dc5c827b8dc46c396c06e Mon Sep 17 00:00:00 2001 From: Mauricio Perdomo Date: Tue, 26 Feb 2019 11:00:05 -0500 Subject: [PATCH 2/6] [mauricio1802] mauricio1802_specs Add spec for issue 8 --- mauricio1802_specs.yml | 93 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/mauricio1802_specs.yml b/mauricio1802_specs.yml index e69de29..4170e0f 100644 --- a/mauricio1802_specs.yml +++ b/mauricio1802_specs.yml @@ -0,0 +1,93 @@ +openapi: 3.0.0 +info: + title: Python to .Net + description: Still whitout description. + version: 0.25.1 +servers: +- url: http://www.skycoin.net + description: Main Skycoin server +- url: http://staging.node.skycoin.net + description: Internal staging server for developer. +components: + securitySchemes: + CsrfTokenAuth: # arbitrary name for the security scheme + type: apiKey + in: header # can be "header", "query" or "cookie" + name: X-CSRF-TOKEN # name of the header, query parameter or cookie + schemas: + genericError: + description: This is a generic error that should be default response + type: object + properties: + code: + type: integer + format: int64 + message: + type: string + + + +paths: + /api/transactions/single: #issue 8 + post: + summary: Build single transaction + description: Build not signed single transaction if was't builded before + + security: + - CsrfTokenAuth: [] + + requestBody: + required: true + description: Transaction object + content: + application/json: + schema: + description: Object representing the transaction + type: object + properties: + operationId: + description: Operation ID + type: string + fromAddress: + type: string + description: Source address + toAddress: + type: string + description: Destination address + assetId: + type: string + description: Asset ID to transfer + includeFee: + type: boolean + description: Ignored. No Fiber coin implements this ... yet + amount: + type: string + description: Amount to transfer. Integer as string, aligned to the asset accuracy. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy) + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + + ErrorCode: + description: Error Code + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + + transactionContext: + description: The transaction context which will be passed to the [POST] /api/sign + type: string + + default: + $ref : '#/components/schemas/genericError' + +# To remember : +# Every post method should use security schema. +# Feel free to use and reuse components +# I think, at some point, someone should use oneOf and anyOf, pls take a look From 53e214d299831b3b31d40c78bdeb7fe46034a0d1 Mon Sep 17 00:00:00 2001 From: Mauricio Perdomo Date: Tue, 26 Feb 2019 12:49:53 -0500 Subject: [PATCH 3/6] [balances] refs #9 - Add spec for [GET] /api/balances --- mauricio1802_specs.yml | 74 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/mauricio1802_specs.yml b/mauricio1802_specs.yml index 4170e0f..aeb1cb0 100644 --- a/mauricio1802_specs.yml +++ b/mauricio1802_specs.yml @@ -30,8 +30,8 @@ components: paths: /api/transactions/single: #issue 8 post: - summary: Build single transaction - description: Build not signed single transaction if was't builded before + summary: Build not signed single transaction + description: Should build not signed transaction to transfer from the single source to the single destination. If the transaction with the specified operationId has already been built by one of the [POST] /api/transactions/* call, it should be ignored and regular response (as in the first request) should be returned. security: - CsrfTokenAuth: [] @@ -63,7 +63,11 @@ paths: amount: type: string description: Amount to transfer. Integer as string, aligned to the asset accuracy. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy) - + + + + + responses: '200': # status code description: OK @@ -86,6 +90,70 @@ paths: default: $ref : '#/components/schemas/genericError' + + + /api/balances: #issue 9 + get: + summary: Return balance of the observed wallets + description: Should return balances of the observed wallets with non zero balances. Wallets balance observation is enabled by the [POST] /api/balances/{address}/observation and disabled by the [DELETE] /api/balances/{address}/observation. + parameters: + - name: take + in: query + required: true + schema: + type: integer + description: Limit amount of the returned values + - name: continuation + in: query + required: false + schema: + type: string + description: context of the previous request + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + isValid: + description: Indicate if the address is valid + type: boolean + + continuation: + description: Continuation token + type: string + + items: + description: Current batch of items + type: array + items: + type: object + properties: + address: + description: Wallet address + type: string + assetId: + description: Asset ID + type: string + + balance: + description: Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy)Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy) + type: string + block: + description: Incremental ID of the moment, when balance is updated. It should be the same sequence as for block in the []GET] /api/transactions/broadcast/* responses + type: integer + + + + + default: + $ref : '#/components/schemas/genericError' + + + # To remember : # Every post method should use security schema. From 99f1732fb6150ab4506d3e83816257f28dec8931 Mon Sep 17 00:00:00 2001 From: Mauricio Perdomo Date: Tue, 26 Feb 2019 13:15:29 -0500 Subject: [PATCH 4/6] [transactions] refs #7 - Add spec for [POST] /api/transactions/many-inputs --- mauricio1802_specs.yml | 74 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/mauricio1802_specs.yml b/mauricio1802_specs.yml index aeb1cb0..bc2d7ab 100644 --- a/mauricio1802_specs.yml +++ b/mauricio1802_specs.yml @@ -92,7 +92,7 @@ paths: $ref : '#/components/schemas/genericError' - /api/balances: #issue 9 + /api/balances: get: summary: Return balance of the observed wallets description: Should return balances of the observed wallets with non zero balances. Wallets balance observation is enabled by the [POST] /api/balances/{address}/observation and disabled by the [DELETE] /api/balances/{address}/observation. @@ -143,7 +143,7 @@ paths: description: Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy)Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy) type: string block: - description: Incremental ID of the moment, when balance is updated. It should be the same sequence as for block in the []GET] /api/transactions/broadcast/* responses + description: Incremental ID of the moment, when balance is updated. It should be the same sequence as for block in the [GET] /api/transactions/broadcast/* responses type: integer @@ -151,7 +151,75 @@ paths: default: $ref : '#/components/schemas/genericError' - + + + /api/transaction/many-inputs: + post: + summary: Build not signed transactions with many inputs. + description: Should build not signed transaction with many inputs. If the transaction with the specified operationId has already been built by one of the [POST] /api/transactions/* call, it should be ignored + + security: + - CsrfTokenAuth: [] + + requestBody: + required: true + description: Transaction object + content: + application/json: + schema: + description: ewr + type: object + properties: + operationId: + description: Operation ID + type: string + + inputs: + description: Sources + type: array + items: + type: object + properties: + fromAddress: + description: Source Address + type: string + amount: + description: Amount to transfer from the fromAddress. Integer as string, aligned to the droplet precision exponent. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy). + type: string + + toAddress: + description: Destination Address + type: string + assetId: + description: Ticker ID of the fiber coin, SKY by default + type: string + + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + + ErrorCode: + description: Error Code + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + + transactionContext: + description: The transaction context which will be passed to the [POST] /api/sign + type: string + + default: + $ref : '#/components/schemas/genericError' + + + From edf6e10424807aee21168abaa1bffa6e21789e4c Mon Sep 17 00:00:00 2001 From: Mauricio Perdomo Date: Tue, 26 Feb 2019 13:22:00 -0500 Subject: [PATCH 5/6] [api] refs #4 - Add spec for [GET] /api/isalive --- mauricio1802_specs.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/mauricio1802_specs.yml b/mauricio1802_specs.yml index bc2d7ab..81ca257 100644 --- a/mauricio1802_specs.yml +++ b/mauricio1802_specs.yml @@ -219,7 +219,34 @@ paths: $ref : '#/components/schemas/genericError' - + /api/IsAlive: + get: + summary: Return some general service info + description: Check if the server is running correctly + responses: + '200': #status code + description: A JSON object containing information about the service + content: + application/json: + schema: + type: object + + properties: + name: + description: Name of the service + type: string + version: + description: Version of the service + type: string + env: + description: ENV_INFO environment variable value + type: string + isDebug: + description: Flag, wich indicates if the service is built in the debug configuration or not + type: boolean + + default: + $ref: '#/components/schemas/genericError' From 1e90daa234ca32750ed510e21d56d178a9730b95 Mon Sep 17 00:00:00 2001 From: "m.perdomo" Date: Thu, 28 Feb 2019 11:20:35 -0500 Subject: [PATCH 6/6] [spec] Update espec.yml file --- .github/pull_request_template.md | 0 espec.yml | 231 ++++++++++++++++++++++++++++++- 2 files changed, 230 insertions(+), 1 deletion(-) mode change 100755 => 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md old mode 100755 new mode 100644 diff --git a/espec.yml b/espec.yml index 90f96f5..81ca257 100644 --- a/espec.yml +++ b/espec.yml @@ -24,4 +24,233 @@ components: format: int64 message: type: string -paths: \ No newline at end of file + + + +paths: + /api/transactions/single: #issue 8 + post: + summary: Build not signed single transaction + description: Should build not signed transaction to transfer from the single source to the single destination. If the transaction with the specified operationId has already been built by one of the [POST] /api/transactions/* call, it should be ignored and regular response (as in the first request) should be returned. + + security: + - CsrfTokenAuth: [] + + requestBody: + required: true + description: Transaction object + content: + application/json: + schema: + description: Object representing the transaction + type: object + properties: + operationId: + description: Operation ID + type: string + fromAddress: + type: string + description: Source address + toAddress: + type: string + description: Destination address + assetId: + type: string + description: Asset ID to transfer + includeFee: + type: boolean + description: Ignored. No Fiber coin implements this ... yet + amount: + type: string + description: Amount to transfer. Integer as string, aligned to the asset accuracy. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy) + + + + + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + + ErrorCode: + description: Error Code + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + + transactionContext: + description: The transaction context which will be passed to the [POST] /api/sign + type: string + + default: + $ref : '#/components/schemas/genericError' + + + /api/balances: + get: + summary: Return balance of the observed wallets + description: Should return balances of the observed wallets with non zero balances. Wallets balance observation is enabled by the [POST] /api/balances/{address}/observation and disabled by the [DELETE] /api/balances/{address}/observation. + parameters: + - name: take + in: query + required: true + schema: + type: integer + description: Limit amount of the returned values + - name: continuation + in: query + required: false + schema: + type: string + description: context of the previous request + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + isValid: + description: Indicate if the address is valid + type: boolean + + continuation: + description: Continuation token + type: string + + items: + description: Current batch of items + type: array + items: + type: object + properties: + address: + description: Wallet address + type: string + assetId: + description: Asset ID + type: string + + balance: + description: Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy)Balance is integer as string, aligned to the asset accuracy. Actual value can be calculated as x = sourceBalance * (10 ^ asset.Accuracy) + type: string + block: + description: Incremental ID of the moment, when balance is updated. It should be the same sequence as for block in the [GET] /api/transactions/broadcast/* responses + type: integer + + + + + default: + $ref : '#/components/schemas/genericError' + + + /api/transaction/many-inputs: + post: + summary: Build not signed transactions with many inputs. + description: Should build not signed transaction with many inputs. If the transaction with the specified operationId has already been built by one of the [POST] /api/transactions/* call, it should be ignored + + security: + - CsrfTokenAuth: [] + + requestBody: + required: true + description: Transaction object + content: + application/json: + schema: + description: ewr + type: object + properties: + operationId: + description: Operation ID + type: string + + inputs: + description: Sources + type: array + items: + type: object + properties: + fromAddress: + description: Source Address + type: string + amount: + description: Amount to transfer from the fromAddress. Integer as string, aligned to the droplet precision exponent. Actual value can be calculated as x = amount / (10 ^ asset.Accuracy). + type: string + + toAddress: + description: Destination Address + type: string + assetId: + description: Ticker ID of the fiber coin, SKY by default + type: string + + + responses: + '200': # status code + description: OK + content: + application/json: + schema: + type: object + properties: + + ErrorCode: + description: Error Code + type: string + enum: + - amountIsTooSmall + - notEnoughBalance + + transactionContext: + description: The transaction context which will be passed to the [POST] /api/sign + type: string + + default: + $ref : '#/components/schemas/genericError' + + + /api/IsAlive: + get: + summary: Return some general service info + description: Check if the server is running correctly + responses: + '200': #status code + description: A JSON object containing information about the service + content: + application/json: + schema: + type: object + + properties: + name: + description: Name of the service + type: string + version: + description: Version of the service + type: string + env: + description: ENV_INFO environment variable value + type: string + isDebug: + description: Flag, wich indicates if the service is built in the debug configuration or not + type: boolean + + default: + $ref: '#/components/schemas/genericError' + + + +# To remember : +# Every post method should use security schema. +# Feel free to use and reuse components +# I think, at some point, someone should use oneOf and anyOf, pls take a look