1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import { schemas } from '@0xproject/json-schemas';
import { OpenApiSpec } from '@loopback/openapi-v3-types';
import { examples } from './examples';
import { md } from './md';
import { generateParameters } from './parameters';
import { generateResponses } from './responses';
// We need to replace the `$ref`s to be openAPI compliant.
const openApiSchemas = JSON.parse(JSON.stringify(schemas).replace(/(\/\w+)/g, match => `#/components/schemas${match}`));
export const api: OpenApiSpec = {
openapi: '3.0.0',
info: {
version: '2.0.0',
title: 'Standard Relayer REST API',
description: md.introduction,
license: {
name: 'Apache 2.0',
url: 'https://www.apache.org/licenses/LICENSE-2.0.html',
},
},
paths: {
'/v2/asset_pairs': {
get: {
description:
'Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `asset_data_a` or `asset_data_b` returns pairs filtered by that asset only.',
operationId: 'getAssetPairs',
parameters: generateParameters(
[
{
name: 'asset_data_a',
in: 'query',
description: 'The assetData value for the first asset in the pair.',
example: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
schema: {
$ref: '#/components/schemas/hexSchema',
},
},
{
name: 'asset_data_b',
in: 'query',
description: 'The assetData value for the second asset in the pair.',
example: '0x0257179264389b814a946f3e92105513705ca6b990',
schema: {
$ref: '#/components/schemas/hexSchema',
},
},
],
true,
),
responses: generateResponses(
'relayerApiAssetDataPairsResponseSchema',
examples.relayerApiAssetDataPairsResponse,
`Returns a collection of available asset pairs with some meta info`,
),
},
},
},
components: {
schemas: openApiSchemas,
},
};
|