Skip to main content

ensureSchemaReference

@webda/compiler


Function: ensureSchemaReference()

ensureSchemaReference(file, schemaFile): boolean

Defined in: configuration.ts:56

Ensure a configuration or deployment file references its JSON schema

  • JSON/JSONC: the $schema property is added as first property, formatting and comments are kept
  • YAML: a # yaml-language-server: $schema=... modeline is added on the first line

The reference is relative to the file. An existing reference is only replaced if it is managed by webda (stale path or legacy name), custom references are kept.

Parameters​

file​

string

the configuration or deployment file

schemaFile​

string

the schema file to reference

Returns​

boolean

true if the file was updated