Skip to content

Commit d71388b

Browse files
committed
renamve 'validation' folder->'validators'
1 parent 6b4d99f commit d71388b

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

packages/core/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export * from './util/zod-json-schema-compat.js';
1515

1616
// experimental exports
1717
export * from './experimental/index.js';
18-
export * from './validation/ajv-provider.js';
19-
export * from './validation/cfworker-provider.js';
18+
export * from './validators/ajv-provider.js';
19+
export * from './validators/cfworker-provider.js';
2020
/**
2121
* JSON Schema validation
2222
*
@@ -46,4 +46,4 @@ export * from './validation/cfworker-provider.js';
4646
*/
4747

4848
// Core types only - implementations are exported via separate entry points
49-
export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './validation/types.js';
49+
export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './validators/types.js';
File renamed without changes.
File renamed without changes.

packages/core/test/validation/validation.test.ts renamed to packages/core/test/validators/validators.test.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { readFileSync } from 'node:fs';
88
import { join } from 'node:path';
99
import { vi } from 'vitest';
1010

11-
import { AjvJsonSchemaValidator } from '../../src/validation/ajv-provider.js';
12-
import { CfWorkerJsonSchemaValidator } from '../../src/validation/cfworker-provider.js';
13-
import type { JsonSchemaType } from '../../src/validation/types.js';
11+
import { AjvJsonSchemaValidator } from '../../src/validators/ajv-provider.js';
12+
import { CfWorkerJsonSchemaValidator } from '../../src/validators/cfworker-provider.js';
13+
import type { JsonSchemaType } from '../../src/validators/types.js';
1414

1515
// Test with both AJV and CfWorker validators
1616
// AJV validator will use default configuration with format validation enabled
@@ -334,8 +334,14 @@ describe('JSON Schema Validators', () => {
334334
it('validates with allOf', () => {
335335
const schema: JsonSchemaType = {
336336
allOf: [
337-
{ type: 'object', properties: { name: { type: 'string' } } },
338-
{ type: 'object', properties: { age: { type: 'number' } } }
337+
{
338+
type: 'object',
339+
properties: { name: { type: 'string' } }
340+
},
341+
{
342+
type: 'object',
343+
properties: { age: { type: 'number' } }
344+
}
339345
]
340346
};
341347
const validator = provider.getValidator(schema);
@@ -470,7 +476,10 @@ describe('JSON Schema Validators', () => {
470476
type: 'object',
471477
properties: {
472478
name: { type: 'string' },
473-
quantity: { type: 'integer', minimum: 1 }
479+
quantity: {
480+
type: 'integer',
481+
minimum: 1
482+
}
474483
},
475484
required: ['name', 'quantity']
476485
}
@@ -553,7 +562,7 @@ describe('Missing dependencies', () => {
553562
});
554563

555564
// Attempting to import ajv-provider should fail
556-
await expect(import('../../src/validation/ajv-provider.js')).rejects.toThrow();
565+
await expect(import('../../src/validators/ajv-provider.js')).rejects.toThrow();
557566
});
558567

559568
it('should be able to import cfworker-provider when ajv is missing', async () => {
@@ -567,7 +576,7 @@ describe('Missing dependencies', () => {
567576
});
568577

569578
// But cfworker-provider should import successfully
570-
const cfworkerModule = await import('../../src/validation/cfworker-provider.js');
579+
const cfworkerModule = await import('../../src/validators/cfworker-provider.js');
571580
expect(cfworkerModule.CfWorkerJsonSchemaValidator).toBeDefined();
572581

573582
// And should work correctly
@@ -594,7 +603,7 @@ describe('Missing dependencies', () => {
594603
});
595604

596605
// Attempting to import cfworker-provider should fail
597-
await expect(import('../../src/validation/cfworker-provider.js')).rejects.toThrow();
606+
await expect(import('../../src/validators/cfworker-provider.js')).rejects.toThrow();
598607
});
599608

600609
it('should be able to import ajv-provider when @cfworker/json-schema is missing', async () => {
@@ -604,7 +613,7 @@ describe('Missing dependencies', () => {
604613
});
605614

606615
// But ajv-provider should import successfully
607-
const ajvModule = await import('../../src/validation/ajv-provider.js');
616+
const ajvModule = await import('../../src/validators/ajv-provider.js');
608617
expect(ajvModule.AjvJsonSchemaValidator).toBeDefined();
609618

610619
// And should work correctly
@@ -615,7 +624,7 @@ describe('Missing dependencies', () => {
615624
});
616625

617626
it('should document that @cfworker/json-schema is required', () => {
618-
const cfworkerProviderPath = join(__dirname, '../../src/validation/cfworker-provider.ts');
627+
const cfworkerProviderPath = join(__dirname, '../../src/validators/cfworker-provider.ts');
619628
const content = readFileSync(cfworkerProviderPath, 'utf-8');
620629

621630
expect(content).toContain('@cfworker/json-schema');

0 commit comments

Comments
 (0)