mandolin 0.4.7

Input openapi.json/yaml, output server source code in rust.
Documentation
# Mandolin Code Generation Issues Report (Axum Integration)

## 概要
Mandolin を使用して生成された Rust コードにおいて、最新の `axum` (v0.8.x 以降) と組み合わせた際にランタイムパニックおよびルーティングの不具合が発生しました。作者が修正を行うための詳細を以下にまとめます。

## 問題 1: `nest_service("/")` によるパニック

### 現象
`axum_router` 関数内でルーターをマウントする際、ベースパスが `"/"` の場合に `nest_service` を使用すると実行時にパニックが発生します。

### 生成された問題のコード
```rust
pub fn axum_router<S: ApiInterface + Sync + Send + 'static>(instance: S)->axum::Router{
    let instance_arc=std::sync::Arc::new(instance);
    axum::Router::new()
        .nest_service("/", axum_router_operations(instance_arc.clone()))
}
```

### エラーメッセージ
`thread 'main' panicked at ...: Nesting at the root is no longer supported. Use fallback_service instead.`

### 推奨される修正
パスが `"/"` の場合は `nest_service` でラップせず、直接 `axum_router_operations` の結果を返す、あるいはマウント方法を調整する必要があります。

---

## 問題 2: 絶対 URL が `nest_service` に渡される

### 現象
TypeSpec の `@server` デコレータに絶対 URL (例: `https://example.com`) が指定されている場合、それがそのまま `nest_service` の第1引数として生成されます。

### 再現 TypeSpec
```typespec
@server("https://example.com", "Main server")
namespace MyApi;
```

### 生成された問題のコード
```rust
.nest_service("https://example.com", axum_router_operations(...))
```

### エラーメッセージ
`thread 'main' panicked at ...: assertion failed: path.starts_with('/')`

### 推奨される修正
サーバー定義からパス部分(`/api` 等)のみを抽出してマウントに使用するか、絶対 URL の場合は警告を出す等の処理が必要です。

---

## 問題 3: ログ表示におけるダブルスラッシュ

### 現象
`print_axum_router` 関数において、ベースパスが `"/"` の場合に URL 表示が `http://localhost:8080//ui` のようになり、スラッシュが重なります。

### 生成された問題のコード
```rust
pub fn print_axum_router(port:u16){
    println!("http://localhost:{}//ui", port);
}
```

---

## 付録: 再現用データ

### TypeSpec (`main.tsp`)
```typespec
import "@typespec/http";
import "@typespec/openapi3";

using TypeSpec.Http;

@service(#{ title: "Lambda360 API" })
@server("https://example.com", "Main server")
namespace Lambda360;

@route("/hello")
namespace Hello {
  @get op sayHello(): string;
}
```

### OpenAPI (`openapi.json`)
```json
{
  "openapi": "3.0.0",
  "servers": [
    {
      "url": "https://example.com",
      "description": "Main server"
    }
  ],
  "paths": {
    "/hello": {
      "get": {
        "operationId": "Hello_sayHello",
        "responses": { "200": { "description": "OK", "content": { "text/plain": { "schema": { "type": "string" } } } } }
      }
    }
  }
}
```

## 修正後の暫定対応(参考)
利用側では現在、以下のように手動でコードを書き換えて対応しています。
1. `nest_service("/")` を削除し、内部ルーターを直接返却。
2. TypeSpec 側で `@server("/", ...)` と記述。