---
title: "validate | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function validate

-   validate(  
        options: {  
            key: any;  
            objectElementValidators?: any;  
            style: any;  
            styleSpec: any;  
            validateSpec?: any;  
            value: any;  
            valueSpec: any;  
        },  
    ): [ValidationError](https://docs.maptiler.com/sdk-js/api-reference/classes/ValidationError/)\[\][](#validate)
    
    Main recursive validation function used internally. You should use `validateStyleMin` in the browser or `validateStyle` in node env.
    
    #### Parameters
    
    -   options: {  
            key: any;  
            objectElementValidators?: any;  
            style: any;  
            styleSpec: any;  
            validateSpec?: any;  
            value: any;  
            valueSpec: any;  
        }
        
        the options object
        
        -   ##### key: any
            
            string representing location of validation in style tree. Used only for more informative error reporting.
            
        -   ##### `Optional`objectElementValidators?: any
            
            optional object of functions that will be called
            
        -   ##### style: any
            
            the style object
            
        -   ##### styleSpec: any
            
            current full spec being evaluated.
            
        -   ##### `Optional`validateSpec?: any
            
            the validate function itself
            
        -   ##### value: any
            
            current value from style being evaluated. May be anything from a high level object that needs to be descended into deeper or a simple scalar value.
            
        -   ##### valueSpec: any
            
            current spec being evaluated. Tracks value.
            
    
    #### Returns [ValidationError](https://docs.maptiler.com/sdk-js/api-reference/classes/ValidationError/)\[\]
    
    an array of errors, or an empty array if no errors are found.
