Documentation Index Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Validates data against a JSON schema using the AJV validator.
This function can validate any given data against a given schema. It supports validating custom data types such as the Attachment type.
export declare function validateDataUsingSchema ( input : {
data : Record < string , any >[] | Record < string , any >;
schema : Record < string , any >;
}) : void ;
Examples
Basic Validation
Invalid Data Validation
import { validateDataUsingSchema } from "@intuned/browser" ;
import { BrowserContext , Page } from "playwright" ;
interface Params {}
export default async function handler (
params : Params ,
page : Page ,
context : BrowserContext
) {
const uploadData = {
file: {
fileName: "documents/report.pdf" ,
bucket: "my-bucket" ,
region: "us-east-1" ,
key: "documents/report.pdf" ,
endpoint: null ,
suggestedFileName: "Monthly Report.pdf" ,
fileType: "document" ,
},
name: "Test File Upload" ,
};
const uploadSchema = {
type: "object" ,
required: [ "file" , "name" ],
properties: {
file: { type: "attachment" },
name: { type: "string" },
},
};
validateDataUsingSchema ({ data: uploadData , schema: uploadSchema });
// Validation passes with Attachment type
console . log ( "Validation passed" );
return "Validation passed" ;
}
Arguments
The input object containing data and schema input.data
Record<string, any> | Array<Record<string, any>>
required
The data to validate. Can be a single data object or an array of data objects
input.schema
Record<string, any>
required
JSON schema object defining validation rules
Returns: void
Returns nothing if validation passes, throws ValidationError if it fails
Raises
ValidationError
If validation fails