Tools for building Swagger specifications in Elm, and for generating Elm code from them.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Corrected dependencies to use Http 2.0.0. Feb 15, 2019
src Corrected the platform worker program for Elm 19. Feb 8, 2019
.gitignore
LICENSE Corrected license and cleared out non-existant dependencies. Feb 8, 2019
README.md Readme improvements. Nov 14, 2017
elm.json Correcting dependencies. Feb 8, 2019

README.md

Elm Swagger

Swagger specifications (now OpenApi 3.0) can be awkward to write correctly by hand. There are graphical tools to aid with this, but there is also a need to be able to construct correct specifications in code, for example, for code generation purposes.

Swagger specs make use of Json Schemas to define the types of data models that an API can pass over the wire. This tool builds on top of NoRedInk/json-elm-schema, for the Json Schema part, and is written in a style very similar to it. That is, it defines a DSL for building correct Swagger specifications, encoders/decoders for writing/reading Swagger specs as Json, and cli tools for supporting code generation.

Status

This is work in progress, the aims are:

  • DSL for creating Swagger specs in Elm.
  • Encoders/Decoders for Swagger specs.
  • cli tools for turning a Swagger spec into Elm code to interface with that API, on client and server side.

Running the Swagger Specification cli tool.

This will convert a Swagger specification in the Elm DSL to its normal JSON format. See the example/Main.elm for an example program that outputs a swagger specification suitable for running the cli tool against.

(Not yet available - as npm package not published) To install the tool and run it:

npm install -g elm-swagger
elm-swagger Main.elm > swagger.json

To install the tool and test it locally:

npm install cli
cd example
../node_modules/.bin/elm-swagger Main.elm > swagger.json