# Json Schema from Tapir Schema

**URL:** <https://softwaremill.community/t/json-schema-from-tapir-schema/183>\
**Category:** tapir\
**Created:** [April 11, 2023, 11:11am UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183 "2023-04-11T11:11:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamilkloch](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kamilkloch/32/105_2.png) [@kamilkloch](https://softwaremill.community/u/kamilkloch)\
**Post date:** [April 11, 2023, 11:11am UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/1 "2023-04-11T11:11:39Z")

</div>

Hello all,

apologies for a potentially stupid question: would it make sense to generate Json schema from tapir Schema? So far we are using [GitHub - andyglow/scala-jsonschema: Scala JSON Schema](https://github.com/andyglow/scala-jsonschema), but this is yet another derivation path to handle.

---

<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:** [April 11, 2023, 11:58am UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/2 "2023-04-11T11:58:30Z")

</div>

Yes, you can use OpenAPI 3.1 (which isn’t yet supported by swagger, hence it’s not the default), where the schemas are a superset of json schemas as far as I remember. Take a look at [GitHub - softwaremill/sttp-apispec: OpenAPI, AsyncAPI and JSON Schema Scala models.](https://github.com/softwaremill/sttp-apispec), it would be good to know what’s missing (either in code or documentation) to address these use-cases.

---

<div class="post-metadata">

**Author:** ![kamilkloch](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kamilkloch/32/105_2.png) [@kamilkloch](https://softwaremill.community/u/kamilkloch)\
**Post date:** [April 11, 2023, 2:30pm UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/3 "2023-04-11T14:30:11Z")

</div>

Thank you for pointing into this direction! I stumbled uopn `sttp.tapir.docs.apispec.schema.Schemas` but could not find a way to instantiate it, other than to copycat the code from `sttp.tapir.docs.openapi.EndpointToOpenAPIDocs`.

---

<div class="post-metadata">

**Author:** ![kamilkloch](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kamilkloch/32/105_2.png) [@kamilkloch](https://softwaremill.community/u/kamilkloch)\
**Post date:** [April 12, 2023, 1:43pm UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/4 "2023-04-12T13:43:35Z")

</div>

I believe we are missing an api which would allow to convert `sttp.tapir.Schema` into `sttp.apispec.Schema`. Currently, glue code components are package-private (like `sttp.tapir.docs.openapi.EndpointToOpenAPIDocs`).

---

<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:** [April 12, 2023, 3:04pm UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/5 "2023-04-12T15:04:31Z")

</div>

Ah yes, you are right, that’s not exposed right now. But this can be changed of course 😉

Please create an issue 🙂 And/or a PR - this would probably go to the `apispec-docs` module

Out of curiosity, can you share what is your use-case?

---

<div class="post-metadata">

**Author:** ![kamilkloch](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kamilkloch/32/105_2.png) [@kamilkloch](https://softwaremill.community/u/kamilkloch)\
**Post date:** [April 13, 2023, 11:49am UTC](https://softwaremill.community/t/json-schema-from-tapir-schema/183/6 "2023-04-13T11:49:48Z")

</div>

Here is the ticket (no PR ☹ ) with some rationale: [Expose converters from tapir Schema to Json Schema (sttp.apispec.Schema) · Issue #2838 · softwaremill/tapir · GitHub](https://github.com/softwaremill/tapir/issues/2838)
