344 Commits

Author SHA1 Message Date
Philzen
880df7a7a4
[maven-plugin] Generate hash from actual resolved spec rather than inputSpec file (#18849)
* Ensure temp directories are deleted after test execution

* Implement test that external $ref changes are reflected in checksum

* Generate hash checksum from actual resolved spec instead of inputSpec file

Otherwise regeneration will not happen when skipIfSpecIsUnchanged is enabled,
although formally the spec content has changed.

Fixes #4512 and #16489

* Use try-with-resources to ensure stream is closed properly on exit

* Fix deprecation warning on SimpleLocalRepositoryManagerFactory no-arg constructor

* Apply minor code cleanup

- use fluent setters where possible
- remove undocumented @throws from JavaDoc
- use List.of() instead of Arrays.asList() for single-element-collection
  (more memory efficient)
- fix some grammar issues in comments and JavaDoc

* Use non-blocking java.nio API for file existence checks
2024-06-05 17:19:22 +08:00
Philzen
aef4d75fd5
Refactoring: Use lombok for simple getters & setters (#18559)
* Add missing @Override annotation

* Fix JavaDoc unresolved symbol

* Fix JavaDoc method link

* Remove unnecessary semicolon

* Remove method identical to super implementations

* Replace repetitive getter code with Lombok @Getter

See https://projectlombok.org/features/GetterSetter

* Replace repetitive setter code with Lombok @Setter

See https://projectlombok.org/features/GetterSetter

* Generate no-args constructor with Lombok

* Generate all-args constructor with Lombok

* Fix parameter naming

* Replace stubbed abstract class implementations with Mockito mocks

* Remove unused import(s)
2024-06-05 04:43:05 +02:00
Philzen
66126a8ae4
Remove unused test dependencies org.reflections & maven-rewrite (#18798)
* Specify exact relative path to parent pom.xml

* Remove org.reflections from the test stack

* Remove unused parameter

* Remove unused method

* Fix raw use of parameterized variable warning

* Use Files.readString instead of converting raw bytes

* Add test coverage for TestUtils.validatePomXmlFiles(List)

* Reimplement TestUtils.validatePomXmlFiles(List) with Jackson XML mapper

* Remove maven-rewrite dependency
2024-06-01 16:42:26 +08:00
Philzen
6a6f39d6f4
Change/reintroduce junit5 (#18790)
* Revert "Revert back to junit4 (#18786)"

This reverts commit 2471ba2d2e96261941d21eb10648f3d70e969423.

* Make junit engine execute TestNG test cases

* Fix failing test and use tempDir's for test code generation

* Make test fail with helpful info in case generator throws exception

* Suppress error output from TestUtils

* Remove transitive junit4 dependency

* Sync guava-testlib version with guava version

* Add hint regarding alternative for guava-testlib's FakeTicker
2024-06-01 16:40:40 +08:00
William Cheng
2471ba2d2e
Revert back to junit4 (#18786)
* revert junit5 upgrade

* revert upgrade to junit5

* fix kotlin-wiremock template folder

* fix/comment tests

* update
2024-05-29 18:58:44 +08:00
Philzen
9c999b6559
[General] Remove defunct global property withXml from generator, docs, maven & gradle plugin (#18568)
* Mention that Golang generator also supports XML annotations

Looking at src/main/resources/go/model_simple.mustache and
src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
the GoLang seems to cater for withXml=true

* Fix maven plugin config description for `withXml`

* Add basic test for global withXml setting

* Use global withXml setting if not configured in ConfigOptions

Resolves #3839 and #5764

* Don't generate metadata or other files when only Models are tested

* Reformat table for readability

* Remove global property `withXml` from generator and docs

* Move WITH_XML constant out of system constants block

Currently there is only a single reference to this value in the whole
codebase (GoClientOptionsProvider). Maybe we should re-think how this
file is organised (i.e. provide a clearer split / mapping / understanding
what are system properties vs. global properties vs. configOptions and
where to put them).

* Remove global option `withXml` from Maven plugin (Breaking change)

This is a "soft" breaking change: Plugin will no longer execute if
user have this option – which is good, b/c it never worked as expected.
We may want to hint this in the 8.0 release notes.

* Remove global property `withXml` from Gradle plugin (Breaking change)

This is a "soft" breaking change: Plugin will no longer execute if
user have this option – which is good, b/c it never worked as expected.
We may want to hint this in the 8.0 release notes, so they can add it
to the `configOptions` map if required, or simply delete it

* Update samples to reflect removed `withXml` property

* Move `withXml` option into ConfigOptions for Java Microprofile sample

* Remove unused local vars and parameters

* Avoid repetition using fluent assertions

* Remove extraneous debug output
2024-05-27 14:35:32 +08:00
Paul Parenko
9a35914f0c
PR for openapi-generator-maven-plugin inputSpec -- Allow jar: URLs (#18576)
* Added support for <inputSpec/> arguments of JAR URLs.
E.g., jar:jar-specific-uri!/spec.yml.

* Resolve and search COMPILE dependencies for inputSpec resource.

* Added test cases for openapi-generator-maven-plugin:generate input
specifications:

* URLs of the form jar:jar-specific-uri!/spec.yaml

* Resources on the compilation classpath

in addition to the existing FILE test case.

* Check for inputSpecFile existence

else it is a remote URL && url is not empty

* replaced deprecated usage

* use Unix separators when on win-os

* example with jar inputSpec

* Comment not required anymore

Was introduced with #7587 could be removed with #10544

* referenced same maven version

these artifacts are referenced by same ${project.version} in https://github.com/apache/maven/blob/master/pom.xml

* updating maven dependencies to 3.9.6

---------

Co-authored-by: Allen D. Ball <ball@hcf.dev>
2024-05-21 13:51:52 +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
ab7d0cb74f
7.6.0 release (#18708) 2024-05-20 15:26:08 +08:00
Pavel Miller
33617ee867
Improve generation of selected models with dependent models (#18462)
* Issue-18444: recursively trace variables and support of new option

* Issue-18444: suppoting inheritance, but interfaces

* Issue-18444: build project instructions executed

* code review from wing328: tab-spaces removed

* code review by wing328: added a line of comment for the private method
2024-05-19 17:46:50 +08:00
Thorsten Hirsch
5614eef995
upgrade openapi poms and codegen tests to junit5 (#18619) 2024-05-09 12:19:56 +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
William Cheng
cce4139af6
v7.5.0 release (#18411) 2024-04-17 16:24:01 +08:00
William Cheng
ef36ea410e
Fix method naming for openapi normalzier, openapi ignore list option (#18348)
* fix openapi normalizer naming issue in config

* update openapi generator ignore list setting

* update

* fix

* update sample config

* update doc
2024-04-10 17:09:48 +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
William Cheng
2abcb4f7f0
7.4.0 release (#18067) 2024-03-11 10:11:15 +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
andreas-wirth
c87ad561f1
inputSpec should not be mandatory when inputSpecRootDirectory is set (#18000)
* Fix inputSpec to not be mandatory in maven plugin

* Add unit tests
2024-03-09 15:34:13 +08:00
Dipesh Chauhan (Twilio Work Account)
cedf170454
Adds Collapse Spec Options to Maven Plugin (#17714)
* Adds Collapse Spec Optionss to Maven Plugin

* Adds a collapsedSpec option to the maven plugin that produces a single-file representation of the spec in the output directory.
* Adds a includeCollapsedSpecInArtifacts option to the maven plugin that adds the collapsed spec file to the maven artifacts.

* Address Feedback Round 1

* Adds the new options to the maven plugin README.md.

* Fixes Unit Tests

* Corrects the casing of one of the schema files that was causing the tests to fail.
2024-02-15 17:02:25 +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
William Cheng
d617b46c86
7.3.0-release (#17817) 2024-02-08 14:15:11 +08:00
William Cheng
7c7634dda9
add operation id option (#17750) 2024-02-01 17:21:49 +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
William Cheng
fe638d0093
v7.2.0 release (#17455) 2023-12-22 14:52:51 +08:00
William Cheng
0dbc108d62
Add openapiGeneratorIgnoreList option to pre-populate .openapi-generator-ignore (#17164)
* add openapiGeneratorIgnoreList option to pre-populate .openapi-generator-ignore

* minor fix

* better code format

* add tests
2023-11-23 11:10:29 +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
William Cheng
e2a62ace74
7.1.0 release (#17049) 2023-11-13 17:25:18 +08:00
William Cheng
ec3c484ce9
Add enum name mapping to Java generators (#17018)
* add enum name mapping to java generators

* update doc

* update description
2023-11-13 10:53:50 +08:00
martin-mfg
39347ec37b
maven plugin: log global settings, minor improvements (#16961) 2023-11-02 22:13:03 +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
William Cheng
f5f9a7e091
Update tests for maven plugins (#16720)
* Fix swagger-annotations groupId in java examples

In Version 5.4.0 OpenApi-Generator has replaced the legacy library
which provided the `io.swagger.annotations.*` namespace (hosted at
https://mvnrepository.com/artifact/io.swagger/swagger-annotations)
with the updated project that provides `io.swagger.v3.oas.annotations.*`.

Hence, if you want to use OpenApi-Generator >= 5.4.0 you need this
package https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations
which is now reflected in these example files.

* Raise jackson-databind-nullable version in example to latest v0.2.6

* Update springfox dependency to v3.x in java examples

See https://github.com/springfox/springfox#migrating-from-existing-2x-version

* fix maven plugin spring tests

---------

Co-authored-by: Philzen <philzen@riseup.net>
2023-10-04 15:59:12 +08:00
William Cheng
bb3096c99c
Jaxrs jersey3 server (#16676)
* Introduced Jersey3 to JavaJerseyServerCodgen and its test class

* Added date ParamConverterProvider to new jersey3 resource directory

* Copied and adjusted jaxrs-jersey2 directory to jaxrs-jersey3

* Added unit tests for Jersey2 (jakarta|javax) and jersey3 (jakarta only)

* Added Jersey3 to markdown documentation

* Added several mustache files for Jersey3

* Further adjustments in JavaJerseyServerCodegen for Jersey3

* Removed tabs from JavaJerseyServerCodegen

* Further improvements in pom and web template

* Changed to swagger-jaxrs2-servlet-initializer-v2 within the projects pom

* Changed servlet-initializer to jakarta version

* Removed tabs in JavaJerseyServerCodegenTest.java

* Removed tabs from JavaJerseyServerCodegen

* Out commented Swagger 1.x part in api.mustache (see ApiImplicitParams)

* Exchanged import of javax* by jakarta* in file verify.groovy

* Changed Parameter annotations to Schema annotations

* Added web.mustache for jersey3

According to the 'Swagger 2.X Integration and Configuration' doc at
https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration

* Adjusted README to point to ./openapi.json instead of ./swagger.json

* Added ./bin/configs/jaxrs-jersey-jersey3.yaml as requested

* Added new jersey3 example (see ./samples/server/petstore/jaxrs/jersey3

* Corrected formParams.mustache exchanged @FormParam by QueryParam

* Resolved ModelValidationException for Map query parameter

* Improved api.mustache (layout and deprecated class instantiation )

* Updated jersey3 example under ./samples/server/petstore/jaxrs/jersey3

* fix tests

* add jeresey3 to github workflow test

* add new workflow

* remove jersey3

---------

Co-authored-by: CDerksen <christian.derksen@uni-due.de>
2023-09-28 16:53:20 +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
William Cheng
875c3ecd3c
7.0.1 release (#16607)
* v7.0.1 release

* update readme

* update template

* update readme
2023-09-18 14:57:09 +08:00
Philzen
196c2b1642
[maven-generator] Do not cleanup output if spec file is unchanged and skipIfSpecIsUnchanged=true (Fixes #16490) (#16491)
* Don't delete output directory if spec is unchanged

Resolves #16490

* Fix some typos
2023-09-12 15:42:19 +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
c37fa8a4e8
prepare v7.0.0 release (#16407) 2023-08-25 15:05:29 +08:00
William Cheng
b006b1b128
Improve documentations (#16346)
* improve doc

* update urls
2023-08-19 10:20:02 +08:00
KaiNative
7703560e73
Updating Maven-Plugin Dependencies (#16274)
* bugfix-15672 updated mavenplugin dependencies

* bugfix-15672 re-added maven-compat since needed by maven-plugin-testing-harness

* bugfix-15672 explicit dependency of plexus archiver in a new version due to CVEs in version included from maven-plugin-testing-harness (2.2)

---------

Co-authored-by: Kai Neuhaus <kneuhaus@communicode.de>
2023-08-08 15:06:50 +08:00
William Cheng
4602f18ca8
Add model name mapping feature to C# codegen (#16209)
* add model name mapping feature to C# codegen

* rename file

* update samples

* update doc
2023-08-02 10:06:11 +08:00
William Cheng
0a02860b50
add parameter name mapping (#16160) 2023-07-24 15:54:40 +08:00
William Cheng
6983a3acf3
Add nameMapping option to Java client, server generators (#16103)
* add nameMapping to java codegen

* update doc

* update samples

* fix typo

* update toParamName
2023-07-17 11:37:49 +08:00
William Cheng
0a6671044f
Rename inlineSchemaNameDefaults to inlineSchemaOptions (#16048)
* rename InlineSchemaNameDefaults to InlineSchemaOptions

* update doc

* rename options
2023-07-11 18:07:09 +08:00
William Cheng
a16a315fee Revert "7.0.0-beta release (#16018)"
This reverts commit 635f7952cec10eecf437886ccd03983b655cd6f2.
2023-07-06 17:21:35 +08:00
William Cheng
635f7952ce
7.0.0-beta release (#16018)
* 7.0.0-beta-release

* fix gradle tests
2023-07-06 16:06:02 +08:00
Michael Glanznig
05b9a899e4
add support for dry-run flag to Maven and Gradle plugins, fixes #15729 (#15734) 2023-06-03 11:06:58 +08:00
William Cheng
fc76944e19
Update maven plugins, use maven 3.8.8 in CI (#15713)
* update maven pom.xml, use 3.9.2 in CI

* use maven 3.8.8

* use variable
2023-06-02 00:30:06 +08:00
William Cheng
0c3460f95b Merge remote-tracking branch 'origin/master' into 7.0.x 2023-05-10 15:00:56 +08:00
martin-mfg
e0f42961c5
add missing documentation for maven and gradle options (#15322) 2023-04-27 12:43:37 +08:00
William Cheng
935146d187 Merge remote-tracking branch 'origin/master' into 7.0.x 2023-04-12 17:51:47 +08:00