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

Generate types and type specs for all generated functions in aws-elixir and aws-erlang #108

Closed
wants to merge 19 commits into from

Conversation

onno-vos-dev
Copy link
Member

Triggering the build and for now this should be considered a DRAFT and a Request For Feedback. The code is a mess and needs some cleaning up and combing over but opening it up in order to get feedback from others.

Generated aws-elixir code as an example: comparison
Generated aws-erlang code as an example: comparison

Copy link
Contributor

@philss philss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I gave a first pass and it's looking good.

Please let me know when to review again :)

lib/aws_codegen/post_service.ex Outdated Show resolved Hide resolved
lib/aws_codegen/post_service.ex Outdated Show resolved Hide resolved
lib/aws_codegen/rest_service.ex Outdated Show resolved Hide resolved
lib/aws_codegen/rest_service.ex Outdated Show resolved Hide resolved
lib/aws_codegen/types.ex Outdated Show resolved Hide resolved
lib/aws_codegen/util.ex Outdated Show resolved Hide resolved
lib/aws_codegen/util.ex Outdated Show resolved Hide resolved
lib/aws_codegen/util.ex Outdated Show resolved Hide resolved
lib/aws_codegen/util.ex Outdated Show resolved Hide resolved
@aronisstav
Copy link

Solicited opinion: the output comparison of an erlang module looks good enough to me.

I think that it will likely be unreasonably hard to code anything that can "prettify" the "flat", "expanded" generated types, and the point should be more "easier doc generation" than the code itself being small... I didn't check, and I am still not using aws-erlang but perhaps one can offer a minified version of the library without types in that case.

Good job! 😄

@onno-vos-dev
Copy link
Member Author

Solicited opinion: the output comparison of an erlang module looks good enough to me.

I think that it will likely be unreasonably hard to code anything that can "prettify" the "flat", "expanded" generated types, and the point should be more "easier doc generation" than the code itself being small... I didn't check, and I am still not using aws-erlang but perhaps one can offer a minified version of the library without types in that case.

Good job! 😄

I tried to generate the edocs (using rebar3 ex_doc) for the generated types but apparently edoc explodes trying to parse the binaries <<"BinaryThingy">> as if it's an XML-tag so I gotta figure out how to deal with that 👍 But then yes, the idea would be to have good docs on the types and hence aid developers in having more information on what's expected as input into the APIs 👍

Thank you for the comment 🙇‍♂️

lib/aws_codegen/post_service.ex Outdated Show resolved Hide resolved
lib/aws_codegen/rest_service.ex Outdated Show resolved Hide resolved
@onno-vos-dev
Copy link
Member Author

Updated generated code examples that are in the description.

Main changes pushed are:

  • Generate common errors in order to unify types and reduce noise
    • Thanks Jesper (colleague) for that tip ❤️
  • Ensure that for Elixir, typedoc examples are considered code blocks

Reception from colleagues, @LostKobrakai and @philss have been good 👍
I haven't seen anyone yelling "NOOOOO!" on Elixir/Erlang Slack so I'll polish this up over the coming days so we can get this into a mergeable shape 👍 I'm quite happy with how the output looks, just need to polish up some of the cr*ppy code I wrote in this branch 😄

Screenshot 2024-03-13 at 20 58 20

@onno-vos-dev onno-vos-dev force-pushed the add-example-input-to-doc-strings branch from 65210de to 44a1cc4 Compare March 14, 2024 16:06
@onno-vos-dev
Copy link
Member Author

onno-vos-dev commented Mar 14, 2024

  • Get rid of code duplication in .eex modules
  • Move some of this parameter types stuff that currently lives in rest_service.ex to types.ex or a similar module
  • Fix rest_service:join_parameter_types to not have as much nesting
  • Shapes could probably be moved to one module and hence reduce the clauses in types.ex
  • collect_shapes/2 is the same across both post and rest similar with is_input/1
  • Are the things living in Util really living in the right place?

@onno-vos-dev
Copy link
Member Author

Declined in favor of #109 due to wrong branch naming.

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.

4 participants