Description
Middleware : https://swiftpackageindex.com/apple/swift-openapi-runtime/1.0.0/documentation/openapiruntime/servermiddleware
Example : pass authentication information to the service
Possibly even for the already-authenticated requests, a middleware could extract the information about the user and put it into a task local value, making it easy to access from the generated handlers. This pattern is shown in this example.
Middleware extracts the info and puts it into a task local: https://github.com/apple/swift-openapi-generator/blob/main/Examples/auth-server-middleware-example/Sources/AuthenticationServerMiddleware/AuthenticationServerMiddleware.swift
The developer uses it in their generated handler: https://github.com/apple/swift-openapi-generator/blob/cd88cbe95c764553c0e7e04c2c1fb25d8ba5ae34/Examples/auth-server-middleware-example/Sources/HelloWorldVaporServer/HelloWorldVaporServer.swift#L26