Skip to content

Commit 6310e15

Browse files
authored
[FEEDS-0] Add Feeds v3 to the Swagger UI docs (#2135)
2 parents 7de54bb + c175241 commit 6310e15

6 files changed

Lines changed: 91 additions & 1 deletion

File tree

‎docs/dist/feeds-v3-note.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// The Feeds v3 spec is generated into openapi/v2/ because v2 is the version of
2+
// the spec generator, not the Feeds product. Show a note above the spec title
3+
// so readers aren't misled by the path.
4+
window.FeedsV3NotePlugin = function () {
5+
return {
6+
wrapComponents: {
7+
info: (Original, system) => (props) => {
8+
const React = system.React;
9+
const original = React.createElement(Original, props);
10+
if (!/\/openapi\/v2\/feeds-/.test(system.specSelectors.url())) {
11+
return original;
12+
}
13+
return React.createElement(
14+
'div',
15+
null,
16+
React.createElement(
17+
'div',
18+
{ className: 'feeds-v3-note' },
19+
React.createElement('strong', null, 'Feeds v3 API. '),
20+
'This spec lives under ',
21+
React.createElement('code', null, 'openapi/v2/'),
22+
' because v2 is the version of the OpenAPI spec, not the Feeds ' +
23+
'product version.',
24+
),
25+
original,
26+
);
27+
},
28+
},
29+
};
30+
};

‎docs/dist/index.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ body {
1414
margin: 0;
1515
background: #fafafa;
1616
}
17+
18+
.feeds-v3-note {
19+
margin: 0 0 16px;
20+
padding: 10px 14px;
21+
border-left: 4px solid #4990e2;
22+
background: #eaf3fd;
23+
font-family: sans-serif;
24+
font-size: 14px;
25+
color: #3b4151;
26+
}

‎docs/dist/swagger-initializer.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ window.onload = function () {
2121
name: 'Moderation v2',
2222
url: 'https://raw.githubusercontent.com/GetStream/protocol/main/openapi/v2/moderation-serverside-api.yaml',
2323
},
24+
{
25+
name: 'Feeds v3',
26+
url: 'https://raw.githubusercontent.com/GetStream/protocol/main/openapi/v2/feeds-serverside-api.yaml',
27+
},
2428
],
2529
dom_id: '#swagger-ui',
2630
deepLinking: true,
2731
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
28-
plugins: [SwaggerUIBundle.plugins.DownloadUrl],
32+
plugins: [SwaggerUIBundle.plugins.DownloadUrl, FeedsV3NotePlugin],
2933
layout: 'StandaloneLayout',
3034
});
3135
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
window.onload = function () {
2+
window.ui = SwaggerUIBundle({
3+
url: 'https://raw.githubusercontent.com/GetStream/protocol/main/openapi/v2/feeds-serverside-api.yaml',
4+
dom_id: '#swagger-ui',
5+
deepLinking: true,
6+
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
7+
plugins: [SwaggerUIBundle.plugins.DownloadUrl, FeedsV3NotePlugin],
8+
layout: 'StandaloneLayout',
9+
});
10+
};

‎docs/feeds_v2_openapi.html‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!-- HTML for static distribution bundle build -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8" />
6+
<title>Swagger UI</title>
7+
<link rel="stylesheet" type="text/css" href="dist/swagger-ui.css" />
8+
<link rel="stylesheet" type="text/css" href="dist/index.css" />
9+
<link
10+
data-react-helmet="true"
11+
rel="icon"
12+
type="image/png"
13+
sizes="32x32"
14+
href="dist/favicon-32x32.png"
15+
/>
16+
<link
17+
data-react-helmet="true"
18+
rel="icon"
19+
type="image/png"
20+
sizes="96x96"
21+
href="dist/favicon-96x96.png"
22+
/>
23+
</head>
24+
25+
<body>
26+
<div id="swagger-ui"></div>
27+
<script src="dist/swagger-ui-bundle.js" charset="UTF-8"></script>
28+
<script src="dist/swagger-ui-standalone-preset.js" charset="UTF-8"></script>
29+
<script src="dist/feeds-v3-note.js" charset="UTF-8"></script>
30+
<script
31+
src="dist/swagger-initializer_feeds_v2.js"
32+
charset="UTF-8"
33+
></script>
34+
</body>
35+
</html>

‎docs/index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<div id="swagger-ui"></div>
1515
<script src="dist/swagger-ui-bundle.js" charset="UTF-8"> </script>
1616
<script src="dist/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
17+
<script src="dist/feeds-v3-note.js" charset="UTF-8"> </script>
1718
<script src="dist/swagger-initializer.js" charset="UTF-8"> </script>
1819
</body>
1920
</html>

0 commit comments

Comments
 (0)