Skip to content

Commit 760eedf

Browse files
authored
Basepath in servers (#136)
1 parent 1702e52 commit 760eedf

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unleash/proxy",
3-
"version": "0.16.2",
3+
"version": "0.16.3",
44
"description": "The Unleash Proxy (Open-Source)",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -38,7 +38,7 @@
3838
},
3939
"homepage": "https://github.com/Unleash/unleash-proxy#readme",
4040
"dependencies": {
41-
"@unleash/express-openapi": "^0.2.1-beta.0",
41+
"@unleash/express-openapi": "^0.3.0",
4242
"compression": "^1.7.4",
4343
"cors": "^2.8.5",
4444
"express": "^4.18.2",

src/openapi/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { unleashContextSchema } from './spec/unleash-context-schema';
99
import { variantSchema } from './spec/variant-schema';
1010

1111
// Create the base OpenAPI schema, with everything except paths.
12+
1213
export const createOpenApiSchema = (
14+
serverUrl?: string,
1315
clientKeysHeaderName: string = 'Authorization',
1416
): Omit<OpenAPIV3.Document, 'paths'> => ({
1517
openapi: '3.0.3',
16-
servers: [],
18+
servers: serverUrl ? [{ url: serverUrl }] : [],
1719
info: {
1820
title: 'Unleash Proxy API',
1921
version: process.env.npm_package_version || '',

src/openapi/openapi-service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export class OpenApiService {
1414
this.config = config;
1515
this.api = openapi(
1616
this.docsPath(),
17-
createOpenApiSchema(config.clientKeysHeaderName),
17+
createOpenApiSchema(
18+
config.proxyBasePath,
19+
config.clientKeysHeaderName,
20+
),
1821
{ coerce: true },
1922
);
2023
}

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1054,10 +1054,10 @@
10541054
"@typescript-eslint/types" "5.22.0"
10551055
eslint-visitor-keys "^3.0.0"
10561056

1057-
"@unleash/express-openapi@^0.2.1-beta.0":
1058-
version "0.2.1-beta.0"
1059-
resolved "https://registry.yarnpkg.com/@unleash/express-openapi/-/express-openapi-0.2.1-beta.0.tgz#1f5f43c6eb46c490990dc3e4709ab23a48a24e9a"
1060-
integrity sha512-72pNESnWyIvsLZaYjaBHwPXzO361up/A1tA/Mv+eG1MkntRJMNhRSgPzPvoP5j7pCxKeXqu1FRfXTXLRzGo+HA==
1057+
"@unleash/express-openapi@^0.3.0":
1058+
version "0.3.0"
1059+
resolved "https://registry.yarnpkg.com/@unleash/express-openapi/-/express-openapi-0.3.0.tgz#3d65aeafc265732cf83c57b1d18452b5d0904856"
1060+
integrity sha512-rcbRNoL689knbemaTbL17FOb94hagr5T/vUUUZ1Fb107SGlBbOoQErf0tHlWpeCs6ffkM6uxo5BUnOAaf6CYDA==
10611061
dependencies:
10621062
ajv "^6.10.2"
10631063
http-errors "^1.7.3"

0 commit comments

Comments
 (0)