Include all Kava grpc-gateway and legacy endpoints to Swagger (#1157)

* Add ibc swagger fetch in Makefile proto-update-deps

* Update third_party proto files

* Update swagger to include all Kava modules and IBC

* Add api url to swagger config

* Remove old swagger-ui directory

* Add cleaned legacy-swagger.yml

* Remove cosmos endpoints from legacy swagger

* Remove invalid values, add legacy-swagger to merge config

* Remove unused definitions

* Fix legacy swagger type errors

* Clean up mismatch names, deprecate legacy endpoints

* Remove separate incentive-legacy-swagger.yml

* Update title

* Include legacy in title

* Re-build swagger conf with updated title
This commit is contained in:
Derrick Lee 2022-02-04 09:58:35 -08:00 committed by GitHub
parent 699dca8913
commit 1ccaf2ef06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 51609 additions and 8283 deletions

View File

@ -201,6 +201,7 @@ proto-update-deps:
mkdir -p client/docs
cp $(COSMOS_SDK_PATH)/client/docs/swagger-ui/swagger.yaml client/docs/cosmos-swagger.yml
cp $(IBC_GO_PATH)/docs/client/swagger-ui/swagger.yaml client/docs/ibc-go-swagger.yml
mkdir -p $(COSMOS_PROTO_TYPES)
cp $(COSMOS_PROTO_PATH)/cosmos.proto $(COSMOS_PROTO_TYPES)/cosmos.proto
@ -209,7 +210,7 @@ proto-update-deps:
rsync -r --chmod 644 --include "*.proto" --include='*/' --exclude='*' $(TENDERMINT_PATH)/proto third_party
rsync -r --chmod 644 --include "*.proto" --include='*/' --exclude='*' $(COSMOS_SDK_PATH)/proto third_party
rsync -r --chmod 644 --include "*.proto" --include='*/' --exclude='*' $(IBC_GO_PATH)/proto third_party
rsync -r --chmod 644 --include "*.proto" --include='*/' --exclude='*' $(IBC_GO_PATH)/third_party/proto/confio third_party/proto
rsync -r --chmod 644 --include "*.proto" --include='*/' --exclude='*' $(IBC_GO_PATH)/third_party/proto/proofs.proto third_party/proto
.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps

View File

@ -1,16 +1,24 @@
{
"swagger": "2.0",
"info": {
"title": "Kava - gRPC Gateway docs",
"title": "Kava - Legacy REST and gRPC Gateway docs",
"description": "A REST interface for state queries",
"version": "1.0.0"
},
"externalDocs": {
"description": "GitHub",
"url": "https://github.com/Kava-Labs/kava"
},
"host": "api.data.kava.io",
"schemes": [
"https"
],
"apis": [
{
"url": "./tmp-swagger-gen/kava/cdp/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/kava/auction/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Cdp"
"Query": "Auction"
}
},
"operationIds": {
@ -18,24 +26,7 @@
{
"type": "regex",
"from": "(.*)",
"to": "Cdp$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/kavadist/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "KavaDist"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "KavaDist$1"
"to": "Auction$1"
}
]
}
@ -44,7 +35,7 @@
"url": "./tmp-swagger-gen/kava/bep3/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Bep3"
"Query": "BEP3"
}
},
"operationIds": {
@ -52,7 +43,92 @@
{
"type": "regex",
"from": "(.*)",
"to": "Bep3$1"
"to": "BEP3$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/cdp/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "CDP"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "CDP$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/committee/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Committee"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Committee$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/hard/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Hard"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Hard$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/issuance/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Issuance"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Issuance$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/kavadist/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Kavadist"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Kavadist$1"
}
]
}
@ -96,13 +172,44 @@
"dereference": {
"circular": "ignore"
},
"tags": {
"rename": {
"Gaia REST": "KAVA Rest",
"Query": "Cosmos SDK"
}
},
"paths": {
"exclude": [
"^/cosmos/authz/.*",
"^/cosmos/feegrant/.*"
]
}
},
{
"url": "./client/docs/ibc-go-swagger.yml",
"dereference": {
"circular": "ignore"
},
"tags": {
"rename": {
"Query": "IBC"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Ibc$1"
}
]
}
},
{
"url": "./client/docs/legacy-swagger.yml",
"dereference": {
"circular": "ignore"
}
}
]
}

13961
client/docs/ibc-go-swagger.yml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

View File

@ -1,60 +0,0 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "./swagger.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
// End Swagger UI call region
window.ui = ui;
};
</script>
</body>
</html>

View File

@ -1,75 +0,0 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};
isValid = qp.state === sentState;
if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
window.addEventListener('DOMContentLoaded', function () {
run();
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,6 @@ option go_package = "github.com/cosmos/ibc-go/modules/core/02-client/types";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "ibc/core/client/v1/client.proto";
// Msg defines the ibc/client Msg service.
service Msg {

View File

@ -5,7 +5,7 @@ package ibc.core.commitment.v1;
option go_package = "github.com/cosmos/ibc-go/modules/core/23-commitment/types";
import "gogoproto/gogo.proto";
import "confio/proofs.proto";
import "proofs.proto";
// MerkleRoot defines a merkle root hash.
// In the Cosmos SDK, the AppHash of a block header becomes the root.

View File

@ -6,7 +6,7 @@ option go_package = "github.com/cosmos/ibc-go/modules/light-clients/07-tendermin
import "tendermint/types/validator.proto";
import "tendermint/types/types.proto";
import "confio/proofs.proto";
import "proofs.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "ibc/core/client/v1/client.proto";