Add defaults for networkId and pagination
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-api/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/json-schemas": "1.0.1-rc.3"
|
||||
"@0xproject/json-schemas": "^1.0.1-rc.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,6 +7,7 @@ export const paginationParameters: ParameterObject[] = [
|
||||
example: 3,
|
||||
schema: {
|
||||
type: 'number',
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -16,6 +17,7 @@ export const paginationParameters: ParameterObject[] = [
|
||||
example: 10,
|
||||
schema: {
|
||||
type: 'number',
|
||||
default: 100,
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -27,10 +29,11 @@ export const networkdIdParameter: ParameterObject = {
|
||||
example: 42,
|
||||
schema: {
|
||||
type: 'number',
|
||||
default: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
|
||||
const optionalParameters = isPaginated ? paginationParameters : [];
|
||||
return [networkdIdParameter, ...optionalParameters, ...parameters];
|
||||
return [...parameters, networkdIdParameter, ...optionalParameters];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user