Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !11530
An error occurred while fetching the assigned milestone of the selected merge_request.

PROPOSAL: Java AST-based Client

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/eak24/javaparser_ast_client into master 3 years ago
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 5

Created by: eak24

This PR attempts to demonstrate the power, flexibility and maintainability of creating generated code using an AST parser instead of mustache templates. With a very readable 10 lines of code and no mustache templates, I was able to convert a collection of CodeGenModels into valid Java classes with fields and getters and setters, with proper indentation and everything. This method completely outsources the burden of string manipulation, linting and a lot of the frustrating parts of maintaining and thinking about the code structure to the JavaParser package (for Java). I'd argue that reading and thinking about this code is far easier than trying to reason about the combination of Mustache templates and String wrangling that the generators currently use. A downside is that you have to use a different AST generator for each language. But on the other side, that allows for each generator to be written in the language of the generated code itself. This isn't really meant to replace the current generators at all, but rather demonstrate the power of working with the AST directly.

Activity

  • Loading
  • Loading
Please register or sign in to reply
Status
Pipeline
Triggerer
Stages
Actions

2 years ago

Models with setters and getters.
#605
github/fork/eak24/javaparser_ast_client d9df2432
latest Auto DevOps
avatar
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Administrator
William Cheng
Reference: firstcontributions/first-contributions!951
Source branch: github/fork/eak24/javaparser_ast_client

Menu

Explore Projects Groups Snippets