davidmoten / openapi-codegen

OpenAPI Java client and Spring server generator, strong typing, immutability, fail-fast validation, chained builders, feature rich
Apache License 2.0
8 stars 1 forks source link

add static first mandatory field builder factory method to generated classes #63

Closed davidmoten closed 1 year ago

davidmoten commented 1 year ago

Provides a shortcut for builder use. For example you can omit the first .builder() call:

Circle circle = Circle
    .latitude(Latitude.value(-10))
    .longitude(Longitude.value(140))
    .radiusNm(200)
    .build();

or, as was available previously:

Circle circle = Circle
    .builder()
    .latitude(Latitude.value(-10))
    .longitude(Longitude.value(140))
    .radiusNm(200)
    .build();
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 92.85% and project coverage change: +0.09% :tada:

Comparison is base (608551a) 79.72% compared to head (6701acb) 79.82%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #63 +/- ## ============================================ + Coverage 79.72% 79.82% +0.09% - Complexity 845 849 +4 ============================================ Files 42 42 Lines 2999 3013 +14 Branches 450 453 +3 ============================================ + Hits 2391 2405 +14 + Misses 446 445 -1 - Partials 162 163 +1 ``` | [Files Changed](https://app.codecov.io/gh/davidmoten/openapi-codegen/pull/63?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dave+Moten) | Coverage Δ | | |---|---|---| | [...en/oa3/codegen/generator/writer/BuilderWriter.java](https://app.codecov.io/gh/davidmoten/openapi-codegen/pull/63?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dave+Moten#diff-b3BlbmFwaS1jb2RlZ2VuLWdlbmVyYXRvci9zcmMvbWFpbi9qYXZhL29yZy9kYXZpZG1vdGVuL29hMy9jb2RlZ2VuL2dlbmVyYXRvci93cml0ZXIvQnVpbGRlcldyaXRlci5qYXZh) | `86.90% <92.85%> (+0.35%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/davidmoten/openapi-codegen/pull/63/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dave+Moten)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.