Skip to content

Commit cf5ce50

Browse files
authored
Update openapi version and swagger UI (#113)
1 parent 1bbe1e2 commit cf5ce50

18 files changed

+57
-155
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
package*json
3+
deploy

apis/builder/blinded_blocks.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ post:
5151
description: Success response.
5252
headers:
5353
Eth-Consensus-Version:
54-
$ref: "../../beacon-apis/beacon-node-oapi.yaml#/components/headers/Eth-Consensus-Version"
54+
$ref: "../../builder-oapi.yaml#/components/headers/Eth-Consensus-Version"
5555
required: false
5656
content:
5757
application/json:
@@ -86,11 +86,10 @@ post:
8686
content:
8787
application/json:
8888
schema:
89-
allOf:
90-
- $ref: "../../builder-oapi.yaml#/components/schemas/ErrorMessage"
91-
- example:
92-
code: 400
93-
message: "Invalid block: missing signature"
89+
$ref: "../../builder-oapi.yaml#/components/schemas/ErrorMessage"
90+
example:
91+
code: 400
92+
message: "Invalid block: missing signature"
9493
"406":
9594
$ref: "../../builder-oapi.yaml#/components/responses/NotAcceptable"
9695
"415":

apis/builder/validators.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ post:
3030
content:
3131
application/json:
3232
schema:
33-
allOf:
34-
- $ref: "../../builder-oapi.yaml#/components/schemas/ErrorMessage"
35-
- example:
36-
code: 400
37-
message: "unknown validator"
33+
$ref: "../../builder-oapi.yaml#/components/schemas/ErrorMessage"
34+
example:
35+
code: 400
36+
message: "unknown validator"
3837
"500":
3938
$ref: "../../builder-oapi.yaml#/components/responses/InternalError"

builder-oapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: "3.0.3"
1+
openapi: "3.1.0"
22

33
info:
44
title: Builder API

dist/oauth2-redirect.html

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!doctype html>
22
<html lang="en-US">
3-
<title>Swagger UI: OAuth2 Redirect</title>
4-
<body onload="run()">
5-
</body>
6-
</html>
3+
<head>
4+
<title>Swagger UI: OAuth2 Redirect</title>
5+
</head>
6+
<body>
77
<script>
88
'use strict';
99
function run () {
@@ -13,31 +13,32 @@
1313
var isValid, qp, arr;
1414

1515
if (/code|token|error/.test(window.location.hash)) {
16-
qp = window.location.hash.substring(1);
16+
qp = window.location.hash.substring(1).replace('?', '&');
1717
} else {
1818
qp = location.search.substring(1);
1919
}
2020

21-
arr = qp.split("&")
22-
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
21+
arr = qp.split("&");
22+
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
2323
qp = qp ? JSON.parse('{' + arr.join() + '}',
2424
function (key, value) {
25-
return key === "" ? value : decodeURIComponent(value)
25+
return key === "" ? value : decodeURIComponent(value);
2626
}
27-
) : {}
27+
) : {};
2828

29-
isValid = qp.state === sentState
29+
isValid = qp.state === sentState;
3030

3131
if ((
32-
oauth2.auth.schema.get("flow") === "accessCode"||
33-
oauth2.auth.schema.get("flow") === "authorizationCode"
32+
oauth2.auth.schema.get("flow") === "accessCode" ||
33+
oauth2.auth.schema.get("flow") === "authorizationCode" ||
34+
oauth2.auth.schema.get("flow") === "authorization_code"
3435
) && !oauth2.auth.code) {
3536
if (!isValid) {
3637
oauth2.errCb({
3738
authId: oauth2.auth.name,
3839
source: "auth",
3940
level: "warning",
40-
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
41+
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
4142
});
4243
}
4344

@@ -46,7 +47,7 @@
4647
oauth2.auth.code = qp.code;
4748
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
4849
} else {
49-
let oauthErrorMsg
50+
let oauthErrorMsg;
5051
if (qp.error) {
5152
oauthErrorMsg = "["+qp.error+"]: " +
5253
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
@@ -57,12 +58,22 @@
5758
authId: oauth2.auth.name,
5859
source: "auth",
5960
level: "error",
60-
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
61+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
6162
});
6263
}
6364
} else {
6465
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
6566
}
6667
window.close();
6768
}
69+
70+
if (document.readyState !== 'loading') {
71+
run();
72+
} else {
73+
document.addEventListener('DOMContentLoaded', function () {
74+
run();
75+
});
76+
}
6877
</script>
78+
</body>
79+
</html>

dist/swagger-ui-bundle.js

Lines changed: 2 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-es-bundle-core.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-es-bundle-core.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-es-bundle.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)