Skip to content

Commit

Permalink
[AP] cleanup specfiles and sidebar (#872)
Browse files Browse the repository at this point in the history
* start on consolidated AP specfile

* fine-tune some yaml formatting

* move and regenerate anchor-platform api docs

* re-throw on broken links, comment it instead of removing

* make binary file schemas typed as string

https://swagger.io/docs/specification/data-models/data-types/#file

* remove old hand-written category files

* delete old yaml files

* rename files yml -> yaml

* upgrade sdp specfile to openapi v3.1

* rearrange tags in sdp specfile

* reconfig and regenerate sdp spec pages

* remove unused sidebar generator and cleanup config file

* remove unnecessary README files

* fix broken links and anchors

* abstract rpc generation so it can be used for anchor platform, too

* first step toward a generated rpc specfile

* modify rpc method component to take objects instead of strings

* embed examples in rpc spec

* fix a broken link

* remove now unused react component

* correct a filepath in rpc spec validation script

* check that directories exist while building rpc specfiles

* fix some example and schema validation errors

* regenerate specfile docs

* update redocly cli

* improve redocly configs

* regenerate api docs

* remove unnecessary rpc specfile

* modify metamask patch to display relevant server URL for AP

* update openrpc README with some better instructions

* experiment with things apart again

* re-separate anchor platform specfiles into distinct specs

* fix broken links and config to throw on them again

* better word choice

* fix filepath in rpc build script
  • Loading branch information
ElliotFriend authored Aug 13, 2024
1 parent 401c8c3 commit b4a2c49
Show file tree
Hide file tree
Showing 343 changed files with 23,970 additions and 20,962 deletions.
4 changes: 2 additions & 2 deletions docs/data/rpc/api-reference/json-rpc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Soroban-RPC provides an [OpenRPC] specification document that can be used to moc
[JavaScript SDK]: https://github.com/stellar/js-stellar-sdk
[OpenRPC]: https://open-rpc.org/
[methods]: ./methods
[specification document here]: https://raw.githubusercontent.com/stellar/soroban-docs/main/static/openrpc.json
[OpenRPC Playground]: https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/stellar/soroban-docs/main/static/openrpc.json
[specification document here]: https://raw.githubusercontent.com/stellar/stellar-docs/main/static/stellar-rpc.openrpc.json
[OpenRPC Playground]: https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/stellar/stellar-docs/main/static/stellar-rpc.openrpc.json
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getEvents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns contract events
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getEvents" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getEvents")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getFeeStats.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns statistics about charged inclusion fees for Soroban transac
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getFeeStats" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getFeeStats")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getHealth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns node health
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getHealth" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getHealth")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getLatestLedger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns latest known ledger
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getLatestLedger" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getLatestLedger")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getLedgerEntries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ description: Returns ledger entries
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getLedgerEntries" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getLedgerEntries")[0]}
/>

### Generating `keys` Parameters

Expand Down
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getNetwork.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns network config
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getNetwork" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getNetwork")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ description: Returns transaction details

import { CodeExample } from "@site/src/components/CodeExample";
import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getTransaction" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getTransaction")[0]}
/>

### SDK Guide

Expand Down
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getTransactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns list of transactions
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getTransactions" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getTransactions")[0]}
/>
5 changes: 4 additions & 1 deletion docs/data/rpc/api-reference/methods/getVersionInfo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ description: Returns version information
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="getVersionInfo" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "getVersionInfo")[0]}
/>
6 changes: 4 additions & 2 deletions docs/data/rpc/api-reference/methods/sendTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ description: Submits a transaction
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import { CodeExample } from "@site/src/components/CodeExample";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="sendTransaction" platform="soroban" />
<RpcMethod
method={rpcSpec.methods.filter((meth) => meth.name === "sendTransaction")[0]}
/>

### SDK Guide

Expand Down
7 changes: 6 additions & 1 deletion docs/data/rpc/api-reference/methods/simulateTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ description: Submits a trial contract invocation transaction
---

import { RpcMethod } from "@site/src/components/RpcMethod";
import rpcSpec from "@site/static/stellar-rpc.openrpc.json";

<RpcMethod method="simulateTransaction" platform="soroban" />
<RpcMethod
method={
rpcSpec.methods.filter((meth) => meth.name === "simulateTransaction")[0]
}
/>
48 changes: 21 additions & 27 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const config: Config = {
docsPluginId: "classic",
config: {
horizon: {
specPath: "openapi/horizon/bundled.yml", // Path to designated spec file
outputDir: "docs/data/horizon/api-reference", // Output directory for generated .mdx docs
specPath: "openapi/horizon/bundled.yml",
outputDir: "docs/data/horizon/api-reference",
sidebarOptions: {
groupPathsBy: "tagGroup",
},
Expand All @@ -53,37 +53,32 @@ const config: Config = {
id: "platformapis",
docsPluginId: "platforms",
config: {
anchor_platform_api: {
specPath: "openapi/anchor-platform/bundled.yml", // Path to designated spec file
outputDir: "platforms/anchor-platform/api-reference/resources", // Output directory for generated .mdx docs
sidebarOptions: {
groupPathsBy: "tag",
},
template: "src/template.mustache", // Customize API MDX with mustache template
ap_platform: {
specPath: "openapi/anchor-platform/bundled-platform.yaml",
outputDir: "platforms/anchor-platform/api-reference/platform/transactions",
hideSendButton: true,
template: "src/template.mustache",
} satisfies OpenApiPlugin.Options,
anchor_platform_callbacks: {
specPath: "openapi/anchor-platform/bundled_callback.yml", // Path to designated spec file
outputDir: "platforms/anchor-platform/api-reference/callbacks", // Output directory for generated .mdx docs
sidebarOptions: {
groupPathsBy: "tag",
},
template: "src/template.mustache", // Customize API MDX with mustache template
ap_callbacks: {
specPath: "openapi/anchor-platform/bundled-callbacks.yaml",
outputDir: "platforms/anchor-platform/api-reference/callbacks",
hideSendButton: true,
template: "src/template.mustache",
} satisfies OpenApiPlugin.Options,
anchor_custody_api: {
specPath: "openapi/anchor-platform/bundled_custody.yml", // Path to designated spec file
outputDir: "platforms/anchor-platform/api-reference/custody-server", // Output directory for generated .mdx docs
sidebarOptions: {
groupPathsBy: "tag",
},
template: "src/template.mustache", // Customize API MDX with mustache template
ap_custody: {
specPath: "openapi/anchor-platform/bundled-custody.yaml",
outputDir: "platforms/anchor-platform/api-reference/custody",
hideSendButton: true,
template: "src/template.mustache",
} satisfies OpenApiPlugin.Options,
stellar_disbursement_platform: {
specPath: "openapi/stellar-disbursement-platform/bundled.yml", // Path to designated spec file
outputDir: "platforms/stellar-disbursement-platform/api-reference/resources", // Output directory for generated .mdx docs
specPath: "openapi/stellar-disbursement-platform/bundled.yaml",
outputDir: "platforms/stellar-disbursement-platform/api-reference",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: 'tag',
},
template: "src/template.mustache", // Customize API MDX with mustache template
template: "src/template.mustache",
} satisfies OpenApiPlugin.Options,
} satisfies Plugin.PluginOptions,
},
Expand All @@ -96,7 +91,6 @@ const config: Config = {
routeBasePath: "/platforms",
docItemComponent: "@theme/ApiItem",
sidebarPath: require.resolve("./sidebarsPlatforms.js"),
sidebarItemsGenerator: require("./src/sidebar-platforms-generator"),
editUrl: "https://github.com/stellar/stellar-docs/tree/main",
exclude: ['**/component/**', '**/README.md'],
showLastUpdateTime: true,
Expand Down
Loading

0 comments on commit b4a2c49

Please sign in to comment.