Skip to content

Commit

Permalink
[Issue #55] API spec docs (#57)
Browse files Browse the repository at this point in the history
* build: Adds @common-grants/core library
* build: Adds starlight-openapi to dependencies
* feat: Adds TypeSpec server definition
* feat: Adds OpenAPI docs to sidebar
* ci: Adds "TypeSpec" to cspell.json dictionary
* docs: Updates ADRs to match implementation
  • Loading branch information
widal001 authored Jan 29, 2025
1 parent c2a410d commit 3954c60
Show file tree
Hide file tree
Showing 8 changed files with 685 additions and 16 deletions.
10 changes: 9 additions & 1 deletion website/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"ignorePaths": ["dist/", "astro/", "*.svg"],
"dictionaryDefinitions": [],
"dictionaries": [],
"words": ["CDFI", "Diátaxis", "FATA", "FHIR", "namespacing", "transpiles"],
"words": [
"CDFI",
"Diátaxis",
"FATA",
"FHIR",
"namespacing",
"transpiles",
"typespec"
],
"ignoreWords": [],
"import": []
}
2 changes: 2 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
dist/
# generated types
.astro/
# TypeSpec output
tsp-output/

# dependencies
node_modules/
Expand Down
18 changes: 16 additions & 2 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightLinksValidator from "starlight-links-validator";
import starlightOpenAPI, { openAPISidebarGroups } from "starlight-openapi";

// https://astro.build/config
export default defineConfig({
Expand All @@ -10,7 +11,17 @@ export default defineConfig({
base: "simpler-grants-protocol/",
integrations: [
starlight({
plugins: [starlightLinksValidator()],
plugins: [
starlightLinksValidator(),
// Generate the OpenAPI documentation pages.
starlightOpenAPI([
{
base: "reference/api",
label: "CommonGrants API spec",
schema: "./tsp-output/@typespec/openapi3/openapi.Base.yaml",
},
]),
],
title: "CommonGrants",
social: {
github: "https://github.com/HHS/simpler-grants-protocol",
Expand All @@ -33,7 +44,10 @@ export default defineConfig({
},
{
label: "Reference",
autogenerate: { directory: "reference" },
items: [
{ label: "Specification", link: "reference/specification" },
...openAPISidebarGroups,
],
},
{
label: "Decisions",
Expand Down
Loading

0 comments on commit 3954c60

Please sign in to comment.