Skip to content

Use ajv standalone mode for schema validation #1089

@sfc-gh-agrinevskij

Description

@sfc-gh-agrinevskij

Is your enhancement related to a problem? Please describe.

Yaml language server currently uses ajv.compile for schema validation here: https://github.com/redhat-developer/yaml-language-server/blob/main/src/languageservice/services/yamlSchemaService.ts#L41 . This works fine, except for the cases, when unsafe-eval is disabled by CSP. This makes the language server unusable in this context. There are also a few discussions about that for ajv (for example ajv-validator/ajv#406).

Describe the solution you would like

AJV supports standalone mode https://ajv.js.org/standalone.html where a validation function is generated at compile time and doesn't rely on dynamic compilation anymore. I propose to switch the language server to use the standalone mode which would allow the server to work with strict CSP policies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions