160 Commits

Author SHA1 Message Date
William Cheng
654f62ce3c
Prepare 7.11.0 (#20130)
* Revert "prepare 7.10.0 release (#20128)"

This reverts commit 12dfe8fe74a1515d1e69e00df9abe4128aa44160.

* update to 7.11.0-SNAPSHOT, update samples

* update docs
2024-11-18 20:15:29 +08:00
William Cheng
e2c458b9ea
Prepare 7.10.0 (#19809)
* Revert "prepare 7.9.0 release (#19808)"

This reverts commit 4145000dfebe7a9edea4555c8515383da7602458.

* prepare 7.10.0 snapshot

* update doc

* update samples
2024-10-08 11:21:54 +08:00
William Cheng
91da2fd240
Prepare 7.9.0 snapshot (#19386)
* Revert "v7.8.0 release (#19385)"

This reverts commit 6bdc452f92d49dcac7ac21dfe8751c8cc4267b98.

* update samples for v7.9.0-snapshot
2024-08-19 16:14:51 +08:00
William Cheng
20cfce0b4a
Prepare v7.8.0 (#19048)
* Revert "v7.7.0 release"

This reverts commit f3dd32385e02065ad298801ca11b8871bcb3a92a.

* prepare v7.8.0

* update readme

* update doc

* update samples
2024-07-02 16:45:53 +08:00
Philzen
642b1a3a95
[JAVA] [SPRING] [PKMST] [MICRONAUT] XML wireformat: Fix Jackson useWrapping=false, JAXB+Jackson namespaces (#18870)
* 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 #5989
Closes #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>
2024-06-15 23:02:32 +08:00
William Cheng
741bf0c035
Prepare 7.7.0-SNAPSHOT (#18709)
* Revert "7.6.0 release"

This reverts commit d76f9d32d11a03be2b40ebff728ef0ff86332fcb.

* prepare 7.7.0 snapshot in master

* update samples
2024-05-20 17:27:17 +08:00
William Cheng
807250a430
Prepare 7.6.0 (#18412)
* Revert "v7.5.0 release"

This reverts commit 1eafe2aebf33b13bee0ead66d62a6436e7db059d.

* update master to v7.6.0 snapshot

* update readme

* update samples
2024-04-17 19:05:37 +08:00
Flemming Nørnberg Larsen
a4508f6817
#18058 Fix the Java generator to generate valid @RequestMappings where the produce field takes list of string parameters instead of a single comma-separated string (#18092)
* #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.
2024-03-21 17:53:18 +08:00
Dennis Melzer
96bf7ac915
Fix default empty collections when collection is optional (#18080)
* Fix optional empty collection as default

* Fix test

* Fix test
2024-03-14 20:28:27 +08:00
William Cheng
4ff7e0ec3f
Prepare 7.5.0 snapshot (#18068)
* Revert "7.4.0 release"

This reverts commit eda049348425171df772a7b9087cc97db718cfda.

* prepare 7.5.0 snapshot version

* update samples

* update doc
2024-03-11 11:10:52 +08:00
Ross Bender
cf2435f335
Add support for controlling output of OpenAPI Generator version in generated files (#17952)
* 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
2024-03-09 15:52:08 +08:00
Simon Podlipsky
1e9bccca16
feat: generate EOL in VERSION file (#17829)
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.
2024-02-12 15:40:55 +08:00
William Cheng
783e68c7ac
7.4.0 snapshot (#17818)
* Revert "7.3.0-release (#17817)"

This reverts commit d617b46c86b9075c5e0d63fe3798e2982f5259ac.

* update samples, docs, readme
2024-02-08 16:07:22 +08:00
dabdirb
66a6af5ca4
add lombok model support on spring (#17622)
* add lombok model support on spring

* use regex to adapt annotation with parenthesis

* add ut case

* add samples

* add samples

* fix github workflow

* fix github workflow
2024-01-27 10:45:44 +08:00
William Cheng
75ef9e0b02 update java samples 2024-01-12 12:51:33 +08:00
William Cheng
5eab3cef19
Prepare 7.3.0-SNAPSHOT (#17456)
* Revert "v7.2.0 release (#17455)"

This reverts commit fe638d009363c142c246ff089032f243e0b4ee01.

* set version to 7.3.0-SNAPSHOT

* update doc
2023-12-22 16:55:58 +08:00
Aliaksei
809b3331a9
[4947][java]: adds support for validation of primitives in arrays (#17165)
* [4947][java]: adds support for validation of primitives in arrays

* [4947][java]: prevents generation '@Valid' for Object

* [4947][java]: test against different codegens and stick to primitive

* [4947][java]: code review

* [4947][java]: enhance getBeanValidation

* [4947][java]: adds email

* [4947][java]: removes unnecessary override

* [4947][java]: adds postProcessResponseWithProperty

* [4947][java]: adds missing import {{javaxPackage}}.validation.Valid

* [4947][java]: adds missing useBeanValidation

* [4947][java]: fix use rootJavaEEPackage for helidon
2023-12-11 20:55:38 +08:00
William Cheng
53289263d9
Prepare v7.2.0 (#17050)
* update version to 7.2.0-SNAPSHOT

* update samples

* update doc
2023-11-13 18:53:20 +08:00
Kapil Gupta
c4b18f206d
[Server][Spring] fix support interface and implementation classes for API controllers (#16945)
* [Server][Spring] support interface and implementation classes for API controllers

* Omitted new string calls

* Added Log messages

* remove else

* Removed redundant if

* Update missed ;
2023-11-04 16:52:17 +08:00
dabdirb
739390a682
java exclude password field from toString (#16942) 2023-10-31 17:50:30 +08:00
martin-mfg
e3db882ed4
[JAVA][KOTLIN][SPRING] upgrade dependencies (#16759)
* upgrade spring-boot-starter-parent

* upgrade springdoc and swagger-ui

* upgrade v3 swagger-annotations

* generate samples

* upgrade jackson

* fix spring cloud, remove temp comment

Putting "8" instead of "1.8" should be ok, because Spring Boot 3 requires Java 17 anyway, so it should be able to understand that 8 is the same as 1.8.

* generate samples

* upgrade JUnit 5, remove commons-io dependency, remove outdated samples/client/petstore/java/feign/feign10x/ files, generate samples

commons-io dependency was introduced in https://github.com/OpenAPITools/openapi-generator/pull/8484, but I don't see why it would be needed now or back then.

* update gson, generate samples

* update logback

* update feign

* update scribejava

* generate samples

* update httpmime

* okhttp-gson: update commons-lang & okhttp & junit-platform, remove mockito; generate samples

It seems Mockito is not used at all there.

* okhttp-gson: remove unnecessary sample files, generate sample files

* upgrade google-api-client & jersey-common, restore ClientTest, generate samples

* misc. upgrades in jersey2 and jersey3

jersey 3.1.3 is available already, but IntelliJ reports security problems in 3.1.3 and 3.1.2, so I used 3.1.1 instead.

* align some gradle&sbt files with poms, generate samples

* whitespace fix
2023-10-09 14:55:32 +08:00
krasv
8f8fd85fd6
contribution #6123: add spring support for SSE conform specs (#16543)
* add spring support for SSE conform specs

see https://github.com/OpenAPITools/openapi-generator/issues/6123 for the ongoing discussion

* extend generator option documentation

* applied review suggestions

* regenerated samples

* regenerated docu

* fix code style: removed tabs
2023-09-21 17:08:24 +08:00
William Cheng
5e8e2d7f6d
Prepare v7.1.0 in master (#16608)
* prepare v7.1.0 in master

* update
2023-09-18 17:37:36 +08:00
Robin Jonsson
acb798b58b
[JavaSpring] Call parent fluent setters from child (#16497)
* Call fluent parent setter from child pojo

This closes #16496

* Generate new samples
2023-09-06 11:43:35 +08:00
William Cheng
80121aa88f
Prepare v7.0.1 (#16409)
* prepare 7.0.1 in master

* update doc
2023-08-25 16:11:29 +08:00
William Cheng
e69c58623f update samples 2023-08-17 12:03:43 +08:00
Frederic Jones
3627e57a4c
Add validation.constraints package import to delegates when using bean validation (#15921) 2023-06-26 23:52:38 -07:00
martin-mfg
7e89e1ea81
fix import mapping for return types (#14525) (#15719)
* importContainerType = true

* add unit test

* disable MyImportTest

* build all samples, add import exceptions

* simplify code

* delete myImportTest

* generate docs

* extend comment

* remove inline comment
2023-06-21 15:55:29 +08:00
William Cheng
6788f43af0
Better handling of Inline schema (#15682)
* skip allOf inline subschema created as $ref

* add option for fallback

* add back atleastonemodel

* add log

* update java, kotlin, js samples

* update tests

* fix native client test

* fix java client errors by regenerating test files

* clean up python

* clean up powershell

* clean up php

* clean up ruby

* update erlang, elixir

* update dart samples

* update ts samples

* update r, go samples

* update perl

* update swift

* add back files

* add back files

* remove outdated test files

* fix test
2023-06-11 15:35:58 +08:00
James Wynn
d27fa00cf5
fix: #1466 additionalProperties works now in spring generator (#11572) (fix #1466)
* fix: #1466 additionalProperties works now in spring generator

* chore: chore: #1466 solved rebase conflicts

* 1466; updated samples

* [Spring] update additionalProperties MR

* [Spring] additionalProperties unit test

---------

Co-authored-by: Your Name <benfonty@gmail.com>
Co-authored-by: Oleh Kurpiak <oleh.kurpiak@gmail.com>
2023-06-08 16:38:53 +03:00
martin-mfg
dd6ccaa84f
import @Valid in Spring delegates (#15330) (fix #15213) 2023-05-15 14:55:21 +03:00
Oleh Kurpiak
54cb33c6a1
[Spring] remove deprecated annotation from no-args constructor (#15512) 2023-05-15 14:13:18 +03:00
William Cheng
0c3460f95b Merge remote-tracking branch 'origin/master' into 7.0.x 2023-05-10 15:00:56 +08:00
Oleh Kurpiak
1f23b019fa
[Spring] fix Paginated without params (#15315) (fix #15265) 2023-04-27 14:32:11 +03:00
William Cheng
935146d187 Merge remote-tracking branch 'origin/master' into 7.0.x 2023-04-12 17:51:47 +08:00
William Cheng
5d1e18306a
Prepare 6.6.0-SNAPSHOT (#15100)
* set 6.6.0 snapshot version

* update samples

* update readme
2023-04-01 18:48:01 +08:00
William Cheng
7417432a54
Prepare 6.5.0 release (#15099)
* 6.5.0 release

* update samples
2023-04-01 15:03:35 +08:00
William Cheng
f5e427ad52
Do not add schema / class name mapping where custom mapping exists (#14984)
* fix #13150 Do not add schema / class name mapping where custom mapping exists

* update test spec

* improve import

* fix import for mapped models

* fix python

* code clean up

* fix dart client import

* fix dart:core import

* better import

* add tests

---------

Co-authored-by: Bernie Schelberg <bernard.schelberg@mywave.ai>
2023-03-24 22:20:04 +08:00
César Revert
6e649af9a7
[java-spring] Move JsonProperty annotation from field to getter (#13781) (fix #5705)
* 5705: Move JsonProperty annotation to the getters

* Regenerate samples

* Add jackson check

* Add test

* Minor fix

* Fix test

* Fix version

* [Java][Spring] update test & samples; add serialization/deserialization test

---------

Co-authored-by: Oleh Kurpiak <oleh.kurpiak@gmail.com>
2023-03-19 04:59:48 -07:00
William Cheng
e1719f2b7b
[JavaSpring] migrate config files to use 3.0 spec (#14981)
* update spring config file to use 3.0 spec

* migrate spring config file to use 3.0 spec

* update github workflow to cover more samples
2023-03-17 16:02:27 +08:00
William Cheng
3d4f7b3ce0
[java] fix optional array property's default value (#14961)
* fix optional array property default value

* fix default values

* more fixes

* update default value for jersey2, 3, okhttp-gson

* update default value

* fix java okhttp-gson

* fix jersey2, 3
2023-03-17 11:58:49 +08:00
William Cheng
d0f7bd18ba
[spring] fix default value for nullable containers (#14959)
* fix default value, update spec to 3.0

* add tests for container default value

* update java camel samples

* remove samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable

* remove ./bin/configs/spring-boot-beanvalidation-no-nullable-oas3.yaml

* remove samples/openapi3/server/petstore/springboot-useoptional

* remove samples/openapi3/server/petstore/springboot-reactive

* update github workflow

* fix default in add, put operation
2023-03-17 10:16:17 +08:00
William Cheng
1beec7ef87 Merge remote-tracking branch 'origin' into 7.0.x 2023-03-03 21:52:50 +08:00
Oleh Kurpiak
ca3e8be1bc
[Java][Spring] version parameter (#14847) 2023-03-02 13:29:01 +02:00
Antoine Lucas
e1ab25c915
Add constructor with required parameter for Spring (#14822) (fix #9789)
* Add constructor with required parameter for spring

Fix #9789

* [Java][Spring] constructor with required args

---------

Co-authored-by: Oleh Kurpiak <oleh.kurpiak@gmail.com>
2023-03-01 15:09:47 +02:00
William Cheng
a4b5b85067
Update jackson nullable version to newer version v0.2.6 (#14823)
* update jackson nullable to newer version

* update samples

* update samples

* update samples
2023-02-27 18:38:31 +08:00
Dennis Melzer
92b96635bd
Fix bean validation for Collection and add unit test (#14736)
* Fix bean validation for Collection + uni test

* Fix

* Adapt examples

* Fix comments

* Merge master

* Remove Bean validation for Maps

* Remove @Valid from jakarta

* Fix example

* Fix comments

* Fix springboot-3 example
2023-02-25 22:06:31 +08:00
William Cheng
c50a775e0c
prepare 6.5.0 release (#14749) 2023-02-19 20:36:23 +08:00
William Cheng
93df0ff444
Prepare 6.4.0 release (#14748)
* prepare 6.4.0 release

* update samples
2023-02-19 18:53:20 +08:00
GregDThomas
c5d67ee042
Fix https://github.com/OpenAPITools/openapi-generator/issues/11570 by ensuring tags at the class level match tags at the method level (#13434) 2023-02-18 06:23:10 -08:00