Closed haemi closed 3 years ago
I have encountered the same issue.
In my case the servers
are right after info
on the top of the .yml
file:
openapi: 3.0.1
info:
title: ...
description: ...
version: ...
servers:
- url: http://...
...
I haven't looked at SwagGen
implementation, but replacing "API.Server.main
" with the actual url fixes the issue:
public static var `default` = APIClient(baseURL: "http://...")
I found that without specifying tags
, servers
won't show.
Hi i have the same problem. I found that in the template file API.swift the {% if tags%} block is closed at the end of the file, so it turns out that the server code is generated only if there are tags. Perhaps this was done on purpose? I found a diff of a commit that looks like a random bug when refactoring and copying code https://github.com/yonaskolb/SwagGen/commit/950f667f9b1c8af428c53fd461320a4a273ce0b8#diff-5fd3bee400cfc6aadd6d9d1b798792be
I fixed it!
my openapi.yml file has a server entry at the end:
which leads to the following
APIClient.swift
:This gives the compiler error
Type 'API' has no member 'Server'
. Is this a bug in SwagGen oder is something missing in my openapi.yml?