Comments (4)
Would you try the following option?
swaggerSources {
petstore {
code {
rawOptions = ["--ignore-file-override=.swagger-codegen-ignore"]
}
}
}
from gradle-swagger-generator-plugin.
arigatou gozaimasu @int128 !
from gradle-swagger-generator-plugin.
@int128 Just tried this workaround but got an error.
Is there a better way to do this? Or What might be causing this?
[main] ERROR io.swagger.parser.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content (maxDepth 2000)
at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:300)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:369)
at io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:137)
at io.swagger.parser.Swagger20Parser.deserializeYaml(Swagger20Parser.java:83)
at io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:125)
at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:109)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:69)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:431)
at io.swagger.codegen.cmd.Generate.run(Generate.java:283)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.IllegalAccessError: tried to access field org.yaml.snakeyaml.constructor.BaseConstructor.composer from class io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor
at io.swagger.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:279)
... 10 more
Exception in thread "main" java.lang.RuntimeException: Could not generate model 'CommitFile'
at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:425)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:751)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.ignore.CodegenIgnoreProcessor.allowsFile(CodegenIgnoreProcessor.java:111)
at io.swagger.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:765)
at io.swagger.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:412)
... 3 more
Using config build.gradle.kts
:
swaggerSources {
create("example") {
setInputFile(file("swagger.yaml"))
code.language = "spring"
code.configFile = file("swagger-codegen-config.json")
code.dependsOn(validation)
code.components = setOf("models", "apis")
code.rawOptions = listOf("--ignore-file-override=.swagger-codegen-ignore")
}
}
from gradle-swagger-generator-plugin.
Seems like it was related to the relative path in the parameter. Absolute path fixed it.
The error is misleading.
Edit:
Ups, seems like is not being used.
The final fix was:
code.rawOptions = listOf("--ignore-file-override=" + file(".swagger-codegen-ignore").absolutePath)
**/*ApiController.java
from gradle-swagger-generator-plugin.
Related Issues (20)
- A Release hasn't been made since Feb 2020. Missing OAS3 verification which is in master HOT 1
- Android Studio 2020.3.1 (latest stable) requires Gradle 7 + tweaks to plugin HOT 1
- Dependency Dashboard
- Action Required: Fix Renovate Configuration
- The latest release no longer supports Java 11 HOT 3
- JAVA 8 support for the plugin HOT 3
- False usage of gradle cache on new code generator version HOT 1
- No duplicate handling strategy has been set for task resolveSwaggerTemplate HOT 2
- Plugin generates new files despite the inputFiles are not changed since the last generation
- Can't generate SwaggerUI with plugin version 2.19.2 HOT 2
- New versions are not compatible with gradle 6.x
- Problem generating Java code with schema property "oneOf"
- Move to latest Gradle API and best practices HOT 5
- Response for Controller with type of "Map of Map" is not properly generated.
- oneOf Polymorphism Broken
- Using `resttemplate` and `useBeanValidation` does not include `validation-api` HOT 1
- Support jakarta imports HOT 1
- Question: Please could you indicate how to generate the client code? HOT 1
- Configuration cache HOT 3
- Specifying skipFormModel global property does not work
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 gradle-swagger-generator-plugin.