Skip to content

Commit cb1961c

Browse files
feat: integrate Redocusaurus for interactive OFREP OpenAPI docs page (#1283)
Integrates Redocusaurus to display interactive OpenAPI documentation for OFREP. ## Changes - Added `redocusaurus` dependency and preset configuration - Added `scala` to Prism syntax highlighting (fixes OpenAPI spec rendering) - Added `docusaurus-theme-redoc` theme - Added custom CSS for full-width Redoc layout while preserving left navigation ## Features - Embedded OpenAPI viewer with left nav visible - Full-width layout for better API docs readability - Internal Redoc sidebar hidden (using theme config) - Search disabled in Redoc viewer ## Related PR Depends on: open-feature/spec#347 closes #1003 --------- Signed-off-by: Jonathan Norris <[email protected]>
1 parent 7bdf1c6 commit cb1961c

File tree

8 files changed

+692
-21
lines changed

8 files changed

+692
-21
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"label": "OFREP",
3+
"position": 2,
4+
"collapsible": true,
5+
"collapsed": false,
6+
"link": {
7+
"type": "doc",
8+
"id": "reference/other-technologies/ofrep/index"
9+
}
10+
}

docs/reference/other-technologies/ofrep.mdx renamed to docs/reference/other-technologies/ofrep/index.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
---
22
title: OpenFeature Remote Evaluation Protocol (OFREP)
3-
sidebar_label: OFREP
4-
sidebar_position: 2
5-
id: ofrep
3+
sidebar_position: 1
64
---
75

8-
The **OpenFeature Remote Evaluation Protocol (OFREP)** is an API specification for feature flagging that enables vendor-agnostic communication between applications and flag management systems. It defines a standard API layer between the provider and the flag management system, allowing any OpenSource or commercial system to implement the protocol and be compatible with community-maintained providers.
6+
The **OpenFeature Remote Evaluation Protocol (OFREP)** is an [API specification](./openapi) for feature flagging that enables vendor-agnostic communication between applications and flag management systems. It defines a standard API layer between the provider and the flag management system, allowing any OpenSource or commercial system to implement the protocol and be compatible with community-maintained providers.
97

108
### Key Benefits
119

1210
- **Vendor Agnostic**: Connect to any OFREP-compliant flag management system without vendor-specific implementations
13-
- **Standardized**: Built on a common OpenAPI specification for consistent integration
11+
- **Standardized**: Built on a [common OpenAPI specification](./openapi) for consistent integration
1412
- **Flexible**: Works on both client-side and server-side applications
1513
- **Community Maintained**: Generic OFREP providers maintained by the OpenFeature project
1614

@@ -29,7 +27,7 @@ graph LR
2927
1. Your application uses the OpenFeature SDK
3028
2. The OpenFeature SDK uses an OFREP provider
3129
3. The OFREP provider communicates with your flag management system via the standardized OFREP API
32-
4. Your flag management system implements the OFREP specification
30+
4. Your flag management system implements the [OFREP specification](./openapi)
3331

3432
### Server vs Client
3533

@@ -71,7 +69,7 @@ To create an OFREP provider for a new language:
7169

7270
To make your flag management system OFREP-compliant:
7371

74-
1. Implement the [OFREP OpenAPI specification](https://github.com/open-feature/protocol/blob/docs-update-readme-for-website/service/openapi.yaml)
72+
1. Implement the [OFREP OpenAPI specification](./openapi)
7573
2. Test your implementation with existing OFREP providers
7674
3. Register your system in the [OpenFeature ecosystem](https://github.com/open-feature/openfeature.dev/issues)
7775

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "OpenAPI Spec"
3+
sidebar_position: 2
4+
hide_title: true
5+
---
6+
7+
import Redoc from '@theme/Redoc';
8+
9+
<div className="redoc-container">
10+
<Redoc />
11+
</div>
12+

docusaurus.config.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = {
172172
},
173173
prism: {
174174
theme: themes.oceanicNext,
175-
additionalLanguages: ['java', 'csharp', 'powershell', 'php', 'kotlin', 'ruby', 'dart'],
175+
additionalLanguages: ['java', 'csharp', 'powershell', 'php', 'kotlin', 'ruby', 'dart', 'scala'],
176176
magicComments: [
177177
{
178178
className: 'theme-code-block-highlighted-line',
@@ -284,7 +284,31 @@ const config: Config = {
284284
},
285285
},
286286
],
287-
presets: [['classic', presetClassicOptions]],
287+
presets: [
288+
['classic', presetClassicOptions],
289+
[
290+
'redocusaurus',
291+
{
292+
specs: [
293+
{
294+
id: 'ofrep-api',
295+
spec: 'https://raw.githubusercontent.com/open-feature/protocol/refs/heads/main/service/openapi.yaml',
296+
},
297+
],
298+
theme: {
299+
primaryColor: '#1890ff',
300+
options: {
301+
disableSearch: true,
302+
theme: {
303+
sidebar: {
304+
width: '0px',
305+
},
306+
},
307+
},
308+
},
309+
},
310+
],
311+
],
288312
plugins: [
289313
async function tailwind() {
290314
return {
@@ -377,7 +401,7 @@ const config: Config = {
377401
markdown: {
378402
mermaid: true,
379403
},
380-
themes: ['@docusaurus/theme-mermaid'],
404+
themes: ['@docusaurus/theme-mermaid', 'docusaurus-theme-redoc'],
381405
};
382406

383407
export default config;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"react-instantsearch": "^7.15.8",
5858
"react-lite-youtube-embed": "^2.5.1",
5959
"react-transition-group": "^4.4.5",
60+
"redocusaurus": "^2.5.0",
6061
"rehype-github-alerts": "^4.1.1",
6162
"remark-gfm": "^4.0.1",
6263
"remarkable": "2.0.1",
@@ -72,8 +73,8 @@
7273
"@docusaurus/tsconfig": "^3.9.1",
7374
"@types/fs-extra": "11.0.4",
7475
"@types/react": "^19.1.6",
75-
"@typescript-eslint/parser": "8.35.1",
7676
"@typescript-eslint/eslint-plugin": "8.35.1",
77+
"@typescript-eslint/parser": "8.35.1",
7778
"eslint": "^8.57.0",
7879
"eslint-config-prettier": "10.1.5",
7980
"eslint-mdx": "3.6.0",

src/css/custom.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,34 @@ details[open] .mcp-install-summary strong::before {
333333
[data-theme='dark'] .mcp-install-button:hover {
334334
background-color: var(--ifm-color-primary-light);
335335
border-color: var(--ifm-color-primary-light);
336+
color: #fff;
337+
text-decoration: none;
338+
}
339+
340+
/* Full width Redoc API viewer */
341+
.redoc-container {
342+
margin: -2rem calc(-1 * var(--ifm-spacing-horizontal));
343+
max-width: none;
344+
}
345+
346+
/* Expand parent containers for full width */
347+
article:has(.redoc-container) {
348+
max-width: none !important;
349+
}
350+
351+
/* Force doc column to full width when Redoc is present */
352+
.main-wrapper:has(.redoc-container) [class*="docItemCol"] {
353+
max-width: none !important;
354+
flex-basis: 100% !important;
355+
}
356+
357+
/* Hide Redocly branding */
358+
.redocusaurus a[href*="redocly.com"],
359+
.redocusaurus [class*="powered-by"] {
360+
display: none !important;
361+
}
362+
363+
/* Hide menu border on API viewer pages */
364+
.redoc-container .menu-content {
365+
border-right: none !important;
336366
}

0 commit comments

Comments
 (0)