Skip to content

Commit 15167e4

Browse files
committed
Initial OpenAPI spec setup
0 parents  commit 15167e4

24 files changed

Lines changed: 1871 additions & 0 deletions
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+
- 'endpoints/**.yaml'
8+
- 'responses/**.yaml'
9+
pull_request:
10+
paths:
11+
- 'components/**.yaml'
12+
- 'endpoints/**.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/headers/cache.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Cache Control Headers
4+
version: '1'
5+
6+
components:
7+
parameters:
8+
CacheControl:
9+
name: Cache-Control
10+
in: header
11+
description: Cache control directives
12+
required: false
13+
schema:
14+
type: string
15+
enum:
16+
- 'public, max-age=300, stale-while-revalidate=60'
17+
- 'public, max-age=3600, stale-while-revalidate=300'
18+
- 'private, no-cache, max-age=0'
19+
example: 'public, max-age=300, stale-while-revalidate=60'
20+
21+
ETag:
22+
name: ETag
23+
in: header
24+
description: Entity tag for conditional requests
25+
required: false
26+
schema:
27+
type: string
28+
pattern: '^"[A-Za-z0-9+/=]+"$'
29+
example: '"abc123xyz456"'
30+
31+
LastModified:
32+
name: Last-Modified
33+
in: header
34+
description: Timestamp of last modification
35+
required: false
36+
schema:
37+
type: string
38+
format: date-time
39+
example: '2025-01-15T10:30:00Z'
40+
41+
IfNoneMatch:
42+
name: If-None-Match
43+
in: header
44+
description: ETag value from previous response
45+
required: false
46+
schema:
47+
type: string
48+
pattern: '^"[A-Za-z0-9+/=]+"$'
49+
example: '"abc123xyz456"'
50+
51+
IfModifiedSince:
52+
name: If-Modified-Since
53+
in: header
54+
description: Date from previous response
55+
required: false
56+
schema:
57+
type: string
58+
format: date-time
59+
example: '2025-01-15T09:00:00Z'
60+
61+
headers:
62+
CacheControl:
63+
description: Cache control directives
64+
schema:
65+
type: string
66+
enum:
67+
- 'public, max-age=300, stale-while-revalidate=60'
68+
- 'public, max-age=3600, stale-while-revalidate=300'
69+
- 'private, no-cache, max-age=0'
70+
example: 'public, max-age=300, stale-while-revalidate=60'
71+
72+
ETag:
73+
description: Entity tag for conditional requests
74+
schema:
75+
type: string
76+
pattern: '^"[A-Za-z0-9+/=]+"$'
77+
example: '"abc123xyz456"'
78+
79+
LastModified:
80+
description: Timestamp of last modification
81+
schema:
82+
type: string
83+
format: date-time
84+
example: '2025-01-15T10:30:00Z'

components/headers/rate-limit.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
openapi: 3.1.0
2+
info:
3+
title: MarketDataAPI.com - Rate Limit Headers
4+
version: '1'
5+
6+
components:
7+
parameters:
8+
RateLimitLimit:
9+
name: X-Rate-Limit-Limit
10+
in: header
11+
description: Maximum number of requests allowed in the current time window
12+
required: false
13+
schema:
14+
type: integer
15+
example: 100
16+
17+
RateLimitRemaining:
18+
name: X-Rate-Limit-Remaining
19+
in: header
20+
description: Number of requests remaining in the current time window
21+
required: false
22+
schema:
23+
type: integer
24+
example: 42
25+
26+
RateLimitReset:
27+
name: X-Rate-Limit-Reset
28+
in: header
29+
description: Unix timestamp (seconds) when the rate limit resets
30+
required: false
31+
schema:
32+
type: integer
33+
example: 1736492400
34+
35+
RateLimitPolicy:
36+
name: X-Rate-Limit-Policy
37+
in: header
38+
description: Rate limit policy identifier
39+
required: false
40+
schema:
41+
type: string
42+
example: "free-tier-100-per-day"
43+
44+
headers:
45+
RateLimitLimit:
46+
description: Maximum number of requests allowed in the current time window
47+
schema:
48+
type: integer
49+
example: 100
50+
51+
RateLimitRemaining:
52+
description: Number of requests remaining in the current time window
53+
schema:
54+
type: integer
55+
example: 42
56+
57+
RateLimitReset:
58+
description: Unix timestamp (seconds) when the rate limit resets
59+
schema:
60+
type: integer
61+
example: 1736492400
62+
63+
RateLimitPolicy:
64+
description: Rate limit policy identifier
65+
schema:
66+
type: string
67+
example: "free-tier-100-per-day"

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: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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'
66+
67+
NotModified:
68+
description: Not Modified - data hasn't changed since last request
69+
headers:
70+
X-Rate-Limit-Limit:
71+
$ref: './headers/rate-limit.yaml#/components/headers/RateLimitLimit'
72+
X-Rate-Limit-Remaining:
73+
$ref: './headers/rate-limit.yaml#/components/headers/RateLimitRemaining'
74+
X-Rate-Limit-Reset:
75+
$ref: './headers/rate-limit.yaml#/components/headers/RateLimitReset'
76+
X-Rate-Limit-Policy:
77+
$ref: './headers/rate-limit.yaml#/components/headers/RateLimitPolicy'
78+
Cache-Control:
79+
$ref: './headers/cache.yaml#/components/headers/CacheControl'
80+
ETag:
81+
$ref: './headers/cache.yaml#/components/headers/ETag'
82+
Last-Modified:
83+
$ref: './headers/cache.yaml#/components/headers/LastModified'

0 commit comments

Comments
 (0)