<p>It's not possible to use Sum types with Swagger, see <a href="https://github.com/input-output-hk/plutus/issues/3861" rel="nofollow noreferrer">relevant plutus issue</a>, you need to wait for the following PR adding OpenAPI3 support <a href="https://github.com/input-output-hk/plutus/pull/3807" rel="nofollow noreferrer">https://github.com/input-output-hk/plutus/pull/3807</a></p>

CC BY-SA 4.0
2021-09-16T10:47:31.773Z
2021-09-16T10:47:31.773Z
sorki
<p>If I have</p>
<pre><code>data Thing1 = I Integer | S String
</code></pre>
<p>how do I instantiate <a href="https://github.com/input-output-hk/plutus/blob/58c8b4bde7177a18cd6761ba328bc105e5c82a47/playground-common/src/Schema.hs#L172" rel="nofollow noreferrer"><code>ToSchema</code></a> for it?  Note that deriving doesn't work.</p>
<p>And how about for</p>
<pre><code>data Thing2 = I Integer | S 
</code></pre>

<plutus>
How to instantiate ToSchema for ADT?
# How to instantiate ToSchema for ADT?

(Asked by: username_0 on 2021-09-14)

If I have
data Thing1 = I Integer | S String

how do I instantiate ToSchema for it?  Note that deriving doesn't work.
And how about for
data Thing2 = I Integer | S

**Tags:** plutus

---

## 1 answers

### Answer by username_1 on 2021-09-16. Score: 2 | Accepted answer

It's not possible to use Sum types with Swagger, see [relevant plutus issue](https://github.com/input-output-hk/plutus/issues/3861), you need to wait for the following PR adding OpenAPI3 support <https://github.com/input-output-hk/plutus/pull/3807>


---

