Open tobiashartmann83 opened 1 year ago
Try to align your tag name in configuration with your yaml file:
e.g. <apisToGenerate>Pets</apisToGenerate>
Please be aware of title-cased tag names due to https://github.com/OpenAPITools/openapi-generator/issues/5591
I have the same problem, the code does only look for the basename. So it is only possible to filter for v1
. Which is more or less useless, in my opinion, if you have a versioned API.
The corresponding code is in org.openapitools.codegen.DefaultGenerator#generateApis
Map<String, List<CodegenOperation>> paths = processPaths(this.openAPI.getPaths());
Set<String> apisToGenerate = null;
String apiNames = GlobalSettings.getProperty("apis");
if (apiNames != null && !apiNames.isEmpty()) {
apisToGenerate = new HashSet<>(Arrays.asList(apiNames.split(",")));
}
if (apisToGenerate != null && !apisToGenerate.isEmpty()) {
Map<String, List<CodegenOperation>> updatedPaths = new TreeMap<>();
for (String m : paths.keySet()) {
if (apisToGenerate.contains(m)) {
updatedPaths.put(m, paths.get(m));
}
}
paths = updatedPaths;
}
Unfortunately, this seems not be easily fixable. One option could be to filter in the first line this.openAPI.getPaths()
This returns a map with the full path like /v1/dogs
. Then maybe only interpret the filter if it contains at least one \
Try to align your tag name in configuration with your yaml file: e.g.
<apisToGenerate>Pets</apisToGenerate>
Please be aware of title-cased tag names due to #5591
that solved it for me. Thx
Bug Report Checklist
Description
I have a very complex openApi file with 17 paths and only have to use a 3 of them. I would like only to generate these 3 endpoints in the Api Interface and related model/DTO classes. I found the
xml<apisToGenerate>
andxml<modelsToGenerate>
Tags. But when I use these tags there is no interface class generated anymore. I used the pets example in of the repository and modified it a little bit and get the same behavior as my 2000 loc openApi.yml file.openapi-generator version
Version: 6.0.1 is in use, but I also tried Version 6.4.0
OpenAPI declaration file content or url
Generation Details
Pom.xml
Steps to reproduce
Without the configuration of
I get the expected result of But with the configuration I get only the classes for models that I congfigured the interface file i missing.
Related issues/PRs
Suggest a fix
Maybe it is just a misconfiguration, but I don't see it and i can't find any solution. Or it is a Bug in the Plugin.