aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-27 05:52:23 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-27 05:52:23 +0800
commitefa67d87aa4f8d9d57883ee85b59f5aaf211eb12 (patch)
treeb38844359d2df47a4ae3fab4a64f86062349a5ca /packages/sra-api/src
parent4fe410a277f13bc637ffe1c1c5b023d957a2bef8 (diff)
downloaddexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar.gz
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar.bz2
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar.lz
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar.xz
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.tar.zst
dexon-sol-tools-efa67d87aa4f8d9d57883ee85b59f5aaf211eb12.zip
Rename to sra-api
Diffstat (limited to 'packages/sra-api/src')
-rw-r--r--packages/sra-api/src/api.ts165
-rw-r--r--packages/sra-api/src/index.ts1
2 files changed, 166 insertions, 0 deletions
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
new file mode 100644
index 000000000..9043f6245
--- /dev/null
+++ b/packages/sra-api/src/api.ts
@@ -0,0 +1,165 @@
+import { OpenApiSpec } from '@loopback/openapi-v3-types';
+
+export const api: OpenApiSpec = {
+ openapi: '3.0.0',
+ info: {
+ version: '1.0.0',
+ title: 'Swagger Petstore',
+ license: {
+ name: 'MIT',
+ },
+ },
+ servers: [
+ {
+ url: 'http://petstore.swagger.io/v1',
+ },
+ ],
+ paths: {
+ '/pets': {
+ get: {
+ summary: 'List all pets',
+ operationId: 'listPets',
+ 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',
+ },
+ },
+ },
+ },
+ },
+ },
+ post: {
+ summary: 'Create a pet',
+ operationId: 'createPets',
+ tags: ['pets'],
+ responses: {
+ '201': {
+ description: 'Null response',
+ },
+ default: {
+ description: 'unexpected error',
+ content: {
+ 'application/json': {
+ schema: {
+ $ref: '#/components/schemas/Error',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ '/pets/{petId}': {
+ get: {
+ summary: 'Info for a specific pet',
+ operationId: 'showPetById',
+ tags: ['pets'],
+ parameters: [
+ {
+ name: 'petId',
+ in: 'path',
+ required: true,
+ description: 'The id of the pet to retrieve',
+ schema: {
+ type: 'string',
+ },
+ },
+ ],
+ responses: {
+ '200': {
+ description: 'Expected response to a valid request',
+ content: {
+ 'application/json': {
+ schema: {
+ $ref: '#/components/schemas/Pets',
+ },
+ },
+ },
+ },
+ default: {
+ description: 'unexpected error',
+ content: {
+ 'application/json': {
+ schema: {
+ $ref: '#/components/schemas/Error',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ components: {
+ schemas: {
+ Pet: {
+ required: ['id', 'name'],
+ properties: {
+ id: {
+ type: 'integer',
+ format: 'int64',
+ },
+ name: {
+ type: 'string',
+ },
+ tag: {
+ type: 'string',
+ },
+ },
+ },
+ Pets: {
+ type: 'array',
+ items: {
+ $ref: '#/components/schemas/Pet',
+ },
+ },
+ Error: {
+ required: ['code', 'message'],
+ properties: {
+ code: {
+ type: 'integer',
+ format: 'int32',
+ },
+ message: {
+ type: 'string',
+ },
+ },
+ },
+ },
+ },
+};
diff --git a/packages/sra-api/src/index.ts b/packages/sra-api/src/index.ts
new file mode 100644
index 000000000..4d73f3cd3
--- /dev/null
+++ b/packages/sra-api/src/index.ts
@@ -0,0 +1 @@
+export { api } from './api';