swagger-api / swagger-api/swagger-codegen
importMappings not working I can not replace import
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
<version>2.3.1</version>
<executions>
<execution>
<id>generate-server-jar</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger-gen.yml}</inputSpec>
<language>spring</language>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
<apiPackage>${swagger-gen.api.package}</apiPackage>
<modelPackage>${swagger-gen.model.package}</modelPackage>
<serializableModel>true</serializableModel>
<useJaxbAnnotations>false</useJaxbAnnotations>
<dateLibrary>java8-localdatetime</dateLibrary>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
</configOptions>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
</configuration>
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 shown Spring generator configuration and trace how typeMappings and importMappings are handled during generation. Reproduce the configuration with OffsetDateTime mapped to LocalDateTime, then verify that generated Java files import and use LocalDateTime instead of OffsetDateTime.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100