Skip to content

Commit e4889c1

Browse files
committed
fix: dynamic linter ruler
1 parent 3a2e83a commit e4889c1

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ services:
1313
- PHP_VERSION=${PHP_VERSION}
1414
- PYTHON_VERSION=${PYTHON_VERSION}
1515
command: tail -f /dev/null
16-
volumes: [ ./:/app ]
17-
# ports:
18-
# - "5009:5009" # So we can debug the OpenAPI Generator process
16+
volumes: [./:/app]
17+
# ports:
18+
# - "5009:5009" # So we can debug the OpenAPI Generator process
1919

2020
ruby:
2121
container_name: apic_ruby
@@ -27,7 +27,7 @@ services:
2727
- NODE_VERSION=${NODE_VERSION}
2828
- RUBY_VERSION=${RUBY_VERSION}
2929
command: tail -f /dev/null
30-
volumes: [ ./:/app ]
30+
volumes: [./:/app]
3131

3232
swift:
3333
container_name: apic_swift
@@ -39,4 +39,4 @@ services:
3939
- NODE_VERSION=${NODE_VERSION}
4040
- SWIFT_VERSION=${SWIFT_VERSION}
4141
command: tail -f /dev/null
42-
volumes: [ ./:/app ]
42+
volumes: [./:/app]

eslint/src/rules/refCommon.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,7 @@ import { createRule } from 'eslint-plugin-yml/lib/utils';
33

44
import { isPairWithKey, isScalar } from '../utils.js';
55

6-
const allSpecs = [
7-
'abtesting',
8-
'analytics',
9-
'crawler',
10-
'ingestion',
11-
'insights',
12-
'monitoring',
13-
'personalization',
14-
'query-suggestions',
15-
'recommend',
16-
'search',
17-
];
6+
import clientsConfig from '../../../config/clients.config.json' with { type: 'json' };
187

198
export const refCommon = createRule('refCommon', {
209
meta: {
@@ -58,7 +47,13 @@ export const refCommon = createRule('refCommon', {
5847
while (ref.startsWith('../')) {
5948
ref = ref.slice(3);
6049
}
61-
if (allSpecs.filter((s) => s !== spec).every((s) => !ref.startsWith(s))) {
50+
51+
if (clientsConfig.javascript.clients.filter((s) => s.name !== spec).every((s) => !ref.startsWith(s.name))) {
52+
return;
53+
}
54+
55+
// it's expected for composition to import the full version
56+
if (spec === 'composition' && ref.includes('composition-full')) {
6257
return;
6358
}
6459

scripts/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const LANGUAGES = [...new Set(Object.values(GENERATORS).map((gen) => gen.
7373

7474
// `crawler` is manually added so we can still bundled and validate the specs
7575
// the entry can be removed once at least one client is generated
76-
export const CLIENTS = [...new Set(Object.values(GENERATORS).map((gen) => gen.client)), 'crawler', 'abtesting-v3'];
76+
export const CLIENTS = [...new Set(Object.values(GENERATORS).map((gen) => gen.client)), 'crawler'];
7777

7878
export async function run(command: string, { errorMessage, cwd, language }: RunOptions = {}): Promise<string> {
7979
const realCwd = path.resolve(ROOT_DIR, cwd ?? '.');

0 commit comments

Comments
 (0)