Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/apidom-ls/src/config/codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ enum ApilintCodes {
OPENAPI3_0_HEADER_FIELD_EXPLODE_TYPE = 5280600,
OPENAPI3_0_HEADER_FIELD_ALLOW_RESERVED_TYPE = 5280700,
OPENAPI3_0_HEADER_FIELD_SCHEMA_TYPE = 5280800,
OPENAPI3_0_HEADER_FIELD_SCHEMA_MUTUALLY_EXCLUSIVE,
OPENAPI3_0_HEADER_FIELD_EXAMPLES_VALUES_TYPE = 5280900,
OPENAPI3_0_HEADER_FIELD_EXAMPLES_MUTUALLY_EXCLUSIVE,
OPENAPI3_0_HEADER_FIELD_CONTENT_VALUES_TYPE = 5281000,
Expand Down
2 changes: 2 additions & 0 deletions packages/apidom-ls/src/config/openapi/header/lint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import styleTypeLint from './style--type';
import explodeTypeLint from './explode--type';
import allowReservedTypeLint from './allow-reserved--type';
import schemaTypeLint from './schema--type';
import schemaMutuallyExclusiveLint from './schema--mutually-exclusive';
import examplesValuesTypeLint from './examples--values-type';
import examplesMutuallyExclusiveLint from './examples--mutually-exclusive';
import contentValuesTypeLint from './content--values-type';
Expand All @@ -21,6 +22,7 @@ const lints = [
explodeTypeLint,
allowReservedTypeLint,
schemaTypeLint,
schemaMutuallyExclusiveLint,
examplesValuesTypeLint,
examplesMutuallyExclusiveLint,
contentValuesTypeLint,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { DiagnosticSeverity } from 'vscode-languageserver-types';

import ApilintCodes from '../../../codes';
import { LinterMeta } from '../../../../apidom-language-types';

const schemaMutuallyExclusiveLint: LinterMeta = {
code: ApilintCodes.OPENAPI3_0_HEADER_FIELD_SCHEMA_MUTUALLY_EXCLUSIVE,
source: 'apilint',
message: 'The `schema` field and `content` field are mutually exclusive.',
severity: DiagnosticSeverity.Error,
linterFunction: 'missingFields',
linterParams: [['schema']],
marker: 'key',
markerTarget: 'schema',
conditions: [
{
function: 'existFields',
params: [['content']],
},
],
};

export default schemaMutuallyExclusiveLint;