Skip to content

Commit

Permalink
Merge pull request #146 from wolfadex/wolfadex/version-0-7-0
Browse files Browse the repository at this point in the history
Version bump and doc updates
  • Loading branch information
wolfadex authored Sep 23, 2024
2 parents 748262a + db38d60 commit 61afcb3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.7.0] - 2024-09-23

### Added
- Add documentation for generated types. [Leonardo Taglialegne](https://github.com/miniBill)

- Documentation for generated types. [Leonardo Taglialegne](https://github.com/miniBill)
- A new record type for generated endpoints. [Leonardo Taglialegne](https://github.com/miniBill)
- This allows for incorporating with your own custom HTTP approach.
- Support for multiple servers as a CLI argument. [Leonardo Taglialegne](https://github.com/miniBill)
- Support for overriding portions of an OAS with the `--overrides` CLI argument. [Leonardo Taglialegne](https://github.com/miniBill)
- Support for writing the overridden OAS to a file. [Leonardo Taglialegne](https://github.com/miniBill)
- Support for `date` and `date-time` types. [Leonardo Taglialegne](https://github.com/miniBill)
- If your OAS has these types, you'll need these additional dependencies:
- [wolfadex/elm-rfc3339](https://package.elm-lang.org/packages/wolfadex/elm-rfc3339/latest)
- This is the core new requirement as JSON Schema `date` and `date-time` are in [RFC-3339](https://json-schema.org/understanding-json-schema/reference/string#dates-and-times) format
- [justinmimbs/time-extra](https://package.elm-lang.org/packages/justinmimbs/time-extra/latest)
- [justinmimbs/date](https://package.elm-lang.org/packages/justinmimbs/date/latest)
- [elm/time](https://package.elm-lang.org/packages/elm/time/latest)
- [elm/parser](https://package.elm-lang.org/packages/elm/parser/latest)

### Changed

- General documentation cleanup. [Leonardo Taglialegne](https://github.com/miniBill)
- Improved handling of bytes. [Leonardo Taglialegne](https://github.com/miniBill)
- When there's a single error, don't define a custom type for it. [Leonardo Taglialegne](https://github.com/miniBill)
- Enums are now custom types not `String`s. [Leonardo Taglialegne](https://github.com/miniBill)
- Improved errors for Swagger files. [Leonardo Taglialegne](https://github.com/miniBill)

## [0.6.1] - 2024-07-23

### Fixed

- Decoding a `String` as a `String` and not as JSON. ✨ [Leonardo Taglialegne](https://github.com/miniBill)


## [0.6.0] - 2024-07-16

### Added
Expand Down
26 changes: 14 additions & 12 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

### Install the CLI:

- `npm install -D elm-open-api`
- `npm install -D elm-open-api`

### Run the CLI:

- `npx elm-open-api ./page/to/oas.json`
- `npx 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>`.
- `[--auto-convert-swagger]`: If passed in, and a Swagger doc is encountered, will attempt to convert it to an Open API file. If not passed in, and a Swagger doc is encountered, the user will be manually prompted to convert.
- `[--swagger-conversion-url]`: The URL to use to convert a Swagger doc to an Open API file. Defaults to `https://converter.swagger.io/api/convert`.
- `[--swagger-conversion-command]`: Instead of making an HTTP request to convert from Swagger to Open API, use this command.
- `[--swagger-conversion-command-args]`: Additional arguments to pass to the Swagger conversion command, before the contents of the Swagger file are passed in.
- `[--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`.

- `<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>`.
- `[--auto-convert-swagger]`: If passed in, and a Swagger doc is encountered, will attempt to convert it to an Open API file. If not passed in, and a Swagger doc is encountered, the user will be manually prompted to convert.
- `[--swagger-conversion-url]`: The URL to use to convert a Swagger doc to an Open API file. Defaults to `https://converter.swagger.io/api/convert`.
- `[--swagger-conversion-command]`: Instead of making an HTTP request to convert from Swagger to Open API, use this command.
- `[--swagger-conversion-command-args]`: Additional arguments to pass to the Swagger conversion command, before the contents of the Swagger file are passed in.
- `[--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`.
- `[--overrides <file path>]`: Load an additional file to override parts of the original Open API file.
- This is most commonly used for malformed OAS files (e.g. missing `required` on a required field) but can be used for anything you want
- `[--write-merged-to <file path>]`: Write the merged Open API spec to the given file (see `--overrides` for merging).
## Example outputs:

Assume we have an OAS file named `my-cool-company-oas.json` and it has a field `"title": "My Coool Company"` and we run the CLI like so
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elm-open-api",
"version": "0.6.1",
"version": "0.7.0",
"description": "A tool for generating Elm SDKs from OpenAPI Specs.",
"main": "dist/elm-open-api.js",
"bin": "dist/elm-open-api.js",
Expand Down

0 comments on commit 61afcb3

Please sign in to comment.