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

fix(generators): bunch of improvements on generator, and 140 width in java #560

Merged
merged 1 commit into from
May 25, 2022

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented May 25, 2022

🧭 What and Why

A bit of rework on generators, to have a more standard way of doing them.
The data is supposed to flow from top to bottom, in this order:

  • processOptions
  • fromOperation
  • postProcessOperationsWithModels
  • postProcessAllModels
  • every small small methods

I've reworked the error handling a bit and harmonized the code.

Since we are in 2022 and everyones owns a 4K monitor I've increased the maximum line length from 80 to 140 char, because it was unreadable in some place (this will create lots of change in the generated client, for the better).

🧪 Test

CI

@millotp millotp self-assigned this May 25, 2022
@netlify
Copy link

netlify bot commented May 25, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit 1d3c2ef
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/628e42430f77a70009c856f6

@algolia-bot
Copy link
Collaborator

algolia-bot commented May 25, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

@millotp millotp requested review from shortcuts and eunjae-lee and removed request for shortcuts May 25, 2022 15:01
@millotp
Copy link
Collaborator Author

millotp commented May 25, 2022

lol 11000 lines freed: 3,737 additions and 14,546 deletions.

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Such a huge clean!!! Nothing to add

{
"files": "*.java",
"options": {
"printWidth": 140
Copy link
Member

Choose a reason for hiding this comment

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

definitely needed!

private List<Object> getPackageDependencies() {
List<Object> result = new ArrayList<Object>();
@Override
public void addDataToBundle(Map<String, Object> bundle) throws GeneratorException {
Copy link
Member

Choose a reason for hiding this comment

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

Does addDataToBundle happens before addExtraToBundle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

addExtraToBundle was a wrapper to catch and exit in case of exception, but this is already handled by the caller, so this function is gone and we call addDataToBundle directly.

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.

3 participants