Enforce stronger naming convention for json schema ids

This commit is contained in:
fragosti
2018-08-02 11:57:23 -07:00
parent f8a252d142
commit afc5c2616a
25 changed files with 107 additions and 107 deletions

View File

@@ -1,17 +1,17 @@
export const addressSchema = {
id: '/Address',
id: '/addressSchema',
type: 'string',
pattern: '^0x[0-9a-f]{40}$',
};
export const hexSchema = {
id: '/Hex',
id: '/hexSchema',
type: 'string',
pattern: '^0x([0-9a-f][0-9a-f])+$',
};
export const numberSchema = {
id: '/Number',
id: '/numberSchema',
type: 'string',
pattern: '^\\d+(\\.\\d+)?$',
};

View File

@@ -1,5 +1,5 @@
export const blockParamSchema = {
id: '/BlockParam',
id: '/blockParamSchema',
oneOf: [
{
type: 'number',
@@ -11,10 +11,10 @@ export const blockParamSchema = {
};
export const blockRangeSchema = {
id: '/BlockRange',
id: '/blockRangeSchema',
properties: {
fromBlock: { $ref: '/BlockParam' },
toBlock: { $ref: '/BlockParam' },
fromBlock: { $ref: '/blockParamSchema' },
toBlock: { $ref: '/blockParamSchema' },
},
type: 'object',
};

View File

@@ -1,16 +1,16 @@
export const callDataSchema = {
id: '/CallData',
id: '/callDataSchema',
properties: {
from: { $ref: '/Address' },
to: { $ref: '/Address' },
from: { $ref: '/addressSchema' },
to: { $ref: '/addressSchema' },
value: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
gas: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
gasPrice: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
data: {
type: 'string',

View File

@@ -1,5 +1,5 @@
export const ecSignatureParameterSchema = {
id: '/ECSignatureParameter',
id: '/ecSignatureParameterSchema',
type: 'string',
pattern: '^0[xX][0-9A-Fa-f]{64}$',
};
@@ -12,8 +12,8 @@ export const ecSignatureSchema = {
minimum: 27,
maximum: 28,
},
r: { $ref: '/ECSignatureParameter' },
s: { $ref: '/ECSignatureParameter' },
r: { $ref: '/ecSignatureParameterSchema' },
s: { $ref: '/ecSignatureParameterSchema' },
},
required: ['v', 'r', 's'],
type: 'object',

View File

@@ -1,7 +1,7 @@
export const indexFilterValuesSchema = {
id: '/IndexFilterValues',
id: '/indexFilterValuesSchema',
additionalProperties: {
oneOf: [{ $ref: '/Number' }, { $ref: '/Address' }, { $ref: '/OrderHashSchema' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/addressSchema' }, { $ref: '/orderHashSchema' }],
},
type: 'object',
};

View File

@@ -1,10 +1,10 @@
export const orderCancellationRequestsSchema = {
id: '/OrderCancellationRequests',
id: '/orderCancellationRequestsSchema',
type: 'array',
items: {
properties: {
order: { $ref: '/Order' },
takerTokenCancelAmount: { $ref: '/Number' },
order: { $ref: '/orderSchema' },
takerTokenCancelAmount: { $ref: '/numberSchema' },
},
required: ['order', 'takerTokenCancelAmount'],
type: 'object',

View File

@@ -1,10 +1,10 @@
export const orderFillOrKillRequestsSchema = {
id: '/OrderFillOrKillRequests',
id: '/orderFillOrKillRequestsSchema',
type: 'array',
items: {
properties: {
signedOrder: { $ref: '/SignedOrder' },
fillTakerAmount: { $ref: '/Number' },
signedOrder: { $ref: '/signedOrderSchema' },
fillTakerAmount: { $ref: '/numberSchema' },
},
required: ['signedOrder', 'fillTakerAmount'],
type: 'object',

View File

@@ -1,10 +1,10 @@
export const orderFillRequestsSchema = {
id: '/OrderFillRequests',
id: '/orderFillRequestsSchema',
type: 'array',
items: {
properties: {
signedOrder: { $ref: '/SignedOrder' },
takerTokenFillAmount: { $ref: '/Number' },
signedOrder: { $ref: '/signedOrderSchema' },
takerTokenFillAmount: { $ref: '/numberSchema' },
},
required: ['signedOrder', 'takerTokenFillAmount'],
type: 'object',

View File

@@ -1,5 +1,5 @@
export const orderHashSchema = {
id: '/OrderHashSchema',
id: '/orderHashSchema',
type: 'string',
pattern: '^0x[0-9a-fA-F]{64}$',
};

View File

@@ -1,19 +1,19 @@
export const orderSchema = {
id: '/Order',
id: '/orderSchema',
properties: {
makerAddress: { $ref: '/Address' },
takerAddress: { $ref: '/Address' },
makerFee: { $ref: '/Number' },
takerFee: { $ref: '/Number' },
senderAddress: { $ref: '/Address' },
makerAssetAmount: { $ref: '/Number' },
takerAssetAmount: { $ref: '/Number' },
makerAssetData: { $ref: '/Hex' },
takerAssetData: { $ref: '/Hex' },
salt: { $ref: '/Number' },
exchangeAddress: { $ref: '/Address' },
feeRecipientAddress: { $ref: '/Address' },
expirationTimeSeconds: { $ref: '/Number' },
makerAddress: { $ref: '/addressSchema' },
takerAddress: { $ref: '/addressSchema' },
makerFee: { $ref: '/numberSchema' },
takerFee: { $ref: '/numberSchema' },
senderAddress: { $ref: '/addressSchema' },
makerAssetAmount: { $ref: '/numberSchema' },
takerAssetAmount: { $ref: '/numberSchema' },
makerAssetData: { $ref: '/hexSchema' },
takerAssetData: { $ref: '/hexSchema' },
salt: { $ref: '/numberSchema' },
exchangeAddress: { $ref: '/addressSchema' },
feeRecipientAddress: { $ref: '/addressSchema' },
expirationTimeSeconds: { $ref: '/numberSchema' },
},
required: [
'makerAddress',
@@ -34,12 +34,12 @@ export const orderSchema = {
};
export const signedOrderSchema = {
id: '/SignedOrder',
id: '/signedOrderSchema',
allOf: [
{ $ref: '/Order' },
{ $ref: '/orderSchema' },
{
properties: {
signature: { $ref: '/Hex' },
signature: { $ref: '/hexSchema' },
},
required: ['signature'],
},

View File

@@ -1,5 +1,5 @@
export const ordersSchema = {
id: '/OrdersSchema',
id: '/ordersSchema',
type: 'array',
items: { $ref: '/Order' },
items: { $ref: '/orderSchema' },
};

View File

@@ -1,5 +1,5 @@
export const paginatedCollectionSchema = {
id: '/PaginatedCollection',
id: '/paginatedCollectionSchema',
type: 'object',
properties: {
total: { type: 'number' },

View File

@@ -1,11 +1,11 @@
export const relayerApiAssetDataPairsResponseSchema = {
id: '/RelayerApiAssetDataPairsResponse',
id: '/relayerApiAssetDataPairsResponseSchema',
type: 'object',
allOf: [
{ $ref: '/PaginatedCollection' },
{ $ref: '/paginatedCollectionSchema' },
{
properties: {
records: { $ref: '/RelayerApiAssetDataPairs' },
records: { $ref: '/relayerApiAssetDataPairsSchema' },
},
required: ['records'],
},
@@ -13,12 +13,12 @@ export const relayerApiAssetDataPairsResponseSchema = {
};
export const relayerApiAssetDataPairsSchema = {
id: '/RelayerApiAssetDataPairs',
id: '/relayerApiAssetDataPairsSchema',
type: 'array',
items: {
properties: {
assetDataA: { $ref: '/RelayerApiAssetDataTradeInfo' },
assetDataB: { $ref: '/RelayerApiAssetDataTradeInfo' },
assetDataA: { $ref: '/relayerApiAssetDataTradeInfoSchema' },
assetDataB: { $ref: '/relayerApiAssetDataTradeInfoSchema' },
},
required: ['assetDataA', 'assetDataB'],
type: 'object',
@@ -26,12 +26,12 @@ export const relayerApiAssetDataPairsSchema = {
};
export const relayerApiAssetDataTradeInfoSchema = {
id: '/RelayerApiAssetDataTradeInfo',
id: '/relayerApiAssetDataTradeInfoSchema',
type: 'object',
properties: {
assetData: { $ref: '/Hex' },
minAmount: { $ref: '/Number' },
maxAmount: { $ref: '/Number' },
assetData: { $ref: '/hexSchema' },
minAmount: { $ref: '/numberSchema' },
maxAmount: { $ref: '/numberSchema' },
precision: { type: 'number' },
},
required: ['assetData'],

View File

@@ -1,5 +1,5 @@
export const relayerApiErrorResponseSchema = {
id: '/RelayerApiErrorResponse',
id: '/relayerApiErrorResponseSchema',
type: 'object',
properties: {
code: { type: 'number' },

View File

@@ -1,15 +1,15 @@
export const relayerApiOrderConfigPayloadSchema = {
id: '/RelayerApiOrderConfigPayload',
id: '/relayerApiOrderConfigPayloadSchema',
type: 'object',
properties: {
makerAddress: { $ref: '/Address' },
takerAddress: { $ref: '/Address' },
makerAssetAmount: { $ref: '/Number' },
takerAssetAmount: { $ref: '/Number' },
makerAssetData: { $ref: '/Hex' },
takerAssetData: { $ref: '/Hex' },
exchangeAddress: { $ref: '/Address' },
expirationTimeSeconds: { $ref: '/Number' },
makerAddress: { $ref: '/addressSchema' },
takerAddress: { $ref: '/addressSchema' },
makerAssetAmount: { $ref: '/numberSchema' },
takerAssetAmount: { $ref: '/numberSchema' },
makerAssetData: { $ref: '/hexSchema' },
takerAssetData: { $ref: '/hexSchema' },
exchangeAddress: { $ref: '/addressSchema' },
expirationTimeSeconds: { $ref: '/numberSchema' },
},
required: [
'makerAddress',

View File

@@ -1,11 +1,11 @@
export const relayerApiOrderConfigResponseSchema = {
id: '/RelayerApiOrderConfigResponse',
id: '/relayerApiOrderConfigResponseSchema',
type: 'object',
properties: {
makerFee: { $ref: '/Number' },
takerFee: { $ref: '/Number' },
feeRecipientAddress: { $ref: '/Address' },
senderAddress: { $ref: '/Address' },
makerFee: { $ref: '/numberSchema' },
takerFee: { $ref: '/numberSchema' },
feeRecipientAddress: { $ref: '/addressSchema' },
senderAddress: { $ref: '/addressSchema' },
},
required: ['makerFee', 'takerFee', 'feeRecipientAddress', 'senderAddress'],
};

View File

@@ -1,9 +1,9 @@
export const relayerApiOrderSchema = {
id: '/RelayerApiOrder',
id: '/relayerApiOrderSchema',
type: 'object',
properties: {
order: { $ref: '/Order' },
remainingFillableAmount: { $ref: '/Number' },
order: { $ref: '/orderSchema' },
remainingFillableAmount: { $ref: '/numberSchema' },
},
required: ['order', 'remainingFillableAmount'],
};

View File

@@ -1,9 +1,9 @@
export const relayerApiOrderBookResponseSchema = {
id: '/RelayerApiOrderBookResponse',
id: '/relayerApiOrderBookResponseSchema',
type: 'object',
properties: {
bids: { $ref: '/RelayerApiOrdersResponse' },
asks: { $ref: '/RelayerApiOrdersResponse' },
bids: { $ref: '/relayerApiOrdersResponseSchema' },
asks: { $ref: '/relayerApiOrdersResponseSchema' },
},
required: ['bids', 'asks'],
};

View File

@@ -1,26 +1,26 @@
export const relayerApiOrdersChannelSubscribeSchema = {
id: '/RelayerApiOrdersChannelSubscribe',
id: '/relayerApiOrdersChannelSubscribeSchema',
type: 'object',
properties: {
type: { enum: ['subscribe'] },
channel: { enum: ['orders'] },
requestId: { type: 'string' },
payload: { $ref: '/RelayerApiOrdersChannelSubscribePayload' },
payload: { $ref: '/relayerApiOrdersChannelSubscribePayload' },
},
required: ['type', 'channel', 'requestId'],
};
export const relayerApiOrdersChannelSubscribePayload = {
id: '/RelayerApiOrdersChannelSubscribePayload',
id: '/relayerApiOrdersChannelSubscribePayload',
type: 'object',
properties: {
makerAssetProxyId: { $ref: '/Hex' },
takerAssetProxyId: { $ref: '/Hex' },
makerAssetProxyId: { $ref: '/hexSchema' },
takerAssetProxyId: { $ref: '/hexSchema' },
networkId: { type: 'number' },
makerAssetAddress: { $ref: '/Address' },
takerAssetAddress: { $ref: '/Address' },
makerAssetData: { $ref: '/Hex' },
takerAssetData: { $ref: '/Hex' },
traderAssetData: { $ref: '/Hex' },
makerAssetAddress: { $ref: '/addressSchema' },
takerAssetAddress: { $ref: '/addressSchema' },
makerAssetData: { $ref: '/hexSchema' },
takerAssetData: { $ref: '/hexSchema' },
traderAssetData: { $ref: '/hexSchema' },
},
};

View File

@@ -1,11 +1,11 @@
export const relayerApiOrdersChannelUpdateSchema = {
id: '/RelayerApiOrdersChannelUpdate',
id: '/relayerApiOrdersChannelUpdateSchema',
type: 'object',
properties: {
type: { enum: ['update'] },
channel: { enum: ['orders'] },
requestId: { type: 'string' },
payload: { $ref: '/RelayerApiOrders' },
payload: { $ref: '/relayerApiOrdersSchema' },
},
required: ['type', 'channel', 'requestId'],
};

View File

@@ -1,11 +1,11 @@
export const relayerApiOrdersResponseSchema = {
id: '/RelayerApiOrdersResponse',
id: '/relayerApiOrdersResponseSchema',
type: 'object',
allOf: [
{ $ref: '/PaginatedCollection' },
{ $ref: '/paginatedCollectionSchema' },
{
properties: {
records: { $ref: '/RelayerApiOrders' },
records: { $ref: '/relayerApiOrdersSchema' },
},
required: ['records'],
},

View File

@@ -1,5 +1,5 @@
export const relayerApiOrdersSchema = {
id: '/RelayerApiOrders',
id: '/relayerApiOrdersSchema',
type: 'array',
items: { $ref: '/RelayerApiOrder' },
items: { $ref: '/relayerApiOrderSchema' },
};

View File

@@ -1,5 +1,5 @@
export const signedOrdersSchema = {
id: '/SignedOrdersSchema',
id: '/signedOrdersSchema',
type: 'array',
items: { $ref: '/SignedOrder' },
items: { $ref: '/signedOrderSchema' },
};

View File

@@ -1,10 +1,10 @@
export const tokenSchema = {
id: '/Token',
id: '/tokenSchema',
properties: {
name: { type: 'string' },
symbol: { type: 'string' },
decimals: { type: 'number' },
address: { $ref: '/Address' },
address: { $ref: '/addressSchema' },
},
required: ['name', 'symbol', 'decimals', 'address'],
type: 'object',

View File

@@ -1,22 +1,22 @@
export const jsNumber = {
id: '/JsNumber',
id: '/jsNumber',
type: 'number',
minimum: 0,
};
export const txDataSchema = {
id: '/TxData',
id: '/txDataSchema',
properties: {
from: { $ref: '/Address' },
to: { $ref: '/Address' },
from: { $ref: '/addressSchema' },
to: { $ref: '/addressSchema' },
value: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
gas: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
gasPrice: {
oneOf: [{ $ref: '/Number' }, { $ref: '/JsNumber' }],
oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
},
data: {
type: 'string',