* issue-20804: Add nullability annotations to Java generated clients
Motivation:
Be able to use generated clients in code checked by tools like NullAway.
* issue-20804: Add nullability annotations to Java generated clients
Motivation:
Be able to use generated clients in code checked by tools like NullAway.
* issue-20804: Add nullability annotations to Java generated clients
Motivation:
Be able to use generated clients in code checked by tools like NullAway.
* Revert "v7.12.0 release"
This reverts commit 073723cb4d41187f839fbb46565d109293fa22d7.
* set version to v7.13.0-SNAPSHOT
* update samples
* update doc
* made Configuration.defaultApiClient volatile so that if it's changed the new value is immediately visible to all other threads
* made no-arg api ctor use Configuration.getDefaultApiClient() instead of creating new ApiClient every time
* replaced all use of URLEncoder.encode with ApiClient.urlEncode; just code cleanup; no functional changes
* disabled AbstractJavaCodegenTest.testGeneratedExampleValues as it fails, possibly due to timezone (Locale.ROOT) of local system
* replaced thread-unsafe SimpleDateFormat with DateTimeFormatter and re-enabled unit-test
* removed unused import
* ran the generate-sample scripts and generated a HUGE number of changes!
* added missing import of Configuration to api.mustache (and, thus, all native samples)
* added missing import for ApiClient to anyof and oneof model mustaches
* replace removed forkMode
* remove junit runner where it's not needed
* update samples without skipping test files, but skip files named "FILES"
* revert overwriting custom tests, add custom java tests to list
* add one sample to CircleCI, fix various Java tests
* issue-1960: Add nullability annotations to Java generated clients
Motivations:
Have generated clients properly annotated for nullability to be able to check code using them with tools like NullAway
Modifications:
* Add nullable_var_annotations template to handle nullability annotation on vars
* Add pojo templates to use the nullability template
* Adapt tests
* issue-1960: Add nullability annotations to Java generated clients
Modifications:
* Run export_docs_generator.sh script to update samples
* [Java] Add a new additional property to configure Jackson's `failOnUnknownProperties`
* Move `FAIL_ON_UNKNOWN_PROPERTIES` property to JavaClientCodegen
* Template `FAIL_ON_UNKNOWN_PROPERTIES` for other libraries beside retrofit2
* Default `failOnUnknownProperties` to false for all Java Client libraries
* Fix integration tests
Add the `failOnUnknownProperties: true` additional properties to generate the
expected mapper
* Fix XML annotations on model properties (JavaSpring)
* generate JAXB annotations for attributes and elements
* generate wrapper annotations (JAXB and Jackson)
* use XML config from items for annotations of containers
* Add test for Jackson XML wrapper correctness
* Add additional test cases to cover all xml applications in spec
Test now covers all use cases described in
- https://web.archive.org/web/20240424203304/https://swagger.io/docs/specification/data-models/representing-xml/
- https://spec.openapis.org/oas/v3.0.0#xml-arrays
* Fix basename used instead of xmlName when items.xmlName is unset
See last example in spec: https://spec.openapis.org/oas/v3.0.0#xml-arrays
* Harmonize spacing between Annotation attribute name and value
* Refactor and group JAXB vs. Jackson XML annotations, only generate latter if enabled
This is in line with the way the class annotations in `xmlAnnotations.mustache`
are rendered – which only renders the `@Jackson`… xml annotations if
additionalProperty jackson is true.
Also reorder annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)
* Explicitly render `useWrapping = true` to @JacksonXmlElementWrapper
This was slightly inspired by @jzrebiec via PR #5371.
Wrapping is the default since Jackson 2.1 – so explicitly rendering
this will:
- make generated model work out-of-the-box in Jackson 2.0 for instance
- ensure the models still work if the local `XmlWrapper` was
configured with `useXmlWrapper(false)`
* Move xml test spec to java resources folder (not spring specific)
* Make test class name match class-under-test
This makes discovery & cross-navigation in IDE easier.
* Add complete xml annotations test for Java generators
* Fix Java PKMST generator not generating @JacksonXmlElementWrapper
* Fix Java microprofile generator missing @JacksonXmlRootElement
* Fix Java microprofile generator not using wrapper annotations and namespaces
* Fix Java Micronaut Client creating invalid (unclosed) @XmlAttribute annotations
* Fix Micronaut Client using wrong localName for @JacksonXmlElementWrapper
* Fix Micronaut client rendering @JacksonXmlProperty annotation twice
* Make Java Micronaut render @JacksonXmlElementWrapper(useWrapping=false) for non-wrapped elements
* Fix Jackson element using `xml.name` when it should be `items.xml.name`
Closes#5989Closes#3223
Relates to #9371
* Fix JAXB element using `baseName` instead of `xmlName` when items.xmlName is unset
* Remove XML generation debug output from templates
* Remove redundant newline between XML class annotations and class
Brings the SpringCodegen in line with other Java Codegen's
* Remove redundant newline between XML setter annotations and setter
* Fix multiline JavaDoc block indentation and format
* Simplify / condense xml annotation template into single lines
May look a bit more complex, but cuts out a lot of repetitiveness.
Also reorders annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)
* Harmonize spacing between Annotation attribute name and value
* Remove unused jackson_annotations partial
Was not referenced anywhere in java-helidon resources folder
---------
Co-authored-by: Christian Schuster <christian@dnup.de>
* Drop separate version property
Not required as all Jackson packages usually tether on a version bump.
* Update Jackson to v2.17.1
* Sync Jackson version used by Spring Boot with project version
* Sync jackson update to v2.17.1 with generator templates
* Regenerate samples with updated versions
* Adjust test to current exception msg behavior
* Add dependency mgmt to ensure matching version for transitive dependencies
* Update library descriptions with correct Jackson version number
* Update library descriptions with correct GSON and JSONB versions
* Update retrofit library description with correct version number
* Update retrofit description to include Jackson as an option
This should have been done as part of in #16853.
* Update remaining libary version descriptions with correct versions
* Generate updated doc
* Update Java version in Github actions
* Generate samples
* [java] Upgrade Gradle wrapper to 8.7
* Generate samples
* [Java] Add resttemplate-jakarta to CI
* Upgrade CI machines to ubuntu-2204:2024.04.4 which use Java 21
* Change CI machines to ubuntu-2204:2024.01.1 which use Java 17
* Change CI machines to ubuntu-2004:2024.01.1
* [ruby] Update Gemfile.locks
* Use gradle wrapper for samples-java-client-jdk17
* Add java-jersey2 sample with mixed oneOf
* [java][jersey2]Fix client generation if oneOf contains an array type
Changes:
* Change jersey2/oneof_model template to use composed schema data
* Change adding of imports in AbstractJavaCodegen to use composed schema data
* Add escapedDataType property to CodegenProperty so that the data type
may be part of identifiers (e.g. in getters)
* Update samples
* Add sample for multiple array in oneOf
* Fix generation of constructors with same erasures
* Update samples again
* Version bump
* Add new sample folders to CI
* Make primitive handling more explicit
* Replace escapedDataType property with Mustache lambda
* Update samples with new primitive handling and sanitization lambda
* #18058 Fix AbstractJavaCodegen.getAccepts() so it returns a String array instead of a comma-separated string, and fixed api.mustache so the @RequestMapping annotation generated produces for x-accepts as a parameter list instead of a (single) string.
* #18058 Updated test case to accept a string array instead of a comma-separated list.
* #18058 Reverted changes on imported compared to the main branch.
* #18058 getAccepts() is now hybrid, and can return both a single String or a String[].
* #18058 Rolled back the hybrid getAccepts(), so it only returns a String array.
* #18058 Updated mustache files to cope with vendorExtensions.x-accepts being a string array instead of a comma-separated string.
* #18058 Generated new sample files with by running `./bin/generate-samples.sh ./bin/configs/*.yaml`
* #18058 Optimization of getAccepts()
* #18058 Regenerated scripts that got broken after resolving conflicts on GitHub
* #18058 Fixed introduced issue with api.mustache causing a redundant accept with @HttpExchange with the PetApi.java, StoreApi.java, and UserApi.java.
* add initial openapi config and java generated files
* add java implementation for adding generator version
* regenerate sample client files
* remove tabs
* only show generated version if build info exists
* set build info for batch generation
* update generator doc for new global flag
* use existing property for generator version
* update templates to include generator version
* update templates for better generator version syntax
* revert undesired changes
* regenerate samples for openapi client
* update templates to correct formatting/newlines
* correct description text and add to usage doc
* add generator cli option for all codegen types
* use more concise version info; update existing codegens to support new prop
* correct wrong prop reference
* add initial test coverage for new prop
* update last (scala) templates with new prop
* update samples after upstream merge
* use consistent version output
* use better sample project id/name
* revert using option for generator version in templates
The EOL is missing so let's add it in order to comply with POSIX standard:
Line
> A sequence of zero or more non- <newline> characters plus a terminating <newline> character.
* Add serialVersionUID to Java apiException.mustache templates
* Use 'enable()' and 'disable()' methods to handle object mapper features in JSON.mustache for the "native" Java generator instead of the deprecated 'configure()'
* Update samples
* fix #16797 and #15796 spring child constructor missing parent params
* root cause and update the DefaultCodegen.java to add missing property when with multi inheritance
* rollback SpringCodegen.java
* update samples
* rollback with master cause #16992 fixed this issue too
* still using orignal design
* catchup master
* catchup master
* catchup master
* fix
* add tests
---------
Co-authored-by: dabdirb <dabdirb@gmail.com>