# oneOf Form Body Input?

**URL:** <https://softwaremill.community/t/oneof-form-body-input/323>\
**Category:** General\
**Created:** [November 17, 2023, 9:52am UTC](https://softwaremill.community/t/oneof-form-body-input/323 "2023-11-17T09:52:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerryfletch](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/gerryfletch/32/102_2.png) [@gerryfletch](https://softwaremill.community/u/gerryfletch)\
**Post date:** [November 17, 2023, 9:52am UTC](https://softwaremill.community/t/oneof-form-body-input/323/1 "2023-11-17T09:52:36Z")

</div>

Hiya,

I have a generic Form trait with a number of implementations. I would love to be able to specify the input as `.in(formBody[GenericFormTrait])`, or even more ideally, `.in(oneOf[GenericFormTrait](oneOfVariant(formBody[FormA]), oneOfVariant(formBody[FormB]))))` etc. but that doesn’t work.

Instead, I’ve set the input as `formBody[GenericFormTrait]` and written a custom codec that decodes into the specific forms based on a discriminator. The problem is, the forms are pretty complex, so writing a function for each `Map<String, String> => Form` is pretty gruesome. I was really hoping a mixture of Tapir oneOf + discriminators would make this kind of body possible without all the extra work?
