Skip to content

Anonymous schema nodes and improved intermediate representation

Latest
Compare
Choose a tag to compare
@dragonwasrobot dragonwasrobot released this 10 May 22:02
· 24 commits to master since this release

Changed

  • Simplifies preamble.elm.eex by removing all function imports and instead making qualified function calls, e.g. succeed becomes Decode.succeed in Elm decoders, and similarly for all other library calls expect the decode pipeline calls.
  • Renames Util.elm to Encode.elm and removes function imports turning calls such as encodeRequired into Encode.required.
  • Splits the parsing and decoding for enums into two so the enumDecoder calls a dedicated parseEnum function making it easier to reuse the parseEnum in other contexts.
  • Updates dependencies in the generated .tool-versions, package.json and elm.json files.
  • Now inlines anonymous schema nodes in the generated Elm code to reduce the number of scenarios where we have to auto-generate type names like 'zero' and 'one'.

Fixed / Improved

  • Updates elixir, erlang, mix project and dependency versions.
  • Updates README with updated example output code.
  • Updates example input/output files.
  • Migrates all types to use typed_struct and also adds a proper error_type union type.
  • Now uses proper static URL pointers to JSON schema standards in the generated error messages to reduce risk of these returning 404s in the future.
  • Adds: Github action to build and test the code.
  • Cleans: major refactoring of the code structure such that the EEx templates correspond to the different output types, e.g. product types, sum decoders, list fuzzers, etc., rather than the different input types, e.g. array, object, oneOf, etc.
  • Cleans: related to the above point, all the different output elm types/decoders/encoders/fuzzers now have proper type specifications in the elm_{types,decoders,encoders,fuzzers}.ex util modules.