Skip to content

Commit bbcff53

Browse files
authored
feat: adding sdk examples to api reference and enabling the playground (#313)
1 parent fb3a40d commit bbcff53

3 files changed

Lines changed: 50 additions & 7 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check docs config
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'mintlify/docs.json'
7+
8+
jobs:
9+
check-openapi-reference:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Ensure docs.json uses production OpenAPI URL
15+
run: |
16+
EXPECTED_URL="https://app.stainless.com/api/spec/documented/grid/openapi.documented.yml"
17+
if grep -q '"openapi.yaml"' mintlify/docs.json; then
18+
echo "::error file=mintlify/docs.json::docs.json references local 'openapi.yaml' instead of the production Stainless URL."
19+
echo ""
20+
echo "The openapi field must point to:"
21+
echo " $EXPECTED_URL"
22+
echo ""
23+
echo "Local openapi.yaml is only for development (make mint handles this automatically)."
24+
exit 1
25+
fi
26+
echo "docs.json openapi reference looks good."

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ build:
1010
build-openapi:
1111
npm run build:openapi
1212

13+
STAINLESS_OPENAPI_URL := https://app.stainless.com/api/spec/documented/grid/openapi.documented.yml
14+
LOCAL_OPENAPI_PATH := openapi.yaml
15+
1316
mint:
14-
cd mintlify && mint dev
17+
@cd mintlify && \
18+
sed -i.bak 's|$(STAINLESS_OPENAPI_URL)|$(LOCAL_OPENAPI_PATH)|' docs.json && \
19+
trap 'mv docs.json.bak docs.json' EXIT INT TERM; \
20+
mint dev
1521

1622
lint:
1723
npm run lint

mintlify/docs.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,23 @@
268268
},
269269
{
270270
"group": "API documentation",
271-
"openapi": "openapi.yaml"
271+
"openapi": "https://app.stainless.com/api/spec/documented/grid/openapi.documented.yml"
272272
}
273273
]
274274
}
275275
]
276276
},
277+
278+
"api": {
279+
"playground": {
280+
"display": "interactive"
281+
},
282+
"examples": {
283+
"languages": ["curl", "javascript", "kotlin"],
284+
"defaults": "all",
285+
"prefill": true
286+
}
287+
},
277288
"logo": {
278289
"light": "/logo/light.svg",
279290
"dark": "/logo/dark.svg"
@@ -307,6 +318,11 @@
307318
"appearance": "dark"
308319
},
309320
"seo": {},
321+
"integrations": {
322+
"gtm": {
323+
"tagId": "GTM-5R5NP3DS"
324+
}
325+
},
310326
"footer": {},
311327
"head": {
312328
"raw": "<style>@font-face{font-family:\"Suisse Intl\";src:url(\"/fonts/suisse-intl/SuisseIntl-Regular.woff2\") format(\"woff2\");font-weight:400;font-style:normal;font-display:swap;ascent-override:85%;descent-override:15%;line-gap-override:0%}@font-face{font-family:\"Suisse Intl\";src:url(\"/fonts/suisse-intl/SuisseIntl-Book.woff2\") format(\"woff2\");font-weight:450;font-style:normal;font-display:swap;ascent-override:85%;descent-override:15%;line-gap-override:0%}@font-face{font-family:\"Suisse Intl\";src:url(\"/fonts/suisse-intl/SuisseIntl-Medium.woff2\") format(\"woff2\");font-weight:500;font-style:normal;font-display:swap;ascent-override:85%;descent-override:15%;line-gap-override:0%}@font-face{font-family:\"Suisse Intl\";src:url(\"/fonts/suisse-intl/SuisseIntl-Medium.woff2\") format(\"woff2\");font-weight:700;font-style:normal;font-display:swap;ascent-override:85%;descent-override:15%;line-gap-override:0%}@font-face{font-family:\"Suisse Intl Mono\";src:url(\"/fonts/suisse-intl-mono/SuisseIntlMono-Regular-WebXL.woff2\") format(\"woff2\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Suisse Intl Mono\";src:url(\"/fonts/suisse-intl-mono/SuisseIntlMono-Bold-WebXL.woff2\") format(\"woff2\");font-weight:700;font-style:normal;font-display:swap}*{font-feature-settings:\"salt\" on}</style><style>#header:empty,#page-title:empty{display:none!important}</style><script>if(location.pathname==='/'||location.pathname==='/index'||location.pathname===''){document.write('<style>header#header,#page-title,#page-context-menu-button,#page-context-menu,.eyebrow,#pagination,[class*=\"space-y-2\"]>*{display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important;margin:0!important;padding:0!important}</style>');document.documentElement.classList.add('is-homepage');}</script><style>html.is-homepage #pagination,body.is-homepage #pagination,html.is-homepage #footer,body.is-homepage #footer,html.is-homepage header#header,body.is-homepage header#header,html.is-homepage #page-title,body.is-homepage #page-title,html.is-homepage #page-context-menu-button,body.is-homepage #page-context-menu-button,html.is-homepage #page-context-menu,body.is-homepage #page-context-menu,html.is-homepage .eyebrow,body.is-homepage .eyebrow{display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important}</style><script>if(location.pathname==='/flow-builder'){document.write('<style>header#header,#page-title,#page-context-menu-button,#page-context-menu,.eyebrow,#pagination{display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important;margin:0!important;padding:0!important}</style>');}</script><style>html:has(#flow-builder-container) header#header,html:has(#flow-builder-container) #page-title,html:has(#flow-builder-container) .eyebrow,html:has(#flow-builder-container) #page-context-menu-button,html:has(#flow-builder-container) #page-context-menu,html:has(#flow-builder-container) #pagination{display:none!important;visibility:hidden!important;height:0!important;overflow:hidden!important;margin:0!important;padding:0!important}</style>",
@@ -347,10 +363,5 @@
347363
"crossOrigin": "anonymous"
348364
}
349365
]
350-
},
351-
"integrations": {
352-
"gtm": {
353-
"tagId": "GTM-5R5NP3DS"
354-
}
355366
}
356367
}

0 commit comments

Comments
 (0)