Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API.Server.main not found #197

Closed
haemi opened this issue Sep 20, 2019 · 4 comments
Closed

API.Server.main not found #197

haemi opened this issue Sep 20, 2019 · 4 comments

Comments

@haemi
Copy link

haemi commented Sep 20, 2019

my openapi.yml file has a server entry at the end:

servers:
- url: http://localhost:8080/
  description: Local development version

which leads to the following APIClient.swift:

public static var `default` = APIClient(baseURL: API.Server.main)

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?

@zntfdr
Copy link
Contributor

zntfdr commented May 29, 2020

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://...")

@Lucien
Copy link

Lucien commented Jul 23, 2020

I found that without specifying tags, servers won't show.

@VitaliyZaharenko
Copy link

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
950f667#diff-5fd3bee400cfc6aadd6d9d1b798792be

@syeutyu
Copy link
Contributor

syeutyu commented Dec 3, 2020

I fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants