# Create Codec for NonEmptyList\[String\]

**URL:** <https://softwaremill.community/t/create-codec-for-nonemptylist-string/193>\
**Category:** tapir\
**Created:** [May 8, 2023, 7:42pm UTC](https://softwaremill.community/t/create-codec-for-nonemptylist-string/193 "2023-05-08T19:42:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bclouser](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/bclouser/32/108_2.png) [@bclouser](https://softwaremill.community/u/bclouser)\
**Post date:** [May 8, 2023, 7:42pm UTC](https://softwaremill.community/t/create-codec-for-nonemptylist-string/193/1 "2023-05-08T19:42:51Z")

</div>

Hello,

This is surely a noob question, but i’ve been struggling to make a codec for query parameters whose high-level value is `NonEmptyList[String]`.

I have an OK handle on making Codec’s for custom types (though mostly i just use circe’s codecs), but making a codec of type `Codec[List[String], NonEmptyList[String], TextPlain]` has me confused since it’s a list and not a normal custom type so i cant just use `Codec.mapDecode()`…

Feel free to just point me somewhere this has already been explained if it has.

Cheers,  
Ben

---

<div class="post-metadata">

**Author:** ![adamw](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/adamw/32/28_2.png) [@adamw](https://softwaremill.community/u/adamw)\
**Post date:** [May 9, 2023, 7:15am UTC](https://softwaremill.community/t/create-codec-for-nonemptylist-string/193/2 "2023-05-09T07:15:09Z")

</div>

I think it should be sufficient to import `import sttp.tapir.integ.cats.codec._` using tapir-cats: [Datatypes integrations — tapir 1.x documentation](https://tapir.softwaremill.com/en/latest/endpoint/integrations.html#cats-datatypes-integration)

The following seems to work (well, compile 🙂 ):

```plaintext
import cats.data.NonEmptyList
import sttp.tapir._
import sttp.tapir.integ.cats.codec._

object X extends App {
  query[NonEmptyList[String]]("x")
}

```
