Skip to content

Revisit schema. Generate Kotlin code from json-schema #185

@devcrocod

Description

@devcrocod

Currently, the model classes are written by hand and not in sync with the specification.

The good news is that there is a Json-Schema for the protocol and pojos can be generated automatically.

ToDo

  • Consider openapi-generator gradle plugin to generate model classes. Generate classes to io.modelcontextprotocol.kotlin.sdk.model
  • Remove generated classes out of types.kt. types.kt has degraded; it has become too huge. Consider extending hand-written classes from generated ones, marking hand-written classes as deprecated and remove them completely on the next releae
  • Move serializers to a separate package, e.g. io.modelcontextprotocol.kotlin.sdk.model.serializers.
  • Add comprehensive JSON serialization/deserialization tests

DoD

  • Model classes are generated as a build step from the JSON schema
  • Unit tests for JSON serialization exist and are green. Test coverage is 100% for model classes. Take sample jsons from the latest specification

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions