Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Jackson dependency required when okhttp-gson is choosen #18515

Closed
efren1villamagua opened this issue Apr 26, 2024 · 1 comment · Fixed by #18811
Closed

[BUG] Jackson dependency required when okhttp-gson is choosen #18515

efren1villamagua opened this issue Apr 26, 2024 · 1 comment · Fixed by #18811

Comments

@efren1villamagua
Copy link

efren1villamagua commented Apr 26, 2024

The generated code for java with okhttp-json has a problem.

For some in-house reason we can't use Jackson libraries.
Until version 7.2.0 the file JSON.java is generated with a Google dependency (com.google.gson.internal.bind.util.ISO8601Utils) but from 7.3.0 version a Jackson dependency is used (com.fasterxml.jackson.databind.util.StdDateFormat) what causes a compilation error.

Dependency used in my project is: org.openapitools:openapi-generator-gradle-plugin:7.5.0

Configuration is:

openApiGenerate {
    generatorName = "java"
    library = "okhttp-gson"
    inputSpec = "...".toString()
    outputDir = "...".toString()
    apiPackage = "..."
    invokerPackage = "..."
    modelPackage = "..."
    configOptions = [
            dateLibrary                             : "java8",
            disallowAdditionalPropertiesIfNotPresent: "false",
            enumUnknownDefaultCase                  : "true",
            useOneOfDiscriminatorLookup             : "true"
    ]
    globalProperties = [
            skipFormModel: "false",
            apiTests     : "false",
            modelTests   : "false"
    ]
    skipValidateSpec = true
    logToStderr = true
    generateAliasAsModel = false
    enablePostProcessFile = false
    cleanupOutput = true
}
@Philzen
Copy link
Contributor

Philzen commented May 31, 2024

@winrid also seems affected by this.

I tend to share the expectation that generated gson clients should not contain any jackson dependency whatsoever, be it direct or transitive. Though GSON is in maintenance mode, the implementation in question has recently been committed to: https://github.com/Marcono1234/gson/blob/main/gson/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java – so IMHO for GSON fanfolks this import should still be fine.

That change was introduced in 76560e3 via #17052. @ChaosMarc @martin-mfg i followed your discussion over there, so i'm trying to make the best of both worlds possible over via #18811 – i'm welcoming your comments.

Philzen added a commit to Philzen/openapi-generator that referenced this issue Jun 2, 2024
Philzen added a commit to Philzen/openapi-generator that referenced this issue Jun 2, 2024
Philzen added a commit to Philzen/openapi-generator that referenced this issue Jun 2, 2024
wing328 pushed a commit that referenced this issue Jun 2, 2024
…mport when serialization library is GSON (#18811)

* Partially revert "replace deprecated ISO8601Utils with StdDateFormat (#17052)"

This partially reverts commit 76560e3, namely anything
related to generators and samples using GSON instead of Jackson.

Changes to Jackson-only generation and generator-online regarding RFC3339DateFormat
are not being reverted.

* Test for default serialization library fallback

* Convert repetitive tests to parameterized test

* Add regression test for #18515

* [FEIGN] Only include <jackson-databind-version> property in pom.xml when required

* [RETROFIT2] Only include jackson-databind in gradle file when actually required

* [FEIGN] Don't include jackson dep's in sbt file when GSON is selected

* [FEIGN] Don't include jackson dep's in gradle file when GSON is selected

* DRY refactor JavaClientCodegen test code, increase readability

- use fluent assertions
- use helper method newTempFolder()
- use Java 9 static factory methods for maps
- don't declare variables that are only used once
- group declarations and usages
- use non-blocking java.nio.file API wherever possible

* Regenerate samples
jaxalo pushed a commit to padoa/openapi-generator that referenced this issue Jun 3, 2024
…mport when serialization library is GSON (OpenAPITools#18811)

* Partially revert "replace deprecated ISO8601Utils with StdDateFormat (OpenAPITools#17052)"

This partially reverts commit 76560e3, namely anything
related to generators and samples using GSON instead of Jackson.

Changes to Jackson-only generation and generator-online regarding RFC3339DateFormat
are not being reverted.

* Test for default serialization library fallback

* Convert repetitive tests to parameterized test

* Add regression test for OpenAPITools#18515

* [FEIGN] Only include <jackson-databind-version> property in pom.xml when required

* [RETROFIT2] Only include jackson-databind in gradle file when actually required

* [FEIGN] Don't include jackson dep's in sbt file when GSON is selected

* [FEIGN] Don't include jackson dep's in gradle file when GSON is selected

* DRY refactor JavaClientCodegen test code, increase readability

- use fluent assertions
- use helper method newTempFolder()
- use Java 9 static factory methods for maps
- don't declare variables that are only used once
- group declarations and usages
- use non-blocking java.nio.file API wherever possible

* Regenerate samples
welshm pushed a commit to welshm/openapi-generator that referenced this issue Jun 5, 2024
…mport when serialization library is GSON (OpenAPITools#18811)

* Partially revert "replace deprecated ISO8601Utils with StdDateFormat (OpenAPITools#17052)"

This partially reverts commit 76560e3, namely anything
related to generators and samples using GSON instead of Jackson.

Changes to Jackson-only generation and generator-online regarding RFC3339DateFormat
are not being reverted.

* Test for default serialization library fallback

* Convert repetitive tests to parameterized test

* Add regression test for OpenAPITools#18515

* [FEIGN] Only include <jackson-databind-version> property in pom.xml when required

* [RETROFIT2] Only include jackson-databind in gradle file when actually required

* [FEIGN] Don't include jackson dep's in sbt file when GSON is selected

* [FEIGN] Don't include jackson dep's in gradle file when GSON is selected

* DRY refactor JavaClientCodegen test code, increase readability

- use fluent assertions
- use helper method newTempFolder()
- use Java 9 static factory methods for maps
- don't declare variables that are only used once
- group declarations and usages
- use non-blocking java.nio.file API wherever possible

* Regenerate samples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants