Skip to content

Generate Elm types and decoders based on a Swagger file

Notifications You must be signed in to change notification settings

orus-io/swagger-elm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swagger Elm

Swagger elm generates types and decoders from Swagger document.

Try it out in the browser!

Note: This project is currently under active and initial development. Thus everything is not finished and there's no guarantee that anything will work as promised. However I'm happy for any testing and feedback I can get.

Installation

  1. npm install ahultgren/swagger-elm -g
  2. Optionally install elm format

Usage (unix)

Using elm-format:

cat swagger.json | swagger-to-elm | elm-format --stdin

Unformatted (no guarantee it will work):

cat swagger.json | swagger-to-elm

Contribution

Help and feedback would be gladly appreciated, but please just drop me a line (an issue) before you start, to prevent wasted effort.

Features

  • Basic decoding of all types (Integer, Float, String, Boolean, Object, Array, Null)
  • $refs
  • Enum for strings
    • Other types (if meaningful)
  • Default values for Integer, Float, String, Boolean
    • Complex types (if meaningful)
  • Sanitization of identifiers
  • Unit tests
  • Dicts (additionalProperties)
  • Recursive types and decoders
  • Encoders
  • Polymorphism (allOf and discriminator)
  • Formats? (datetime, uuid, etc)
  • Deduplication of types and fields

License

ISC

About

Generate Elm types and decoders based on a Swagger file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elm 99.6%
  • JavaScript 0.4%