Skip to content

Commit

Permalink
Merge pull request #60 from hyperledger-labs/refactor/swagger
Browse files Browse the repository at this point in the history
Update swagger to use gateway endpoints
  • Loading branch information
andremacedopv authored Mar 7, 2024
2 parents c26deec + 6106497 commit 94a866d
Showing 1 changed file with 200 additions and 11 deletions.
211 changes: 200 additions & 11 deletions ccapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ servers:
tags:
- name: Basic Operations
paths:
/invoke/{txName}:
/gateway/{channelName}/{chaincodeName}/invoke/{txname}:
post:
tags:
- Basic Operations
summary: Executes transaction txName and writes the result to the blockchain.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
- in: path
name: txName
schema:
Expand All @@ -34,12 +46,24 @@ paths:
5XX:
description: Internal error

/query/{txName}:
/gateway/{channelName}/{chaincodeName}/query/{txname}:
post:
tags:
- Basic Operations
summary: Executes transaction txName and returns only the result, without writing it to the blockchain.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
- in: path
name: txName
schema:
Expand All @@ -60,22 +84,52 @@ paths:
5XX:
description: Internal error

/query/getHeader:
/gateway/{channelName}/{chaincodeName}/query/getHeader:
get:
tags:
- Basic Operations
summary: Retrieves information about the chaincode.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
responses:
"200":
description: OK
5XX:
description: Internal error.

/query/getTx:
/gateway/{channelName}/{chaincodeName}/query/getTx:
get:
tags:
- Basic Operations
summary: Requests the list of defined transactions.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
responses:
"200":
description: OK
Expand All @@ -85,6 +139,21 @@ paths:
tags:
- Basic Operations
summary: Gets the description of a specific transaction.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
description: The txName field must contain the name of a transaction defined by the chaincode.
content:
Expand All @@ -106,11 +175,26 @@ paths:
5XX:
description: Internal error

/query/getSchema:
/gateway/{channelName}/{chaincodeName}/query/getSchema:
get:
tags:
- Basic Operations
summary: Searches the list of existing assets.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
responses:
"200":
description: OK
Expand All @@ -120,6 +204,21 @@ paths:
tags:
- Basic Operations
summary: Gets the description of a specific asset type.
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
description: The assetType must contain an asset type defined by the chaincode.
content:
Expand All @@ -141,11 +240,26 @@ paths:
5XX:
description: Internal error

/invoke/createAsset:
/gateway/{channelName}/{chaincodeName}/invoke/createAsset:
post:
tags:
- Basic Operations
summary: Create asset on the blockchain
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
description: The asset must be an array of objects. Each object must contain the asset type in the @assetType field and the asset data in the other fields.
content:
Expand Down Expand Up @@ -176,11 +290,26 @@ paths:
5XX:
description: Internal error

/query/readAsset:
/gateway/{channelName}/{chaincodeName}/query/readAsset:
post:
tags:
- Basic Operations
summary: "Reads an asset from the blockchain using its primary key."
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
content:
application/json:
Expand All @@ -204,11 +333,26 @@ paths:
5XX:
description: Internal error

/query/readAssetHistory:
/gateway/{channelName}/{chaincodeName}/query/readAssetHistory:
post:
tags:
- Basic Operations
summary: "Reads the history of an asset from the blockchain using its primary key."
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
content:
application/json:
Expand All @@ -232,11 +376,26 @@ paths:
5XX:
description: Internal error

/query/search:
/gateway/{channelName}/{chaincodeName}/query/search:
post:
tags:
- Basic Operations
summary: Searches the blockchain world state using CouchDB rich queries
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
description: "Query JSON as defined by CouchDB docs: https://docs.couchdb.org/en/stable/api/database/find.html"
requestBody:
required: true
Expand Down Expand Up @@ -283,11 +442,26 @@ paths:
5XX:
description: Internal error

/invoke/updateAsset:
/gateway/{channelName}/{chaincodeName}/invoke/updateAsset:
put:
tags:
- Basic Operations
summary: Updates an existing asset
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
content:
application/json:
Expand Down Expand Up @@ -316,11 +490,26 @@ paths:
5XX:
description: Internal error

/invoke/deleteAsset:
/gateway/{channelName}/{chaincodeName}/invoke/deleteAsset:
delete:
tags:
- Basic Operations
summary: Deletes an existing asset
parameters:
- in: path
name: channelName
schema:
type: string
required: true
description: Name of the channel.
example: "mainchannel"
- in: path
name: chaincodeName
schema:
type: string
required: true
description: Name of the chaincode in channel.
example: "cc-tools-demo"
requestBody:
content:
application/json:
Expand Down

0 comments on commit 94a866d

Please sign in to comment.