Skip to content

Apply schema-kenerator core annotations in kotlinx JSON schemas - #661

Open
aladh wants to merge 1 commit into
restatedev:mainfrom
aladh:kotlinx-schema-annotations
Open

aladh wants to merge 1 commit into
restatedev:mainfrom
aladh:kotlinx-schema-annotations

Conversation

@aladh

@aladh aladh commented Nov 15, 2026 •

Copy link
Copy Markdown

DefaultJsonSchemaFactory never runs schema-kenerator's annotation step, so @Description and the other core annotations on kotlinx types are silently dropped from handler JSON schemas. The Jackson serde already emits @JsonPropertyDescription/@JsonClassDescription via victools' JacksonModule.

This adds .handleCoreAnnotations() after generateJsonSchema, plus a test covering class and property descriptions.

@Serializable
data class Greeting(
    @Description("Who to greet") val name: String,
    @Description("How many times to greet") val count: Int = 1,
)

Notes:

  • Schemas only change for types that already use the core annotations (@Description, @Title, @Example, @Deprecated, @Format, @Required, @Optional, @Type, @Default); existing schema tests are unchanged. @Required/@Optional now affect required, and @Default is written as a JSON string (schema-kenerator behaviour).
  • To use the annotations, users currently need to add io.github.smiley4:schema-kenerator-core themselves, since sdk-serde-kotlinx declares it as implementation. Happy to switch it to api if you prefer.

🤖 Generated with Claude Code

DefaultJsonSchemaFactory now runs handleCoreAnnotations(), so
annotations such as @description on kotlinx request and response types
show up in handler JSON schemas, matching the Jackson serde, which
already picks up @JsonPropertyDescription.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@aladh

aladh commented Nov 15, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant