Skip to content

How to make openapi server implementation revisable? #118

Closed

Description

@schlichtanders

Hi there, I cannot get Revise work together with OpenAPI.jl generated code and corresponding handler implementation.
Is this is just not supported? (Or may I just be confused and it works for others seamlessly?)

Activity

  1. tanmaykm commented on Sep 19, 2026

    @tanmaykm
    Member

    Revise should work, but it needs you to use invokelatest on your side. Revise does update your handler. The problem is the running server uses the method version that the server task started with. HTTP.jl 1.x hid this by calling every handler through Base.invokelatest whereas HTTP.jl 2.x, which OpenAPI.jl 1.x uses, does not.

    The right way to do it now it to wrap the generated handlers with Base.invokelatest for register!. It is not the default anymore because Base.invokelatest cannot be compiled with Julia's --trim option, and we want generated servers to stay usable there.

    using Revise
    includet("Handlers.jl")
    include("ExampleServer.jl")
    
    router = HTTP.Router()
    ExampleServer.register!(router, Handlers;
        middleware = h -> (request -> Base.invokelatest(h, request)))
    server = HTTP.serve!(router, "127.0.0.1", 8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions