Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

jamesbradlee
Copy link
Contributor

@jamesbradlee jamesbradlee commented Apr 19, 2024

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
Copy link
Contributor Author

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

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Jun 15, 2024

@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 bnasslahsen merged commit be9d4f8 into springdoc:main Jun 15, 2024
@jamesbradlee
Copy link
Contributor Author

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?

@bnasslahsen
Copy link
Collaborator

@testersen,

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

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

Successfully merging this pull request may close these issues.

2 participants