Skip to content

Enhancement: Code generation improvements#663

Merged
jasonpaulos merged 3 commits into
developfrom
code-generator-pr-42
Oct 12, 2022
Merged

Enhancement: Code generation improvements#663
jasonpaulos merged 3 commits into
developfrom
code-generator-pr-42

Conversation

@jasonpaulos
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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