The general flow of the app is:
- parse args & read in the spec using
elm-pages - generate the Elm code with
elm-codegen - write it to disk using
elm-pages.
Make sure you have Nix installed (with flakes enabled) so you can use the project's development shell. An easy way to satisfy this requirement is the Determinate Nix Installer).
- Clone this repo
- Inside your cloned repo, run
direnv allowto automatically enter the development shell,- if you don't use direnv, run
nix developto manually enter a development shell
- if you don't use direnv, run
- Start coding!
- Run
npm run dev <path to oas spec>- e.g.
npm run dev ./example/github-spec.jsonwill produce:generated/GithubV3RestApi/Api.elm,generated/GithubV3RestApi/Json.elm,generated/GithubV3RestApi/Types.elm, andgenerated/OpenApi/Common.elm
- e.g.
- Please run
npm run test:genwhen making a pull request to ensure that the generated code is correct. (would be nice to have this as part of the CI checks in the future)
src/
├── JsonSchema/ Anything specific to JSON Schema code gen
│ └── Generate.elm
├── OpenApi/ Anything specific to OpenAPI code gen
│ └── Generate.elm
├── Util/ Utility functions for common Elm code,
│ │ similar to the common `Extra.*` packages
│ └── List.elm
├── Cli.elm The main entry point for the tool
├── CliMonad.elm An abstraction for wrapping code gen & warnings
├── Common.elm Common, shared types & functions
└── SchemaUtils.elm Utility functions for working with these Schemas