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

Drop kotlinx.serialization compiler plugin as it's unnecessary #3899

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

whyoleg
Copy link
Collaborator

@whyoleg whyoleg commented Nov 4, 2024

Extracted from #3898, required to be able to update to KGP 2.1.0

@whyoleg whyoleg requested a review from adam-enko November 4, 2024 12:37
@whyoleg whyoleg self-assigned this Nov 4, 2024
@whyoleg whyoleg mentioned this pull request Nov 4, 2024
Comment on lines 48 to 56
fun fromJsonObject(obj: JsonObject): DokkaModuleDescriptionKxs = DokkaModuleDescriptionKxs(
name = obj["name"]!!.jsonPrimitive.content,
modulePath = obj["modulePath"]!!.jsonPrimitive.content,
moduleOutputDirName = obj["moduleOutputDirName"]!!.jsonPrimitive.content,
moduleIncludesDirName = obj["moduleIncludesDirName"]!!.jsonPrimitive.content,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated, because properties with default constructor arguments are optional.

What do you think about adding some tests? To ensure any code changes don't break things in the future.

@adam-enko adam-enko added the runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin label Nov 4, 2024
@whyoleg whyoleg force-pushed the drop-kx.serialization-plugin branch from 1b3e65e to 168c743 Compare January 30, 2025 15:01
@whyoleg whyoleg requested a review from adam-enko January 30, 2025 15:02
Comment on lines +44 to +56
fun toJsonObject(module: DokkaModuleDescriptionKxs): JsonObject = buildJsonObject {
put("name", module.name)
put("modulePath", module.modulePath)
put("moduleOutputDirName", module.moduleOutputDirName)
put("moduleIncludesDirName", module.moduleIncludesDirName)
}

fun fromJsonObject(obj: JsonObject): DokkaModuleDescriptionKxs = DokkaModuleDescriptionKxs(
name = obj.getString("name"),
modulePath = obj.getString("modulePath"),
moduleOutputDirName = obj.getString("moduleOutputDirName", defaultModuleOutputDirName),
moduleIncludesDirName = obj.getString("moduleIncludesDirName", defaultModuleIncludesDirName),
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of these methods, what do you think about exposing a hand written KSerializer<DokkaModuleDescriptionKxs>? It'd be more consistent with the current behaviour, reduce our API surface, and not tie us to a specific format.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really think it's needed here as the implementation of custom serializer will be much more complex than the implementation of those two functions.
I don't see how it will reduce our API surface, as it's internal (overall the whole class should be internal I believe).
The same with specific format - we don't need it now, and as it's an implementation detail we can implement it later if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants