springdoc-openapi icon indicating copy to clipboard operation
springdoc-openapi copied to clipboard

fix: add support for leading tab characters with `trim-kotlin-indent`.

Open jamesbradlee opened this issue 1 year ago • 1 comments

We're using Springdoc with Kotlin + Ktlint. We have configured Ktlint to use tabs instead of spaces as indents.

	@GetMapping("/assets")
	@Operation(
		operationId = "getAssets",
		summary = "Get the assets of the signed in user",
		description = """
			Get the assets owned by the currently signed in user.
		""",
		// ^^^^ Tab characters here turned into a code block.
	)
	@[WithExternalEndUser ScopesAllowed("...")]
	fun getAssets(
		@RequestParam(required = false, defaultValue = "nb-NO") locale: String,
	): List<AssetCard> = TODO()

This pull request appends on the condition in the countLeadingSpaces method where the count loop filters on spaces. The change makes the condition break on a non space or tab character.

jamesbradlee avatar Apr 19 '24 20:04 jamesbradlee

@bnasslahsen Heyo :) Any ETA for when we can look into merging this? Would you like to see any changes in this suggestion?

jamesbradlee avatar Apr 26 '24 07:04 jamesbradlee

@testersen,

Thanks a lot for your contribution to the project. The PR will be merged today. It should be part of the next release, by the end of June in the latest.

bnasslahsen avatar Jun 15 '24 15:06 bnasslahsen

Thanks @bnasslahsen! I also noticed that the current implementation does also not trim whitespace in @Schema annotations in fields such as descriptions - would this be something I should open a pull request for here, or should I do that another place?

jamesbradlee avatar Jun 15 '24 19:06 jamesbradlee

@testersen,

Please feel free to propose another PR and should integrate it.

bnasslahsen avatar Jun 16 '24 09:06 bnasslahsen