From 1e4fdcf615502478cbec8711bf6710e093c0c279 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 18 Dec 2017 15:35:23 +0100 Subject: Rename SubscriptionOpts to BlockRange --- packages/json-schemas/CHANGELOG.md | 4 ++++ packages/json-schemas/schemas/block_range_schema.ts | 20 ++++++++++++++++++++ .../json-schemas/schemas/subscription_opts_schema.ts | 20 -------------------- packages/json-schemas/src/schemas.ts | 6 +++--- packages/json-schemas/test/schema_test.ts | 8 ++++---- 5 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 packages/json-schemas/schemas/block_range_schema.ts delete mode 100644 packages/json-schemas/schemas/subscription_opts_schema.ts (limited to 'packages/json-schemas') diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 9f080adeb..81225e5de 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +v0.x.x - _TBD, 2017_ +------------------------ + * Rename `subscriptionOptsSchema` to `blockRangeSchema` (#272) + v0.6.7 - _Nov. 14, 2017_ ------------------------ * Re-publish JSON-schema previously published under NPM package 0x-json-schemas diff --git a/packages/json-schemas/schemas/block_range_schema.ts b/packages/json-schemas/schemas/block_range_schema.ts new file mode 100644 index 000000000..b264cb66e --- /dev/null +++ b/packages/json-schemas/schemas/block_range_schema.ts @@ -0,0 +1,20 @@ +export const blockParamSchema = { + id: '/BlockParam', + oneOf: [ + { + type: 'number', + }, + { + enum: ['latest', 'earliest', 'pending'], + }, + ], +}; + +export const blockRangeSchema = { + id: '/BlockRange', + properties: { + fromBlock: {$ref: '/BlockParam'}, + toBlock: {$ref: '/BlockParam'}, + }, + type: 'object', +}; diff --git a/packages/json-schemas/schemas/subscription_opts_schema.ts b/packages/json-schemas/schemas/subscription_opts_schema.ts deleted file mode 100644 index a476e6963..000000000 --- a/packages/json-schemas/schemas/subscription_opts_schema.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const blockParamSchema = { - id: '/BlockParam', - oneOf: [ - { - type: 'number', - }, - { - enum: ['latest', 'earliest', 'pending'], - }, - ], -}; - -export const subscriptionOptsSchema = { - id: '/SubscriptionOpts', - properties: { - fromBlock: {$ref: '/BlockParam'}, - toBlock: {$ref: '/BlockParam'}, - }, - type: 'object', -}; diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts index 69164cbc7..487f4fa5c 100644 --- a/packages/json-schemas/src/schemas.ts +++ b/packages/json-schemas/src/schemas.ts @@ -57,8 +57,8 @@ import { } from '../schemas/signed_orders_schema'; import { blockParamSchema, - subscriptionOptsSchema, -} from '../schemas/subscription_opts_schema'; + blockRangeSchema, +} from '../schemas/block_range_schema'; import { tokenSchema, } from '../schemas/token_schema'; @@ -81,7 +81,7 @@ export const schemas = { signedOrderSchema, signedOrdersSchema, blockParamSchema, - subscriptionOptsSchema, + blockRangeSchema, tokenSchema, jsNumber, txDataSchema, diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 067b02827..e729c1925 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -23,7 +23,7 @@ const { signedOrderSchema, signedOrdersSchema, blockParamSchema, - subscriptionOptsSchema, + blockRangeSchema, tokenSchema, jsNumber, txDataSchema, @@ -170,21 +170,21 @@ describe('Schema', () => { validateAgainstSchema(testCases, blockParamSchema, shouldFail); }); }); - describe('#subscriptionOptsSchema', () => { + describe('#blockRangeSchema', () => { it('should validate valid subscription opts', () => { const testCases = [ {fromBlock: 42, toBlock: 'latest'}, {fromBlock: 42}, {}, ]; - validateAgainstSchema(testCases, subscriptionOptsSchema); + validateAgainstSchema(testCases, blockRangeSchema); }); it('should fail for invalid subscription opts', () => { const testCases = [ {fromBlock: '42'}, ]; const shouldFail = true; - validateAgainstSchema(testCases, subscriptionOptsSchema, shouldFail); + validateAgainstSchema(testCases, blockRangeSchema, shouldFail); }); }); describe('#tokenSchema', () => { -- cgit