swagger-api / swagger-api/swagger-codegen
How do I remove these four methods, I don't want to generate them
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
How do I remove these three methods, I don't want to generate them
Logger log = LoggerFactory.getLogger(UseropenidApi.class);
default Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest() {
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
Swagger-codegen version
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.12</version>
Swagger declaration file content or url
Command line used for generation
<configuration>
<!-- specify the swagger yaml -->
<inputSpec>${project.basedir}/../xxx-xxx-spec/src/main/swagger-spec/api.yaml</inputSpec>
<output>${project.basedir}/../xxx-api/swagger-code-gen</output>
<!--<output>swagger-codegen-javascript</output>-->
<!-- target to generate -->
<language>spring</language>
<!--<language>javascript</language>-->
<!-- pass any necessary config options -->
<modelPackage>x.xx.xxx.model</modelPackage>
<templateDirectory>src/main/swagger-templates/spring</templateDirectory>
<configOptions>
<defaultInterfaces>false</defaultInterfaces>
<sourceFolder>src/main/java</sourceFolder>
<apiPackage>x.xx.xxx.api</apiPackage>
<basePackage>x.xx.xxx</basePackage>
<interfaceOnly>true</interfaceOnly>
<java8>true</java8>
<jdk8>true</jdk8>
<dateLibrary>java8</dateLibrary>
<additional-properties>
jackson=true
</additional-properties>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
</configOptions>
<verbose>true</verbose>
</configuration>
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spring templates under the configured templateDirectory, src/main/swagger-templates/spring, and inspect how the generated UseropenidApi interface includes these methods. Review the swagger-codegen Maven plugin configuration, including defaultInterfaces, interfaceOnly, java8, and jdk8, then regenerate the API. Done means the unwanted methods no longer appear in the generated Java interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100