# Schema Parsing
The parsing stage in `bindgen.rs` handles two tasks beyond basic schema deserialization.
## Server Base Path Detection
```rust
fn extract_base_path(api: &OpenAPI) -> String {
// Parses api.servers[0].url to extract the path component
// Falls back to "/api/" if no servers are defined
}
```
This detected base path is used for:
1. **Function naming** — Stripping the API prefix from paths to generate clean function names (e.g., path `/api/dcim/devices/` with base path `/api/` becomes function name part `dcim_devices`)
2. **URL construction** — The generated functions append the full path from the spec to `state.base_url`
## Auth Scheme Detection
```rust
fn determine_auth_scheme(api: &OpenAPI) -> AuthType {
// Looks at api.components.security_schemes
// Returns Bearer, Token, Basic, ApiKey, or None
}
```
This detection is used to determine the auth header format in generated path functions. The detected `AuthType` is also used to generate clear code. Currently supported:
| `http` scheme: `bearer` | `Bearer` |
| `http` scheme: `basic` | `Basic` |
| `apiKey` in: `header` | `ApiKey` (custom header name) |
| `oauth2` | `Bearer` |
| `openIdConnect` | `Bearer` |
| No security defined | `None` |