aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-01 07:37:51 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-01 07:37:51 +0800
commit4aff9515d807feb5fc30431d109d503a6c52f0cd (patch)
tree49c98689c083cdb0fd3992768d924a92ccfbd243 /packages/sra-api
parent162fe797fcd4c41d8d84184ca5c0352c8342937b (diff)
downloaddexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar.gz
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar.bz2
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar.lz
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar.xz
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.tar.zst
dexon-sol-tools-4aff9515d807feb5fc30431d109d503a6c52f0cd.zip
Get schema tests running (not crashiing)
Diffstat (limited to 'packages/sra-api')
-rw-r--r--packages/sra-api/package.json9
-rw-r--r--packages/sra-api/src/api.ts51
2 files changed, 56 insertions, 4 deletions
diff --git a/packages/sra-api/package.json b/packages/sra-api/package.json
index 61fa392fb..9a0ab4971 100644
--- a/packages/sra-api/package.json
+++ b/packages/sra-api/package.json
@@ -4,15 +4,14 @@
"engines": {
"node": ">=6.12"
},
- "description": "Standard Relayer API Swagger Spec",
+ "description": "Standard Relayer API Open API Spec",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"serve": "redoc-cli serve lib/api.json --watch",
- "develop": "run-p build-json:watch serve",
+ "watch_without_deps": "run-p build-json:watch serve",
"lint": "tslint --project .",
"test": "yarn run_mocha",
- "redoc-cli": "redoc-cli",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
@@ -33,7 +32,9 @@
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-api/README.md",
- "dependencies": {},
+ "dependencies": {
+ "@0xproject/json-schemas": "1.0.1-rc.3"
+ },
"devDependencies": {
"@0xproject/tslint-config": "^1.0.4",
"@loopback/openapi-v3-types": "^0.8.2",
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
index c05311516..fd64ab1d7 100644
--- a/packages/sra-api/src/api.ts
+++ b/packages/sra-api/src/api.ts
@@ -1,3 +1,4 @@
+import { schemas } from '@0xproject/json-schemas';
import { OpenApiSpec } from '@loopback/openapi-v3-types';
export const api: OpenApiSpec = {
@@ -14,6 +15,55 @@ export const api: OpenApiSpec = {
// TODO: Use relayer registry information here?
],
paths: {
+ '/orders': {
+ get: {
+ summary: 'List all pets',
+ operationId: 'listPets2',
+ tags: ['pets'],
+ parameters: [
+ {
+ name: 'limit',
+ in: 'query',
+ description: 'How many items to return at one time (max 100)',
+ required: false,
+ schema: {
+ type: 'integer',
+ format: 'int32',
+ },
+ },
+ ],
+ responses: {
+ '200': {
+ description: 'An paged array of pets',
+ headers: {
+ 'x-next': {
+ description: 'A link to the next page of responses',
+ schema: {
+ type: 'string',
+ },
+ },
+ },
+ content: {
+ 'application/json': {
+ schema: {
+ $ref: '#/components/schemas/Pets',
+ },
+ },
+ },
+ },
+ default: {
+ description: 'unexpected error',
+ content: {
+ 'application/json': {
+ schema: {
+ $ref: '#/components/schemas/Error',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
'/pets': {
get: {
summary: 'List all pets',
@@ -141,6 +191,7 @@ export const api: OpenApiSpec = {
},
},
},
+ // Orderbook: schemas.relayerApiOrderBookResponseSchema,
Pets: {
type: 'array',
items: {