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

Endpoint URL is invalid #49

Closed
chathudan opened this issue Jul 12, 2019 · 3 comments · Fixed by #50
Closed

Endpoint URL is invalid #49

chathudan opened this issue Jul 12, 2019 · 3 comments · Fixed by #50
Assignees
Labels
bug Something isn't working
Milestone

Comments

@chathudan
Copy link

chathudan commented Jul 12, 2019

@cortinico This is with regards to #46 ,

My API base URL is something like this https://example.com/api/v5/ and Retrofit required "/" at the end of the base URL.

Since the plugin add "/" to API @GET("/something") so it goes to
@GET("/something"): https://example.com/something

BUT actually, it should go to https://example.com/api/v5/something which means the API interface should remove "/" @GET("something") . I removed "/" manually and the generated SDK working fine.

How can I resolve this rather modify the generated APIs manually?

NB:

Add trailing slash to base URL, remove leading slash from relative URL.

square/retrofit#907 (comment)

@cortinico
Copy link
Collaborator

Yeah I see your point @chathudan

Just one question, do you have the "basePath" specified in your Swagger file?
Ideally we could remove the trailing slashes for Swagger files that specifies a basePath.

cortinico added a commit that referenced this issue Jul 13, 2019
When generating Retrofit interfaces, we need to remove the leading
slash from the generated path. Having a leading slash will force
the path to be absolute for the host and will make URLs like:
https://petstore.swagger.io/v2/
impossible to call.

Fixes #49
@cortinico cortinico added the bug Something isn't working label Jul 13, 2019
@cortinico cortinico self-assigned this Jul 13, 2019
@cortinico cortinico added this to the 1.2.0 milestone Jul 13, 2019
@cortinico
Copy link
Collaborator

A potential fix is in this draft PR #50
I'd love to get @macisamuele on this discussion as well.

Anyway also the PetStore specs are affected by this bug, so is definitely worth to fix it.

@chathudan
Copy link
Author

@cortinico sorry for the late reply. It has basePath. My swagger same as the petstore does .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants