Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fastify/ajv-compiler

Package Overview
Dependencies
Maintainers
9
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/ajv-compiler - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

asd.js

4

index.d.ts

@@ -32,5 +32,5 @@ import { default as _ajv, Options } from "ajv";

export type { Options } from "ajv";
export type { Options, ErrorObject } from "ajv";
export type Ajv = _ajv;
export default ValidatorSelector;
export { StandaloneValidator };
export { StandaloneValidator };

@@ -51,2 +51,3 @@ 'use strict'

} else {
console.log(Object.assign({}, defaultAjvOptions, options.customOptions))
this.ajv = new Ajv(Object.assign({}, defaultAjvOptions, options.customOptions))

@@ -89,2 +90,4 @@ }

console.log({ schema })
return this.ajv.compile(schema)

@@ -91,0 +94,0 @@ }

{
"name": "@fastify/ajv-compiler",
"version": "3.2.0",
"version": "3.3.0",
"description": "Build and manage the AJV instances for the fastify framework",

@@ -47,6 +47,6 @@ "main": "index.js",

"tap": "^16.2.0",
"tsd": "^0.22.0"
"tsd": "^0.23.0"
},
"dependencies": {
"ajv": "^8.10.0",
"ajv": "^8.11.0",
"ajv-formats": "^2.1.1",

@@ -53,0 +53,0 @@ "fast-uri": "^2.0.0"

@@ -277,1 +277,35 @@ 'use strict'

})
t.test('global refs in main schemas', (t) => {
t.plan(2)
const factory = AjvCompiler()
const compiler = factory({}, {
customOptions: {
addUsedSchema: false
}
})
const validatorFunc1 = compiler({
schema: {
definitions: {
globalIdSchema: {
$id: 'globalId',
type: 'integer'
}
},
$ref: 'globalId'
}
})
const validatorFunc2 = compiler({
schema: {
definitions: {
globalIdSchema: {
$id: 'globalId',
type: 'string'
}
},
$ref: 'globalId'
}
})
t.equal(validatorFunc1(3), true)
t.equal(validatorFunc2(3), false)
})

@@ -0,3 +1,4 @@

import { AnySchemaObject } from "ajv";
import { expectAssignable, expectType } from "tsd";
import ValidatorSelector, { ValidatorCompiler, StandaloneValidator, RouteDefinition } from "../..";
import ValidatorSelector, { ValidatorCompiler, StandaloneValidator, RouteDefinition, ErrorObject } from "../..";

@@ -23,1 +24,11 @@ const compiler = ValidatorSelector();

expectType<ValidatorCompiler>(writer);
expectType<unknown>(({} as ErrorObject).data)
expectType<string>(({} as ErrorObject).instancePath)
expectType<string>(({} as ErrorObject).keyword)
expectType<string | undefined>(({} as ErrorObject).message)
expectType<Record<string, any>>(({} as ErrorObject).params)
expectType<AnySchemaObject | undefined>(({} as ErrorObject).parentSchema)
expectType<string | undefined>(({} as ErrorObject).propertyName)
expectType<unknown>(({} as ErrorObject).schema)
expectType<string>(({} as ErrorObject).schemaPath)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc