Comments (2)
I just ran into this as well. Have not found a workaround as yet.
from openapi-generator.
Here's a quick workaround I'm using that effectively edits generated sources in place after generation and before compilation:
// work around https://github.com/OpenAPITools/openapi-generator/issues/18904
tasks.register<ReplaceInFilesTask>("dedupeSerializableAnnotation") {
group = "Custom"
description = "Replaces occurrences of @Serializable@Serializable with @Serializable in source files " +
"to work around the bug described at https://github.com/OpenAPITools/openapi-generator/issues/18904"
sourceDir.set(file("src"))
targetString.set("@Serializable@Serializable")
replacementString.set("@Serializable")
}
abstract class ReplaceInFilesTask : DefaultTask() {
@get:InputDirectory
abstract val sourceDir: DirectoryProperty
@get:Input
abstract val targetString: Property<String>
@get:Input
abstract val replacementString: Property<String>
@TaskAction
fun replaceStrings() {
val target = targetString.get()
val replacement = replacementString.get()
val sourceDir = sourceDir.get().asFile
if (sourceDir.exists()) {
sourceDir.walkTopDown()
.filter { it.isFile }
.forEach { file ->
val content = file.readText()
val newContent = content.replace(target, replacement)
if (content != newContent) {
file.writeText(newContent)
println("Replaced in: ${file.absolutePath}")
}
}
} else {
println("Source directory does not exist: $sourceDir")
}
}
}
tasks.getByName("openApiGenerate").finalizedBy("dedupeSerializableAnnotation")
tasks.getByName("compileKotlinJvm").dependsOn("openApiGenerate")
tasks.getByName("allMetadataJar").dependsOn("openApiGenerate") // to avoid "implicit dependency" error at [1]
// [1]: https://docs.gradle.org/8.7/userguide/validation_problems.html#implicit_dependency
from openapi-generator.
Related Issues (20)
- [REQ] Support for a bearer token supplier for Java RestTemplate clients HOT 1
- [REQ] [Typescript] Specify "files" property in package.json
- [BUG] [Java] Mapped types should no be be validated by default
- [BUG][JAVA][SPRING] No downwards compability (spring 6 to spring 5) of pregenerated client because of new introduced HttpStatusCode HOT 1
- [BUG][Java][jaxrs-spec] When using discriminator, enum properties of children are defined in parent instead of child class
- [BUG] TypeScript (fetch) client causes TS7053
- [Bug]Exception in OpenAPI Normalizer - maybe related to handling anyOf HOT 1
- [BUG] [Python Client] Python client is unable to resolve complex structure under AnyOf HOT 1
- [BUG] Description
- [BUG] Java: Not able to pass dictionary in query parameters
- [BUG] java.lang.UnsupportedClassVersionError: org/openapitools/codegen/OpenAPIGenerator has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 HOT 10
- [BUG] dart generator creates invalid code
- [BUG][java-vertx-web] Generated code does not compile for text/plain request bodies
- [BUG][java-vertx-web] Textual responses get wrapped in JSON
- [BUG] Doesn't generate a getter if response example is the same HOT 7
- [BUG] [Java] Raw type compilation warnings when generating using jersey2 or jersey3
- [BUG][Python Client] oneOf for different constrainted types fails to resolve with missing patterns HOT 1
- Can we get the most recent snapshots from the master branch? HOT 3
- [BUG] [JAVA] [Micronaut] - Using inheritance results in superclass having all fields from subclasses
- [BUG] [typescript-fetch] ModelNamePrefix is added twice to import statements thereby breaking the build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-generator.