-
Notifications
You must be signed in to change notification settings - Fork 419
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
base: master
Are you sure you want to change the base?
Conversation
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, | ||
) |
There was a problem hiding this comment.
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.
1b3e65e
to
168c743
Compare
168c743
to
b449849
Compare
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), | ||
) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Extracted from #3898, required to be able to update to KGP 2.1.0