-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix: Fixes description indenting #691
fix: Fixes description indenting #691
Conversation
When the description field includes a long description it may not be properly rendered, mainly in Kotlin, where the way of managing the text-blocks is different. This PR improves the way descriptions are managed by: - Removes empty lines at the beginning of the text-block - Removes indention due to alignment, but keeps indention in the lines that need it
✅ Deploy Preview for springwolf-ui canceled.
|
I think this issue may be exclusive from Kotlin, when using text-blocks. The change should be transparent (or nearly transparent) for Java code, but we can wrap it in a special setting if needed. |
I am assuming you use multi–line strings aka text blocks. https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-indent.html (I haven't looked through the code. This sounds like a method that should be part of a standard lib) |
Sadly it's not possible. Annotations must be compile-time constants, so it's not possible to do any manipulation, like |
Argh. Unfortunate that https://youtrack.jetbrains.com/issue/KT-22505/Support-calls-to-trimMargin-trimIndent-as-initializer-for-const-vals is not getting resolved. Will review the PR on Friday |
.../src/main/java/io/github/springwolf/core/asyncapi/scanners/common/utils/DescriptionUtil.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/github/springwolf/core/asyncapi/scanners/common/utils/DescriptionUtil.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/github/springwolf/core/asyncapi/scanners/common/utils/DescriptionUtil.java
Outdated
Show resolved
Hide resolved
Kind of unfortunate that there is no nice solution and we have to provide the Utils for it. I think I found some simplifications, but not as much as I wished :(. However, I would add two more test cases: String with no empty lines and null input. |
.../src/main/java/io/github/springwolf/core/asyncapi/scanners/common/utils/DescriptionUtil.java
Outdated
Show resolved
Hide resolved
@sam0r040 All the comments addressed. I also added more tests covering the different corner cases. Coverage is now 100% |
When the description field includes a long description it may not be properly rendered, mainly in Kotlin, where the way of managing the text-blocks is different.
This PR improves the way descriptions are managed by: