Skip to content

Commit

Permalink
Merge pull request #392 from multiversx/swagger-ui-updates
Browse files Browse the repository at this point in the history
swagger ui updates
  • Loading branch information
bogdan-rosianu authored Jul 21, 2023
2 parents a5d9bc5 + f8b4f50 commit 8a0e5ce
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 44 deletions.
Binary file modified cmd/proxy/config/swagger/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmd/proxy/config/swagger/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion cmd/proxy/config/swagger/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<title>MultiversX Gateway</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
Expand Down
Binary file added cmd/proxy/config/swagger/mvx-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 55 additions & 41 deletions cmd/proxy/config/swagger/openapi.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"openapi": "3.0.3",
"info": {
"title": "MultiversX Proxy API",
"description": "## Welcome to the MultiversX Proxy API\n\nThe documentation describes the endpoints that are available on the mx-chain-proxy-go project. This is used on `gateway.multiversx.com` while the public api (`api.multiversx.com`) is a wrapper over it.\n\nThis API is organized around REST principles, so if you've interacted with RESTful APIs before, many of the concepts will look familiar.\n\n## Request / Response Format\n\nJSON will be returned for all responses, including errors. Empty or blank fields are omitted. Requests with a message body use JSON as well. Successful requests will return a `2xx` HTTP status.\n\nThe general structure of a response is:\n``` JSON\n{\n data anything\n error string\n code string\n}\n```\nWhere:\n- data: the expected result if the request was successful. `null` otherwise\n- error: if the request failed, the reason will be returned in this field. empty otherwise\n- code: the internal code for the request. can be `successful`, `internal_issue` or `bad_request`\n",
"title": "MultiversX Gateway API",
"description": "![MultiversX](/mvx-icon.png)\n\nThe documentation describes the endpoints that are available on the mx-chain-proxy-go project. \n\nGithub URL: `https://github.com/multiversx/mx-chain-proxy-go`\n\nThis is used on `gateway.multiversx.com` while the public api (`api.multiversx.com`) is a wrapper over it.\n\nThis API is organized around REST principles, so if you've interacted with RESTful APIs before, many of the concepts will look familiar.\n\n## Request / Response Format\n\nJSON will be returned for all responses, including errors. Empty or blank fields are omitted. Requests with a message body use JSON as well. Successful requests will return a `2xx` HTTP status.\n\nThe general structure of a response is:\n``` JSON\n{\n data anything\n error string\n code string\n}\n```\nWhere:\n- data: the expected result if the request was successful. `null` otherwise\n- error: if the request failed, the reason will be returned in this field. empty otherwise\n- code: the internal code for the request. can be `successful`, `internal_issue` or `bad_request`\n",
"version": "1.1.0"
},
"paths": {
Expand Down Expand Up @@ -2261,7 +2261,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Transaction"
"$ref": "#/components/schemas/TxStatusResponse"
}
}
}
Expand Down Expand Up @@ -2293,10 +2293,39 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"items": {
"$ref": "#/components/schemas/AddressEsdtToken"
}
"$ref": "#/components/schemas/TxStatusResponse"
}
}
}
}
}
}
},
"/transaction/{txhash}/process-status": {
"get": {
"tags": [
"transaction"
],
"summary": "returns the processing status of the transaction which corresponds to the hash. It searches for SCRs generated by the transaction and computes the actual processing status",
"parameters": [
{
"name": "txhash",
"in": "path",
"description": "the transaction hash to search for",
"required": true,
"schema": {
"type": "string",
"default": null
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TxStatusResponse"
}
}
}
Expand Down Expand Up @@ -2453,40 +2482,6 @@
}
}
},
"/transaction/{hash}/status": {
"get": {
"tags": [
"transaction"
],
"summary": "retrieves the status of the transaction with the provided hash",
"parameters": [
{
"name": "hash",
"in": "path",
"required": true,
"description": "the hash of the transaction to look after",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenericResponse"
}
}
}
},
"400": {
"description": "validation error"
}
}
}
},
"/validator/statistics": {
"get": {
"tags": [
Expand Down Expand Up @@ -3152,6 +3147,25 @@
}
}
},
"TxStatusResponse": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
},
"error": {
"type": "string"
},
"code": {
"type": "string"
}
}
},
"Guardian": {
"type": "object",
"properties": {
Expand Down
14 changes: 12 additions & 2 deletions cmd/proxy/config/swagger/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">

// Custom plugin to hide the API definition URL
const HideInfoUrlPartsPlugin = () => {
return {
wrapComponents: {
InfoUrl: () => () => null
}
}
}

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "openapi.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
SwaggerUIStandalonePreset.slice(1)
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
SwaggerUIBundle.plugins.DownloadUrl,
HideInfoUrlPartsPlugin
],
layout: "StandaloneLayout"
});
Expand Down

0 comments on commit 8a0e5ce

Please sign in to comment.