# Any resources for json-schema or swagger specs?

**URL:** <https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100>\
**Category:** Learn\
**Created:** [February 5, 2019, 3:04pm UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100 "2019-02-05T15:04:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [February 5, 2019, 3:04pm UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100/1 "2019-02-05T15:04:45Z")

</div>

Curious if anyone is working with json-schema or swagger and authoring packages to help build tools that produce or consume these languages?

There is:

[https://package.elm-lang.org/packages/1602/json-schema/latest/](https://package.elm-lang.org/packages/1602/json-schema/latest/)

And for 0.18 there was:

> **[NoRedInk/json-elm-schema](https://github.com/NoRedInk/json-elm-schema)**
>
> Contribute to NoRedInk/json-elm-schema development by creating an account on GitHub.

  
[https://github.com/the-sett/elm-swagger](https://github.com/the-sett/elm-swagger) (my effort, never completed or published)

I suspect the answer is “no”, but thought I’d check if anyone has something in the pipeline before I pick this up again. Right now, I’d like something that can decode a Swagger 3.0 (OpenAPI) document with the aim of building a nice UI that helps you to explore and comprehend the API and data model that it describes.

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/sebastian/32/98_2.png) [@Sebastian](https://discourse.elm-lang.org/u/Sebastian)\
**Post date:** [February 5, 2019, 11:01pm UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100/2 "2019-02-05T23:01:04Z")

</div>

For OpenApi there is an Elm generator here [https://openapi-generator.tech/docs/generators.html](https://openapi-generator.tech/docs/generators.html). I haven’t used it but worth trying.

---

<div class="post-metadata">

**Author:** ![Herteby](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/herteby/32/1329_2.png) [@Herteby](https://discourse.elm-lang.org/u/Herteby)\
**Post date:** [February 7, 2019, 9:21am UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100/3 "2019-02-07T09:21:29Z")

</div>

Oh, interesting! We use Springfox at work to autogenerate swagger specs for our API, though we’ve only used it for documentation so far.

When I generate the Elm files though all fields become `Maybe` even though they’re not marked as optional in the specs 🤔

Maybe the way to treat these generated types is as a “primer” on top of JSON, but not actually the types you use in your app?

Edit: Oh, I see, they have to be specifically marked as “required”, otherwise they are treated as optional. This is very cool!

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [February 8, 2019, 2:19pm UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100/4 "2019-02-08T14:19:40Z")

</div>

I pinged the author - this is the `json-schema` package to use:

[https://package.elm-lang.org/packages/json-tools/json-schema/latest/](https://package.elm-lang.org/packages/json-tools/json-schema/latest/)

Its a more up to date fork of:

[https://package.elm-lang.org/packages/1602/json-schema/latest/](https://package.elm-lang.org/packages/1602/json-schema/latest/)

presumably to publish under the `json-tools` name.

Seems like this is good replacement for `NoRedInk/json-elm-schema` and provides decoding and encoding of json-schema, as well as a builder DSL for constructing them. So that is a nice starting point for OpenAPI 3.0.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [February 18, 2019, 2:19pm UTC](https://discourse.elm-lang.org/t/any-resources-for-json-schema-or-swagger-specs/3100/5 "2019-02-18T14:19:42Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
