Skip to content

Commit 1d275c1

Browse files
committed
register schema to avoid unecessary network calls
1 parent e36d120 commit 1d275c1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/languageservice/services/yamlSchemaService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ export class YAMLSchemaService extends JSONSchemaService {
170170
const schemaVersion = this.detectSchemaVersion(schema);
171171
const validator = this.getValidatorForVersion(schemaVersion);
172172
const metaSchemaUrl = this.getSchemaMetaSchema(schemaVersion);
173+
if (!validator.hasSchema(metaSchemaUrl)) {
174+
validator.registerSchema({ $schema: metaSchemaUrl, type: 'string' }, schema);
175+
}
173176

174177
// Validate the schema against its meta-schema using the URL directly
175178
const result = await validator.validate(metaSchemaUrl, schema, 'BASIC');

0 commit comments

Comments
 (0)