Skip to content
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

Add YAML formatter #463 #464

Merged

Conversation

lazebny
Copy link
Contributor

@lazebny lazebny commented Jul 1, 2022

There is a basic implementation of YAML format in a ready-to-work state.
A way for improvement is to abstract YAML encoder. Since there is no standard behavior for such encoder that requires additional invesigation.

@lazebny lazebny force-pushed the feature/463-add-yaml-formatter branch from 92e1838 to 28bfd76 Compare July 2, 2022 10:30
@lazebny lazebny requested a review from zorbash July 2, 2022 10:32
@lazebny lazebny force-pushed the feature/463-add-yaml-formatter branch from 28bfd76 to 314cd90 Compare July 3, 2022 05:10
@lazebny lazebny requested a review from zorbash July 3, 2022 05:14
@zorbash
Copy link
Contributor

zorbash commented Jul 3, 2022

Thank you @lazebny just a few remaining comments and we can merge this.

@lazebny lazebny requested a review from zorbash July 4, 2022 05:37
@lazebny
Copy link
Contributor Author

lazebny commented Jul 4, 2022

Thank you @lazebny just a few remaining comments and we can merge this.

Thank you @zorbash for the review! Would you be so kind as to release the new version to hex after merging?

@lazebny
Copy link
Contributor Author

lazebny commented Jul 8, 2022

@zorbash any updates?

@zorbash
Copy link
Contributor

zorbash commented Jul 8, 2022

@lazebny One last thing. We have to update the README here to mention the new task which exports a YAML spec. We should also mention in the readme that {:ymlr, "~> 2.0"} has to be added to the mix file since it's marked as an optional dependency in the mix file of open_api_spex.

If a user doesn't add the yml dependency, they'll see the following error which isn't particularly friendly.

** (UndefinedFunctionError) function nil.encode/2 is undefined
    (open_api_spex 3.11.0) lib/mix/tasks/openapi.spec.yaml.ex:31: Mix.Tasks.Openapi.Spec.Yaml.encode/2
    (open_api_spex 3.11.0) lib/open_api_spex/export_spec.ex:18: OpenApiSpex.ExportSpec.call/3
    (mix 1.13.3) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.13.3) lib/code.ex:1183: Code.require_file/2

@lazebny lazebny force-pushed the feature/463-add-yaml-formatter branch from ead6b86 to b653588 Compare July 8, 2022 14:35
@lazebny
Copy link
Contributor Author

lazebny commented Jul 8, 2022

@lazebny One last thing. We have to update the README here to mention the new task which exports a YAML spec. We should also mention in the readme that {:ymlr, "~> 2.0"} has to be added to the mix file since it's marked as an optional dependency in the mix file of open_api_spex.

If a user doesn't add the yml dependency, they'll see the following error which isn't particularly friendly.

** (UndefinedFunctionError) function nil.encode/2 is undefined
    (open_api_spex 3.11.0) lib/mix/tasks/openapi.spec.yaml.ex:31: Mix.Tasks.Openapi.Spec.Yaml.encode/2
    (open_api_spex 3.11.0) lib/open_api_spex/export_spec.ex:18: OpenApiSpex.ExportSpec.call/3
    (mix 1.13.3) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.13.3) lib/code.ex:1183: Code.require_file/2

@zorbash updated README.md, please re-check

@lazebny lazebny force-pushed the feature/463-add-yaml-formatter branch from b653588 to e8181de Compare July 8, 2022 15:14
@zorbash zorbash merged commit 338434a into open-api-spex:master Jul 8, 2022
@zorbash
Copy link
Contributor

zorbash commented Jul 8, 2022

Thank you @lazebny 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants