Skip to content

Commit ae50239

Browse files
committed
Initial OpenAPI spec setup
0 parents  commit ae50239

17 files changed

Lines changed: 3095 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Validate OpenAPI Specs
2+
3+
on:
4+
push:
5+
paths:
6+
- 'components/**.yaml'
7+
- 'services/**.yaml'
8+
- 'responses/**.yaml'
9+
pull_request:
10+
paths:
11+
- 'components/**.yaml'
12+
- 'services/**.yaml'
13+
- 'responses/**.yaml'
14+
15+
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20'
26+
27+
- name: Install swagger-cli
28+
run: npm install -g swagger-cli
29+
30+
- name: Validate OpenAPI spec
31+
run: |
32+
swagger-cli validate main.yaml --verbose
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Update Website Docs
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'openapi.json'
8+
- 'openapi.yaml'
9+
- 'docs/**'
10+
- '*.md'
11+
12+
jobs:
13+
update-website:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout openapi repo
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Trigger website deployment
22+
run: |
23+
curl -X POST \
24+
-H "Authorization: token ${{ secrets.WEBSITE_DEPLOY_TOKEN }}" \
25+
-H "Accept: application/vnd.github.v3+json" \
26+
https://api.github.com/repos/marketdataapi/website/dispatches \
27+
-d '{"event_type": "openapi-updated", "client_payload": {"sha": "${{ github.sha }}", "ref": "${{ github.ref }}"}}'
28+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
dist/
3+
output.txt
4+
setup.txt

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## MarketDataAPI.com — OpenAPI Specifications
2+
3+
# Overview
4+
5+
This repository hosts the official OpenAPI (Swagger) specification files for **MarketDataAPI.com**, enabling
6+
standardized integration with MarketDataAPI’s financial data services.
7+
8+
* Specification standard: **OpenAPI 3.1.0**
9+
* API reference: [https://www.marketdataapi.com/docs](https://www.marketdataapi.com/docs)
10+
11+
# Compatibility
12+
13+
* Fully compliant with **OpenAPI Specification**.
14+
* Suitable for code generation, validation, documentation, and client/server scaffolding.
15+
16+
# Support & Issue Tracking
17+
18+
* Bugs, technical issues, and feature requests: **GitHub Issues**.
19+
* General inquiries and assistance: [https://www.marketdataapi.com/help](https://www.marketdataapi.com/help).
20+
21+
# License
22+
23+
* Open source under the **MIT License**.
24+
* See the `LICENSE` file for full terms.

components/parameters/path.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Path Parameters
4+
version: '1'
5+
6+
components:
7+
parameters:
8+
InstrumentIdentifierPathParam:
9+
name: identifier
10+
in: path
11+
required: true
12+
schema:
13+
$ref: '../schemas/instrument.yaml#/components/schemas/InstrumentIdentifier'

components/parameters/query.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Query Parameters
4+
version: '1'
5+
6+
components:
7+
parameters:
8+
LimitQueryParam:
9+
name: limit
10+
in: query
11+
description: Maximum number of items to return
12+
required: false
13+
schema:
14+
type: integer
15+
minimum: 1
16+
maximum: 100
17+
default: 10
18+
19+
OffsetQueryParam:
20+
name: offset
21+
in: query
22+
description: Pagination offset
23+
required: false
24+
schema:
25+
type: integer
26+
minimum: 0
27+
default: 0

components/responses.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Shared Responses
4+
version: '1'
5+
6+
components:
7+
responses:
8+
BadRequest:
9+
description: Invalid request parameters
10+
content:
11+
application/problem+json:
12+
schema:
13+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
14+
examples:
15+
invalidQuery:
16+
summary: Invalid search query
17+
value:
18+
type: 'https://marketdataapi.com/errors/bad-request'
19+
title: 'Invalid Request Parameters'
20+
status: 400
21+
detail: 'Query parameter ''q'' must be at least 1 character long'
22+
instance: '/v1/instruments?q='
23+
code: 'validation/invalid-parameter'
24+
25+
Unauthorized:
26+
description: Authentication failed
27+
content:
28+
application/problem+json:
29+
schema:
30+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
31+
32+
TooManyRequests:
33+
description: Rate limit exceeded
34+
content:
35+
application/problem+json:
36+
schema:
37+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
38+
39+
PaymentRequired:
40+
description: Subscription required for this endpoint
41+
content:
42+
application/problem+json:
43+
schema:
44+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
45+
46+
Forbidden:
47+
description: Authenticated but forbidden
48+
content:
49+
application/problem+json:
50+
schema:
51+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
52+
53+
NotFound:
54+
description: Resource not found
55+
content:
56+
application/problem+json:
57+
schema:
58+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'
59+
60+
InternalServerError:
61+
description: Unexpected server error
62+
content:
63+
application/problem+json:
64+
schema:
65+
$ref: './schemas/error.yaml#/components/schemas/ProblemDetail'

components/schemas/base.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Base Schemas
4+
version: '1'
5+
6+
components:
7+
schemas:
8+
Meta:
9+
type: object
10+
properties:
11+
total:
12+
type: integer
13+
minimum: 0
14+
example: 100
15+
limit:
16+
type: integer
17+
minimum: 1
18+
maximum: 100
19+
example: 20
20+
offset:
21+
type: integer
22+
minimum: 0
23+
example: 40
24+
took_ms:
25+
type: integer
26+
description: Total execution time in milliseconds
27+
minimum: 0
28+
example: 47
29+
30+
Links:
31+
type: object
32+
properties:
33+
self:
34+
type: string
35+
format: uri-reference
36+
example: '/v1/instruments?limit=20&offset=40'
37+
next:
38+
type: string
39+
format: uri-reference
40+
example: '/v1/instruments?limit=20&offset=60'
41+
prev:
42+
type: string
43+
format: uri-reference
44+
example: '/v1/instruments?limit=20&offset=20'
45+
46+
BaseCollection:
47+
type: object
48+
required: [meta, links, data]
49+
properties:
50+
meta:
51+
$ref: '#/components/schemas/Meta'
52+
links:
53+
$ref: '#/components/schemas/Links'
54+
data:
55+
type: array
56+
items:
57+
type: object
58+
description: The primary data collection; structure varies by endpoint

0 commit comments

Comments
 (0)