-
Notifications
You must be signed in to change notification settings - Fork 12
Move codegen api to separate package #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
adamdicarlo0
wants to merge
33
commits into
wolfadex:main
from
adamdicarlo0:move-codegen-api-to-separate-package
Closed
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5ab00d5
Move codegen API to separate Elm package
adamdicarlo0 03a1662
Replace elm-placeholder-pkg with (to-be) real package
adamdicarlo0 f9e38db
Flesh out example project, add scripts & docs, clean up
adamdicarlo0 9d31e67
Clean up and simplify
adamdicarlo0 d103146
Minor CONTRIBUTING fixes
adamdicarlo0 ac42431
Add gnused dependency to avoid dev script havoc on macOS
adamdicarlo0 021d6f1
Add safety/better error message if wrong sed is present
adamdicarlo0 c452cac
Small doc fix
adamdicarlo0 af109e0
Add gitignore note
adamdicarlo0 51e1220
Don't run elm-format on generated elm-codegen code
adamdicarlo0 cd59d0f
Add findutils to shell.nix
adamdicarlo0 ead5a0b
Fix a couple things and start adding package docs
adamdicarlo0 4d02e39
Improve format script
adamdicarlo0 477c247
Scripts, CI
adamdicarlo0 1cbfea5
Add package docs, hopefully fix CI
adamdicarlo0 1a63738
Remove no-longer-needed codegen project, packages, etc.
adamdicarlo0 a8b469a
Use tools from nix devShell in CI
adamdicarlo0 efbe082
Dig in deeper / debug
adamdicarlo0 2eea035
Suppress error for unused placeholder module
adamdicarlo0 9a716b5
ci: Clean up, add 'build' step (to make sure it works)
adamdicarlo0 aef5460
Upgrade elm-pages
adamdicarlo0 e51cab4
Desperation
adamdicarlo0 0d53db2
Fix cache keys
adamdicarlo0 45e501f
Desperation
adamdicarlo0 b5e8111
Fix example-using-api in CI
adamdicarlo0 ded0297
Fix TestGenScript
adamdicarlo0 e80b96a
ci: Fix nix store caching
adamdicarlo0 5b07230
Clean up, add back elm-codegen for package folder script
adamdicarlo0 4764546
Fix readme typo
adamdicarlo0 9bb0776
Remove the sync-elm-codegen hack
adamdicarlo0 fa349f8
elm-open-api-codegen: Auto-remove unused Gen modules in codegen script
adamdicarlo0 1d4cdb2
Resolve security vulnerabilities in dependencies
adamdicarlo0 0dad6d0
Simplify example-using-api, improve new READMEs
adamdicarlo0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| codegen/Gen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # elm-open-api-codegen | ||
|
|
||
| Generate Elm code for OpenAPI schemas. This powers | ||
| [elm-open-api-cli][elm-open-api-cli], but can be used directly for more powerful | ||
| customized code generation. | ||
|
|
||
| The main advantage of using this package directly is that you can define your | ||
| own custom formats in Elm, which means you can customize the types and generated | ||
| code based on the `format` listed in your OpenAPI schema. | ||
|
|
||
| See the [example of using this package][example], located in the `-cli` | ||
| repository. | ||
|
|
||
| When running `elm-codegen`--or in any other way modifying this package's | ||
| `codegen/elm.codegen.json` file--be sure to run this script afterward: | ||
|
|
||
| ./scripts/sync-elm-codegen | ||
|
|
||
| This moves the `Gen.*` modules to the `src/` folder, which is necessary because | ||
| the code in this project is part of an Elm _package_, and unlike Elm | ||
| applications, Elm packages do not support specifying extra source directories. | ||
|
|
||
| [elm-open-api-cli]: https://github.com/wolfadex/elm-open-api-cli | ||
| [example]: https://github.com/wolfadex/elm-open-api-cli/tree/main/example-using-api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "elm-codegen-version": "0.6.1", | ||
| "codegen-helpers": { | ||
| "packages": { | ||
| "danfishgold/base64-bytes": "1.1.0", | ||
| "dillonkearns/elm-pages": "10.2.2", | ||
| "elm/bytes": "1.0.8", | ||
| "elm/core": "1.0.5", | ||
| "elm/http": "2.0.0", | ||
| "elm/json": "1.1.3", | ||
| "elm/parser": "1.1.0", | ||
| "elm/time": "1.0.0", | ||
| "elm/url": "1.0.0", | ||
| "justinmimbs/date": "4.1.0", | ||
| "justinmimbs/time-extra": "1.2.0", | ||
| "wolfadex/elm-rfc3339": "2.0.0" | ||
| }, | ||
| "local": [ | ||
| "helpers" | ||
| ] | ||
| } | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB: This file moved to the |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
|
|
||
| { | ||
| "type": "application", | ||
| "source-directories": ["."], | ||
| "elm-version": "0.19.1", | ||
| "dependencies": { | ||
| "direct": { | ||
| "elm/browser": "1.0.2", | ||
| "elm/core": "1.0.5", | ||
| "elm/html": "1.0.0", | ||
| "elm/json": "1.1.3", | ||
| "mdgriffith/elm-codegen": "5.1.1" | ||
| }, | ||
| "indirect": { | ||
| "elm/parser": "1.1.0", | ||
| "elm/time": "1.0.0", | ||
| "elm/url": "1.0.0", | ||
| "elm/virtual-dom": "1.0.2", | ||
| "elm-community/basics-extra": "4.1.0", | ||
| "elm-community/list-extra": "8.6.0", | ||
| "miniBill/elm-unicode": "1.0.2", | ||
| "rtfeldman/elm-hex": "1.0.0", | ||
| "stil4m/elm-syntax": "7.2.9", | ||
| "stil4m/structured-writer": "1.0.3", | ||
| "the-sett/elm-pretty-printer": "3.0.0" | ||
| } | ||
| }, | ||
| "test-dependencies": { | ||
| "direct": {}, | ||
| "indirect": {} | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "type": "package", | ||
| "name": "wolfadex/elm-open-api-codegen", | ||
| "summary": "Code generation used by elm-open-api-cli", | ||
| "license": "BSD-3-Clause", | ||
| "version": "1.0.0", | ||
| "exposed-modules": [ | ||
| "Common", | ||
| "OpenApi.BackendTask", | ||
| "OpenApi.Config" | ||
| ], | ||
| "elm-version": "0.19.0 <= v < 0.20.0", | ||
| "dependencies": { | ||
| "dillonkearns/elm-pages": "10.2.2 <= v < 11.0.0", | ||
| "elm/core": "1.0.5 <= v < 2.0.0", | ||
| "elm/json": "1.1.3 <= v < 2.0.0", | ||
| "elm/regex": "1.0.0 <= v < 2.0.0", | ||
| "elm/url": "1.0.0 <= v < 2.0.0", | ||
| "elmcraft/core-extra": "2.2.0 <= v < 3.0.0", | ||
| "json-tools/json-schema": "1.0.2 <= v < 2.0.0", | ||
| "json-tools/json-value": "1.0.1 <= v < 2.0.0", | ||
| "mdgriffith/elm-codegen": "5.2.0 <= v < 6.0.0", | ||
| "miniBill/elm-fast-dict": "1.2.4 <= v < 2.0.0", | ||
| "myrho/yaml": "1.0.0 <= v < 2.0.0", | ||
| "turboMaCk/non-empty-list-alias": "1.4.0 <= v < 2.0.0", | ||
| "wolfadex/elm-ansi": "3.0.0 <= v < 4.0.0", | ||
| "wolfadex/elm-open-api": "2.0.0 <= v < 3.0.0" | ||
| }, | ||
| "test-dependencies": { | ||
| "elm-explorations/test": "2.2.0 <= v < 3.0.0", | ||
| "miniBill/elm-unicode": "1.1.1 <= v < 2.0.0" | ||
| } | ||
| } |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| # In order for the package to be able to import Gen.* modules, we must put them | ||
| # in `src/`, since Elm packages do not support multiple source directories. | ||
| rm -rf src/Gen 2>/dev/null | ||
| npx --no -- elm-codegen install | ||
| mv codegen/Gen src/ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and similar upgrades were necessary for the
example-using-apiproject to be able to compile.