From 4aff9515d807feb5fc30431d109d503a6c52f0cd Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 31 Jul 2018 16:37:51 -0700 Subject: Get schema tests running (not crashiing) --- packages/sra-api/package.json | 9 ++++---- packages/sra-api/src/api.ts | 51 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) (limited to 'packages/sra-api') 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: { -- cgit v1.2.3