Skip to content

Commit

Permalink
Hopefully make the docs more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfadex committed Jan 17, 2024
1 parent 8d867c9 commit 98e56d5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
23 changes: 2 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,9 @@ To allow developers to generate an Elm module(s) from an OpenAPI Spec. This is p

[A RealWorld app](https://github.com/wolfadex/realworld-app) using a generated SDK to demonstrate how to use it.

## Getting Started
## [Using the CLI](./docs/USAGE.md)

- `npm install -D elm-open-api`
- `node elm-open-api ./page/to/oas.json`

Arguments you can pass:

- `<entryFilePath>`: The path to the Open API Spec, either `.json` or `.y[a]ml`
- Technically the OAS allows for parts of a spec to be in separate files, but this isn't supported yet.
- `[--output-dir <output dir>]`: The directory to output to. Defaults to `generated/`.
- `[--module-name <module name>]`: The Elm module name. Default to `<OAS info.title>`.
- `[--generateTodos <generateTodos>]`: Whether to generate TODOs for unimplemented endpoints, or fail when something unexpected is encountered. Defaults to `no`. To generate `Debug.todo ""` instead of failing use one of: `yes`, `y`, `true`.

## Development

The general flow of the app is: parse args & read in the spec using `elm-pages`, generate the Elm code with `elm-codegen`, and write it to disk using `elm-pages`.

- Clone this repo
- Inside your cloned repo, run `direnv allow`
- Start coding!
- Run `npm run dev <path to oas spec>.json`
- e.g. `npm run dev ./example/github-spec.json` will produce `generated/GitHub_v3_REST_API.elm`
## [Contributing to Development](./docs/CONTRIBUTING.md)

## Thank you

Expand Down
15 changes: 15 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing to Development of this tool

The general flow of the app is:

1. parse args & read in the spec using `elm-pages`
1. generate the Elm code with `elm-codegen`
1. write it to disk using `elm-pages`.

## Getting Started

- Clone this repo
- Inside your cloned repo, run `direnv allow`
- Start coding!
- Run `npm run dev <path to oas spec>`
- e.g. `npm run dev ./example/github-spec.json` will produce `generated/GitHub_v3_REST_API.elm`
16 changes: 16 additions & 0 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# Using the CLI

### Install the CLI:
- `npm install -D elm-open-api`

### Run the CLI:
- `node elm-open-api ./page/to/oas.json`

### Arguments you can pass:

- `<entryFilePath>`: The path to the Open API Spec, either `.json` or `.y[a]ml`
- Technically the OAS allows for parts of a spec to be in separate files, but this isn't supported yet.
- `[--output-dir <output dir>]`: The directory to output to. Defaults to `generated/`.
- `[--module-name <module name>]`: The Elm module name. Default to `<OAS info.title>`.
- `[--generateTodos <generateTodos>]`: Whether to generate TODOs for unimplemented endpoints, or fail when something unexpected is encountered. Defaults to `no`. To generate `Debug.todo ""` instead of failing use one of: `yes`, `y`, `true`.

0 comments on commit 98e56d5

Please sign in to comment.