# OpenAPI Codegen failing for "Given type is not array!"

**URL:** <https://softwaremill.community/t/openapi-codegen-failing-for-given-type-is-not-array/153>\
**Category:** tapir\
**Created:** [March 20, 2023, 11:55pm UTC](https://softwaremill.community/t/openapi-codegen-failing-for-given-type-is-not-array/153 "2023-03-20T23:55:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![windymelt](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/windymelt/32/114_2.png) [@windymelt](https://softwaremill.community/u/windymelt)\
**Post date:** [March 20, 2023, 11:55pm UTC](https://softwaremill.community/t/openapi-codegen-failing-for-given-type-is-not-array/153/1 "2023-03-20T23:55:17Z")

</div>

Hi, I’m trying to call OpenAI API via OpenAPI (the service provides openapi yaml file).

When I use tapir codegen plugin, tapir fails:

- `Missing required field`
  - Added `required: []` for that resource and fixed.

- `Given type is not array!`
  - I cannot fix this because it is actually not an array.

Error message follows:

```auto
DecodingFailure(Given type is not array!, List(DownField(CreateCompletionRequest), DownField(schemas), DownField(components)))

```

Corresponding schema is here.

> <https://github.com/openai/openai-openapi/blob/8b9c21f34dd76e5d1f2435c6e80b45ca0a6d2be9/openapi.yaml#L2052>

---

<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:** [March 22, 2023, 9:45am UTC](https://softwaremill.community/t/openapi-codegen-failing-for-given-type-is-not-array/153/2 "2023-03-22T09:45:22Z")

</div>

The codegen plugin is in an experimental stage, quite possible some features are missing. We would need a smaller reproducing example to start fixing this.

However, something that I wanted to do as well (but so far fell short on time 😉 ), is to release an sttp+openapi integration layer, starting by generating the request descriptions using [OpenAPI-codegen](https://github.com/OpenAPITools/openapi-generator). It doesn’t give you tapir endpoint descriptions, but you get [sttp client](https://sttp.softwaremill.com/en/stable/) request descriptions - not sure if that will be enough for your use-case?
