Skip to content

Commit e144f02

Browse files
rohovskoitim-smart
andauthored
fix: scalar configuration and types (#5759)
Co-authored-by: Tim Smart <[email protected]>
1 parent fe2792a commit e144f02

File tree

2 files changed

+31
-37
lines changed

2 files changed

+31
-37
lines changed

.changeset/smooth-readers-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@effect/platform": patch
3+
---
4+
5+
fix scalar configuration and types

packages/platform/src/HttpApiScalar.ts

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ export type ScalarThemeId =
2323
| "purple"
2424
| "solarized"
2525
| "bluePlanet"
26-
| "deepSpace"
2726
| "saturn"
2827
| "kepler"
2928
| "mars"
29+
| "deepSpace"
30+
| "laserwave"
3031
| "none"
3132

3233
/**
@@ -41,9 +42,7 @@ export type ScalarConfig = {
4142
/** The layout to use for the references */
4243
layout?: "modern" | "classic"
4344
/** URL to a request proxy for the API client */
44-
proxy?: string
45-
/** Whether the spec input should show */
46-
isEditable?: boolean
45+
proxyUrl?: string
4746
/** Whether to show the sidebar */
4847
showSidebar?: boolean
4948
/**
@@ -52,12 +51,6 @@ export type ScalarConfig = {
5251
* Default: `false`
5352
*/
5453
hideModels?: boolean
55-
/**
56-
* Whether to show the “Download OpenAPI Document” button
57-
*
58-
* Default: `false`
59-
*/
60-
hideDownloadButton?: boolean
6154
/**
6255
* Whether to show the “Test Request” button
6356
*
@@ -124,7 +117,7 @@ const makeHandler = (options: {
124117
const source = options?.source
125118

126119
const scalarConfig = {
127-
_integration: "http",
120+
_integration: "html",
128121
...options?.scalar
129122
}
130123

@@ -175,20 +168,18 @@ export const layer = (options?: {
175168
readonly path?: `/${string}` | undefined
176169
readonly scalar?: ScalarConfig
177170
}): Layer.Layer<never, never, Api> =>
178-
Router.use((router) =>
179-
Effect.gen(function*() {
180-
const { api } = yield* Api
181-
const handler = makeHandler({
182-
...options,
183-
api,
184-
source: {
185-
_tag: "Inline",
186-
source: internal.javascript
187-
}
188-
})
189-
yield* router.get(options?.path ?? "/docs", handler)
171+
Router.use(Effect.fnUntraced(function*(router) {
172+
const { api } = yield* Api
173+
const handler = makeHandler({
174+
...options,
175+
api,
176+
source: {
177+
_tag: "Inline",
178+
source: internal.javascript
179+
}
190180
})
191-
)
181+
yield* router.get(options?.path ?? "/docs", handler)
182+
}))
192183

193184
/**
194185
* @since 1.0.0
@@ -199,20 +190,18 @@ export const layerCdn = (options?: {
199190
readonly scalar?: ScalarConfig
200191
readonly version?: string | undefined
201192
}): Layer.Layer<never, never, Api> =>
202-
Router.use((router) =>
203-
Effect.gen(function*() {
204-
const { api } = yield* Api
205-
const handler = makeHandler({
206-
...options,
207-
api,
208-
source: {
209-
_tag: "Cdn",
210-
version: options?.version
211-
}
212-
})
213-
yield* router.get(options?.path ?? "/docs", handler)
193+
Router.use(Effect.fnUntraced(function*(router) {
194+
const { api } = yield* Api
195+
const handler = makeHandler({
196+
...options,
197+
api,
198+
source: {
199+
_tag: "Cdn",
200+
version: options?.version
201+
}
214202
})
215-
)
203+
yield* router.get(options?.path ?? "/docs", handler)
204+
}))
216205

217206
/**
218207
* @since 1.0.0

0 commit comments

Comments
 (0)