Skip to content

Docs UI is broken with Fable.Remoting.Suave v4.43.0 #381

@Zaid-Ajaj

Description

@Zaid-Ajaj

Using Fable.Remoting.Suave v4.43.0, the embedded docs application doesn't work.

Repro:

open Fable.Remoting.Suave
open Suave

type ToolApi = {
    hello: unit -> Async<string>
}

let toolApi: ToolApi = {
    hello = fun () -> async { return "Hello from the tool API" }
}

let docs = Remoting.documentation "Tool API" [ ]

let toolApiHandler = 
    Remoting.createApi()
    |> Remoting.fromValue toolApi
    |> Remoting.withDocs "/api/docs" docs
    |> Remoting.buildWebPart

startWebServer defaultConfig toolApiHandler

This spins up a web server at localhost:8080, then navigating to localhost:8080/api/docs shows the following

Image

The problem is that requesting the schema via OPTIONS http://localhost:8080/api/docs/$schema returns a double JSON-ified schema information:

"{\"name\":\"Tool API\",\"routes\":[{\"remoteFunction\":\"hello\",\"httpMethod\":\"GET\",\"route\":\"/ToolApi/hello\",\"description\":\"\",\"alias\":\"hello\",\"examples\":[]}]}"

rather than

{"name":"Tool API","routes":[{"remoteFunction":"hello","httpMethod":"GET","route":"/ToolApi/hello","description":"","alias":"hello","examples":[]}]}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions