-
Notifications
You must be signed in to change notification settings - Fork 1
Improve compatibility with TVDB OpenAPI 3 spec #1
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
Conversation
|
I noticed a warning in IntelliJ - the plugin added the same sourceset to both commonMain and commonTest - this isn't necessary because everything in commonMain is already available in commonTest. The latest commit 2381681 removes the commonTest sourceset |
|
Added a few more changes:
|
|
Hi! Thank you very much for trying it out and submitting improvements! Glad you liked. I noticed that for TVDB the call parameters are not generated. I am not sure if it's your changes (all other tests pass) or there is an issue somewhere deeper. For example TVDB public suspend fun postLogin(): HttpResult<PostLoginResponse, PostLoginResponse401> {
try {
val response = httpClient.post("login") {
(authSchemes["bearerAuth"] as AuthScheme.WithBearer)?.bearer?.let { bearerAuth(it) }}
val result = when (response.status.value) {
200 -> response.body<PostLoginResponse>()
else -> throw UnknownSuccessCodeError(response.body(), response.status.value, response)
}
return HttpResult.Ok(result, response)
}
catch (e: ClientRequestException) {
val responseData: PostLoginResponse401 = when(e.response.status.value) {
401 -> e.response.body<PostLoginResponse401>()
else -> throw e
}
return HttpResult.Failure(responseData, e.response, e)
}
}The yaml does have the body described like this: /login:
post:
summary: create an auth token. The token has one month validation length.
requestBody:
content:
application/json:
schema:
type: object
required:
- apikey
properties:
apikey:
type: string
pin:
type: string
required: trueCan you check please? |
2465f5f to
2e878f8
Compare
This reverts commit b6e0a04c5d2af0cfb609adb86678b1886db7c91b.
2e878f8 to
6fd7642
Compare
|
@watbe The issue I mentioned existed before this PR, sorry. I have fixed it and pushed the changes together with the ones from you. It will be available in 1.0.7. Thank you again for help! |
adeed39 to
a1cfd9c
Compare
a1cfd9c to
0597660
Compare
|
thanks for the fixes @dshatz! I meant to follow up but it dropped off my radar. |
Hi, thanks for your work on this library.
I've been trying to generate a nice Ktor client for the TVDB spec and your generator is one of the easier ones to understand. The TVDB swagger file is here: https://thetvdb.github.io/v4-api/swagger.yml
However, I ran into two issues:
@Serializabledescriptionfields that contained*/to generate invalid Kotlin files.mainbranch didn't compile due to some weird import issues.I've addressed both issues in this PR:
@Serializableto the necessary subclasses forHttp()fun String?.sanitizeForKdoc(): String?which simply escapes any instances of*/in a openapi description.I'll admit the solution for the KDoc sanitization feels a bit "icky" but I wasn't sure how else to do this. Open to suggestions.
Additionally, I've made a few more changes (see comments in this PR):
kotlin.Exceptionas the exception superclass instead ofjava.lang.ExceptionThanks again for this library!