-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(apidom-ls): add deprecated warning for example property #2909
fix(apidom-ls): add deprecated warning for example property #2909
Conversation
A rule with a warning (possibly better import { DiagnosticSeverity } from 'vscode-languageserver-types';
import ApilintCodes from '../../../codes';
import { LinterMeta } from '../../../../apidom-language-types';
const exampleDeprecatedLint: LinterMeta = {
code: ApilintCodes.SCHEMA_EXAMPLE_DEPRECATED,
source: 'apilint',
message: 'property "example" is deprecated, use "examples" instead',
severity: DiagnosticSeverity.Warning,
linterFunction: 'missingField',
linterParams: ['example'],
marker: 'key',
markerTarget: 'example',
targetSpecs: [
{ namespace: 'openapi', version: '3.1.0' },
],
data: {
quickFix: [
{
message: 'remove example',
action: 'removeChild',
functionParams: ['example'],
target: 'parent',
},
{
message: "add 'examples' field",
action: 'addChild',
snippetYaml: 'examples: \n ',
snippetJson: '"examples": ,\n ',
},
],
},
}; The sample code includes The current standard way to add rules to In terms of tests, current status is "sub-optimal" for That said, an option is adding a test e.g. here (currently it compares stringified diagnostics result with hardcoded string). for future ref, slightly related to #2481 |
5167294
to
08c9921
Compare
@frantuma Thank you. I pushed the recommended changes and added test. |
c67fad1
to
72b405b
Compare
28a446e
to
2fccfd5
Compare
@@ -0,0 +1,34 @@ | |||
import { DiagnosticSeverity } from 'vscode-languageserver-types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to src/config/common/schema/lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I did that already. My bad. Fixed.
dfff274
to
e629423
Compare
The push after approval is just squashing two commits into one, as for some reason
Even though the actual length was 40 characters. |
Refs #2872
I'm not sure whether I understood the folder structure properly and if the code is in the right place. I'm also not sure which test file should be changed. I would appreciate some suggestions/help @char0n