Skip to content

feat(misk-admin): introspect plain Kotlin data classes for web action form metadata#3807

Draft
kchung wants to merge 1 commit into
cashapp:masterfrom
kchung:chung/feat-request-hints-1yyol
Draft

feat(misk-admin): introspect plain Kotlin data classes for web action form metadata#3807
kchung wants to merge 1 commit into
cashapp:masterfrom
kchung:chung/feat-request-hints-1yyol

Conversation

@kchung
Copy link
Copy Markdown
Contributor

@kchung kchung commented May 8, 2026

Description

The misk-admin web-actions tab renders a request body skeleton in the editor by walking the request type's fields and emitting a JSON template with empty defaults. Currently this only works when the @RequestBody parameter type is a Wire com.squareup.wire.Message. For plain Kotlin data class request types the editor falls back to {}, giving developers no clue what fields the endpoint accepts.

This PR generalizes the existing Wire-only support to also walk plain Kotlin data class request types using Kotlin reflection so generic type parameters like List<Foo> and Map<String, Bar> are first-class.

Scenario. Take an admin endpoint whose request body is a plain Kotlin data class — for example addBrandsToCohort(@RequestBody request: AddBrandsRequest) where:

data class AddBrandsRequest(val brands: List<BrandInput>)
data class BrandInput(val brandToken: String, val locationTokens: List<String>?)

When a developer opens the web-actions tab and selects this endpoint, the editor pre-fills a JSON skeleton.

Before (today, on master):

{}

After (this PR):

{
  "brands": []
}

The editor surfaces field names and type-based defaults at the same level of structural detail Wire users already get.

Scope and non-goals

  • Strictly field discovery (parity with Wire). No new annotations, no semantic example values
  • Map handling mirrors Wire's pre-existing behavior (key skipped, value emitted as repeated)

Testing Strategy

  • added unit tests
  • add integration tests
  • tested it locally with exmplar

Checklist

  • I have added tests to have confidence my changes work as expected.

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