Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/1217.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generate docs using @scalar/api-reference instead of redoc-cli
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ tests/e2e_regression/**/rpc-cache/
/logs

# API files.
index.html
api/spec/v1.html
api/spec/v1.json

# Coverage reports.
Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,9 @@ lint-go-mod-tidy:

lint: $(lint-targets)

# Documentation
docs-targets := docs-api

# Documentation preview
docs-api:
@npx redoc-cli build api/spec/v1.yaml -o api/spec/v1.html

docs: $(docs-targets)
@npx serve ./api/spec/

start-docker:
@docker compose up --remove-orphans
Expand Down Expand Up @@ -241,5 +237,4 @@ release-build: codegen-go
fetch-git \
release-tag \
$(lint-targets) lint \
$(docs-targets) docs \
run
68 changes: 68 additions & 0 deletions api/spec/v1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

<script
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.40.0/dist/browser/standalone.js"
integrity="sha256-6/qUfYX/AQu0WFPRVWGXdoDc7eKERmgweLT8mEjm89U="
crossorigin="anonymous"
></script>

<style>
/* Big performance improvement */
.section-container {
contain: paint layout;
content-visibility: auto;
contain-intrinsic-size: 100px 600px;
}
.sidebar-indent-nested {
contain: paint layout;
content-visibility: auto;
contain-intrinsic-size: 100px 32px;
}
.hljs > span {
contain: paint layout;
content-visibility: auto;
contain-intrinsic-size: 16px 16px;
}
.scalar-code-block {
contain: paint layout;
content-visibility: auto;
contain-intrinsic-size: 100px 600px;
}

/* Clutters "Test Request" UI */
.request-section-content-headers, .request-section-content-cookies {
display: none;
}
</style>
</head>
<body>
<div id="app"></div>

<script>
(async () => {
const spec = await (await fetch('./v1.yaml')).text()
Scalar.createApiReference('#app', {
content: spec,
proxyUrl: undefined,
withDefaultFonts: false,
telemetry: false,
hideModels: true, // It clutters sidebar
defaultHttpClient: {
targetKey: 'js',
clientKey: 'fetch',
},
// Don't want to show these clients first on the list, but can not
// merely move them lower. Have to disable them.
hiddenClients: {
ruby: ['native'],
php: ['curl', 'guzzle'],
node: ['undici'],
},
})
})()
</script>
</body>
</html>
9 changes: 0 additions & 9 deletions docker/nexus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ RUN \

############

FROM node:18-slim AS openapi-builder

COPY api/spec /api/spec
WORKDIR /
RUN npx redoc-cli build api/spec/v1.yaml -o api/spec/v1.html

############

FROM golang:1.25-trixie AS nexus

WORKDIR /nexus
Expand All @@ -29,6 +21,5 @@ RUN apt-get update -q -q && \

COPY --from=nexus-builder /code/go/nexus /usr/local/bin/nexus
COPY --from=nexus-builder /code/go/ /nexus
COPY --from=openapi-builder /api/spec/v1.html api/spec/v1.html

ENTRYPOINT ["nexus"]
Loading