global: snapshot

This commit is contained in:
nym21
2026-03-02 13:34:45 +01:00
parent 7cb1bfa667
commit 4d97cec869
57 changed files with 1724 additions and 2011 deletions

View File

@@ -93,6 +93,10 @@ impl ApiRoutes for ApiRouter<AppState> {
include_bytes!("./scalar.js.br").as_slice(),
)
}))
.route(
"/.well-known/openapi.json",
get(|| async { Redirect::permanent("/openapi.json") }),
)
.route(
"/api/{*path}",
get(|| async { Redirect::permanent("/api") }),

View File

@@ -40,7 +40,7 @@ impl ApiJson {
/// 16. Remove required arrays from schemas
/// 17. Remove redundant "type": "object" when properties exist
/// 18. Flatten single-element type arrays
/// 19. Replace large enums (>20 values) with string type
/// 19. Replace large enums (>40 values) with string type
fn compact_json(json: &str) -> String {
let mut spec: Value = serde_json::from_str(json).expect("Invalid OpenAPI JSON");
@@ -175,9 +175,9 @@ fn compact_value(value: &mut Value) {
obj.remove("type");
}
// Step 19: Replace large enums (>20 values) with just string type
// Step 19: Replace large enums (>40 values) with just string type
if let Some(Value::Array(enum_values)) = obj.get("enum")
&& enum_values.len() > 20
&& enum_values.len() > 40
{
obj.remove("enum");
}

View File

@@ -29,7 +29,7 @@ pub fn create_openapi() -> OpenApi {
- **Metrics**: Thousands of time-series metrics across multiple indexes (date, block height, etc.)
- **[Mempool.space](https://mempool.space/docs/api/rest) compatible** (WIP): Most non-metrics endpoints follow the mempool.space API format
- **Multiple formats**: JSON and CSV output
- **LLM-optimized**: Compact OpenAPI spec at [`/api.json`](/api.json) for AI tools (full spec at [`/openapi.json`](/openapi.json))
- **LLM-optimized**: [`/llms.txt`](/llms.txt) for discovery, [`/api.json`](/api.json) compact OpenAPI spec for tool use (full spec at [`/openapi.json`](/openapi.json))
### Client Libraries