mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-07 03:00:29 +00:00
Move OpenAPI spec from openapi/ into docs/api-reference/
Mintlify requires all referenced files under docs/, so consolidate to a single copy and eliminate the symlink and the copy step in the generate script. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
681791db3f
commit
5eaa653d1f
8 changed files with 2457 additions and 2458 deletions
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
## API workflow
|
||||
|
||||
The OpenAPI spec at `openapi/arc-api.yaml` is the source of truth for the arc-api HTTP interface.
|
||||
The OpenAPI spec at `docs/api-reference/arc-api.yaml` is the source of truth for the arc-api HTTP interface.
|
||||
|
||||
1. Edit `openapi/arc-api.yaml`
|
||||
1. Edit `docs/api-reference/arc-api.yaml`
|
||||
2. `cargo build -p arc-types` — build.rs regenerates Rust types via typify
|
||||
3. Write/update handler in `crates/arc-api/src/server.rs`, add route to `build_router()`
|
||||
4. `cargo test -p arc-api` — conformance test catches spec/router drift
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ async fn health() -> Response {
|
|||
}
|
||||
|
||||
async fn openapi_spec() -> Response {
|
||||
let yaml = include_str!("../../../openapi/arc-api.yaml");
|
||||
let yaml = include_str!("../../../docs/api-reference/arc-api.yaml");
|
||||
let value: serde_json::Value = serde_yaml::from_str(yaml).expect("embedded OpenAPI YAML is invalid");
|
||||
Json(value).into_response()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ fn load_spec() -> openapiv3::OpenAPI {
|
|||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("openapi/arc-api.yaml");
|
||||
.join("docs/api-reference/arc-api.yaml");
|
||||
let text = std::fs::read_to_string(&spec_path).expect("failed to read spec");
|
||||
serde_yaml::from_str(&text).expect("failed to parse spec")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ fn main() {
|
|||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("openapi/arc-api.yaml");
|
||||
.join("docs/api-reference/arc-api.yaml");
|
||||
|
||||
println!("cargo::rerun-if-changed={}", spec_path.display());
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../openapi/arc-api.yaml
|
||||
2448
docs/api-reference/arc-api.yaml
Normal file
2448
docs/api-reference/arc-api.yaml
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -3,7 +3,7 @@ title: "Client SDKs"
|
|||
description: "Language-specific clients generated from the Arc OpenAPI spec"
|
||||
---
|
||||
|
||||
The Arc API is defined by an OpenAPI 3.1 specification (`openapi/arc-api.yaml` in the repository) that serves as the single source of truth for all endpoints, request/response schemas, and parameter definitions. The spec is also available at runtime from the server at `GET /openapi.json`. Both client SDKs below are generated directly from this spec.
|
||||
The Arc API is defined by an OpenAPI 3.1 specification (`docs/api-reference/arc-api.yaml` in the repository) that serves as the single source of truth for all endpoints, request/response schemas, and parameter definitions. The spec is also available at runtime from the server at `GET /openapi.json`. Both client SDKs below are generated directly from this spec.
|
||||
|
||||
## TypeScript (Axios)
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ cd packages/arc-api-client
|
|||
bun run generate
|
||||
```
|
||||
|
||||
This runs `openapi-generator-cli` against `openapi/arc-api.yaml` and writes the generated source into `packages/arc-api-client/src/`.
|
||||
This runs `openapi-generator-cli` against `docs/api-reference/arc-api.yaml` and writes the generated source into `packages/arc-api-client/src/`.
|
||||
|
||||
### Usage
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ The `arc-types` crate generates Rust structs and enums from the OpenAPI componen
|
|||
|
||||
### How It Works
|
||||
|
||||
A `build.rs` script reads `openapi/arc-api.yaml`, extracts `components/schemas`, and feeds them to typify. The generated code is written to `OUT_DIR` and included via:
|
||||
A `build.rs` script reads `docs/api-reference/arc-api.yaml`, extracts `components/schemas`, and feeds them to typify. The generated code is written to `OUT_DIR` and included via:
|
||||
|
||||
```rust
|
||||
// crates/arc-types/src/lib.rs
|
||||
|
|
|
|||
2448
openapi/arc-api.yaml
2448
openapi/arc-api.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"generate": "bunx @openapitools/openapi-generator-cli generate -i ../../openapi/arc-api.yaml -g typescript-axios --additional-properties=supportsES6=true,typescriptThreePlus=true,withSeparateModelsAndApi=true,apiPackage=api,modelPackage=models,useTags=true,enumPropertyNaming=UPPERCASE -o src && cp ../../openapi/arc-api.yaml ../../docs/api-reference/arc-api.yaml"
|
||||
"generate": "bunx @openapitools/openapi-generator-cli generate -i ../../docs/api-reference/arc-api.yaml -g typescript-axios --additional-properties=supportsES6=true,typescriptThreePlus=true,withSeparateModelsAndApi=true,apiPackage=api,modelPackage=models,useTags=true,enumPropertyNaming=UPPERCASE -o src"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue