Skip to content

Commit

Permalink
feat(api7): allow mutliple uris in route (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 authored Oct 12, 2024
1 parent 569a17f commit 15d7bf6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'test/api7') || github.event_name == 'push'
strategy:
matrix:
version: [3.2.14.6, 3.2.15.0]
version: [3.2.14.6, 3.2.15.2, 3.2.16.2]
env:
BACKEND_API7_VERSION: ${{ matrix.version }}
BACKEND_API7_DOWNLOAD_URL: https://run.api7.ai/api7-ee/api7-ee-v${{ matrix.version }}.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions libs/backend-api7/e2e/sync-and-dump-1.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ describe('Sync and Dump - 1', () => {
const route1Name = 'route1';
const route1 = {
name: route1Name,
uris: ['/route1'],
uris: ['/route1', '/route1-2'],
priority: 100,
} as ADCSDK.Route;
const route2Name = 'route2';
const route2 = {
name: route2Name,
uris: ['/route2'],
uris: ['/route2', '/route2-2'],
plugins: {
'key-auth': {},
},
Expand Down
4 changes: 2 additions & 2 deletions libs/backend-api7/src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ToADC {

public transformRoute(route: typing.Route): ADCSDK.Route {
return ADCSDK.utils.recursiveOmitUndefined<ADCSDK.Route>({
uris: route?.paths?.[0] ? [route?.paths?.[0]] : undefined,
uris: route.paths,
name: route.name,
description: route.desc,
labels: ToADC.transformLabels(route.labels),
Expand Down Expand Up @@ -144,7 +144,7 @@ export class FromADC {
enable_websocket: route.enable_websocket,
plugins: route.plugins,
service_id: serviceId,
paths: [route.uris[0]],
paths: route.uris,
priority: route.priority,
});
}
Expand Down
2 changes: 1 addition & 1 deletion libs/backend-api7/src/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface Route {
plugins?: Plugins;

// matcher
paths?: Array<string>;
paths: Array<string>;
methods?: Array<string>;

// misc
Expand Down

0 comments on commit 15d7bf6

Please sign in to comment.