import { Segment } from "vscode-json-languageservice" ; import { CustomTag } from "../../model" ; import { JSONSchema } from "../../model/jsonSchema" ; import { YAMLDocument } from "../index" ; import { ASTNode , ISchemaCollector } from "./ast-node" ; import { StringASTNode } from "./string-ast-node" ; import { ValidationResult } from "./validation-result" ; export class PropertyASTNode extends ASTNode < ASTNode > { key : StringASTNode ; value : ASTNode ; colonOffset : number ; constructor ( document , parent , key , customTag ) { super ( document , parent , "property" , null , key . start , key . end , customTag ) ; this . key = key ; key . parent = this ; key . location = key . value ; this . colonOffset = - 1 ; } getChildNodes ( ) { return this . value ? [ this . key , this . value ] : [ this . key ] ; } getLastChild ( ) { return this . value ; } getLocation ( ) { return this . key . location ; } visit ( visitor ) { return ( visitor ( this ) && this . key . visit ( visitor ) && this . value && this . value . visit ( visitor ) ) ; } validate ( schema , validationResult , matchingSchemas ) { if ( ! matchingSchemas . include ( this ) ) { return ; } if ( this . value ) { this . value . validate ( schema , validationResult , matchingSchemas ) ; } } }