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

Enhancement: Code generation improvements #663

Merged
merged 3 commits into from
Oct 12, 2022
Merged

Conversation

jasonpaulos
Copy link
Contributor

@jasonpaulos jasonpaulos commented Sep 29, 2022

This PR contains improvements from algorand/generator#42.

@jasonpaulos jasonpaulos changed the title Code generation improvements Enhancement: Code generation improvements Sep 29, 2022
@jasonpaulos jasonpaulos marked this pull request as ready for review October 12, 2022 17:24
Copy link
Contributor

@algochoi algochoi left a comment

Choose a reason for hiding this comment

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

Looks good - is our new approach to always use generated models for algod/indexer responses going forward?

@jasonpaulos
Copy link
Contributor Author

Generally speaking, yes, I think we should add a prepare method to any new request classes which uses the generated models to decode the response. For example,

// eslint-disable-next-line class-methods-use-this
prepare(body: Record<string, any>): Box {
return Box.from_obj_for_encoding(body);
}

Copy link
Contributor

@michaeldiamant michaeldiamant left a comment

Choose a reason for hiding this comment

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

I visually spot-checked several generated examples confirming they match the OpenAPI specification + existing parts of the repo.

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

Successfully merging this pull request may close these issues.

4 participants