Closed ladiesman218 closed 3 months ago
Hi @ladiesman218,
if you have a server defined in the OpenAPI document, you can use it from Swift code as follows:
try handler.registerHandlers(on: transport, serverURL: Servers.server1())
Only pass in a manually constructed URL if you need to provide a server URL not defined in the OpenAPI document.
Does that help?
Definitely. Thx I used this: https://github.com/apple/swift-openapi-generator/blob/main/Examples/hello-world-vapor-server-example/Sources/HelloWorldVaporServer/HelloWorldVaporServer.swift 😂
Will close this
Motivation
In
If I made a typo in
serverURL
parameter, I can use the mis-typed url instead of the one defined inopenapi.yaml
file. Is it better to throw an error if this happens? Say for example in myopenapi.yaml
file, I haveBut in the above function I typed
/aoi
, I could still use127.0.0.1:8080/aoi
to access the endpoint instead of getting an error.Proposed solution
Throw error if this happens
Alternatives considered
No response
Additional information
No response