Write the OpenAPI spec to a file via environment variable
masterTo automate spec generation in a build process, use the write_and_exit_if_env_var_set(path) method.
If the environment variable OASGEN_WRITE_SPEC=1 is set, the library will write the spec to the provided path and then exit the process. This allows you to generate the file during a build step before running the actual server.
let server = Server::new()
// your routes
.write_and_exit_if_env_var_set("./openapi.yaml")
// .freeze() here, if you're mounting to a server.