Skip to content

Commit 91312ec

Browse files
fix(ls): external refs should not be validated (#5015)
1 parent 8fcee55 commit 91312ec

11 files changed

+241
-4
lines changed

packages/apidom-ls/src/config/common/schema/lint/$ref-3-0--request-bodies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const $ref3RequestBodiesLint: LinterMeta = {
1616
{
1717
targets: [{ path: '$ref' }],
1818
function: 'apilintValueRegex',
19-
params: ['^(?!.*#/components/schemas).*$'],
19+
params: ['^(?!.*#/components/schemas)(#/).*$'],
2020
},
2121
],
2222
marker: 'value',

packages/apidom-ls/src/config/openapi/header/lint/$ref-3-0--header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const $ref3HeaderNamingLint: LinterMeta = {
1515
{
1616
targets: [{ path: '$ref' }],
1717
function: 'apilintValueRegex',
18-
params: ['^(?!.*#/components/headers).*$'],
18+
params: ['^(?!.*#/components/headers)(#/).*$'],
1919
},
2020
],
2121
marker: 'value',

packages/apidom-ls/src/config/openapi/parameter/lint/$ref-3-0--parameter.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const $ref3ParameterNamingLint: LinterMeta = {
1919
function: 'parentExistFields',
2020
params: [['paths']],
2121
},
22+
{
23+
targets: [{ path: '$ref' }],
24+
function: 'apilintValueRegex',
25+
params: ['^(#/).*$'],
26+
},
2227
],
2328
data: {},
2429
targetSpecs: OpenAPI30,

packages/apidom-ls/src/config/openapi/request-body/lint/$ref-3-0--request-bodies-naming-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const $ref3RequestBodiesNamingSchemaLint: LinterMeta = {
1616
{
1717
targets: [{ path: '$ref' }],
1818
function: 'apilintValueRegex',
19-
params: ['^(.*#/components/schemas).*$'],
19+
params: ['^(.*#/components/schemas)(?!#/).*$'],
2020
},
2121
],
2222
marker: 'value',

packages/apidom-ls/src/config/openapi/request-body/lint/$ref-3-0--request-bodies-naming.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const $ref3RequestBodiesNamingLint: LinterMeta = {
1515
{
1616
targets: [{ path: '$ref' }],
1717
function: 'apilintValueRegex',
18-
params: ['^(?!.*#/components/(requestBodies|schemas)).*$'],
18+
params: ['^(?!.*#/components/(requestBodies|schemas))(#/).*$'],
1919
},
2020
],
2121
marker: 'value',
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: 'test'
5+
paths:
6+
/foo:
7+
get:
8+
responses:
9+
'200':
10+
description: OK
11+
headers:
12+
X-MyHeader:
13+
$ref: 'https://api.github.com/users/github/orgs'
14+
components:
15+
headers:
16+
MyHeader:
17+
description: ID of the user
18+
required: true
19+
schema:
20+
type: string
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: 'test'
5+
paths:
6+
/foo:
7+
parameters:
8+
- $ref: 'https://api.github.com/users/github/orgs'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: 'test'
5+
paths:
6+
/:
7+
post:
8+
responses:
9+
default:
10+
description: 'test'
11+
operationId: myId
12+
requestBody:
13+
content:
14+
application/json:
15+
schema:
16+
$ref: 'https://api.github.com/users/github/orgs'
17+
components:
18+
requestBodies:
19+
MyBody:
20+
content:
21+
application/json:
22+
schema:
23+
type: string
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: 'test'
5+
paths:
6+
/:
7+
post:
8+
responses:
9+
default:
10+
description: 'test'
11+
operationId: myId
12+
requestBody:
13+
$ref: 'https://api.github.com/users/github/orgs'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: 'test'
5+
paths:
6+
/:
7+
post:
8+
responses:
9+
default:
10+
description: 'test'
11+
operationId: myId
12+
requestBody:
13+
$ref: 'https://api.github.com/users/github/orgs'
14+
components:
15+
requestBodies:
16+
MyBody:
17+
content:
18+
application/json:
19+
schema:
20+
type: string

0 commit comments

Comments
 (0)