mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-28 08:39:59 -07:00
global: snapshot
This commit is contained in:
@@ -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") }),
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user