Bug Report Checklist
Description
schemaMapping + importMapping does not generate the import in the generated apis class.
It works only for Models.
typeMapping + importMapping correctly generated the parameters and the imports.
Example:
openapi-generator version
7.23.0
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: "1.0.0"
title: mapping
paths:
/some/dummy/endpoint/{id}:
get:
operationId: getDummy
parameters:
- name: id
in: path
required: true
description: My Custom Id
schema:
$ref: '#/components/schemas/MyId'
- name: key
in: query
required: true
description: filter on key
schema:
$ref: '#/components/schemas/MyKey'
responses:
200:
description: Successfully created reverse listings for retail
content:
application/json:
schema:
$ref: '#/components/schemas/Dummy'
components:
schemas:
Dummy:
type: object
properties:
id:
$ref: '#/components/schemas/MyId'
key:
$ref: '#/components/schemas/MyKey'
MyId:
type: string
format: custom
MyKey:
type: string
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g spring -i mapping.yaml -o /tmp/spring/ --type-mappings string+custom=MyCustomId --schema-mappings MyKey=MyCustomKey --import-mappings MyCustomId=org.myord.MyCustomId --import-mappings MyCustomKey=org.myorg.MyCustomKey
Steps to reproduce
The generated SomeApoi.java has the correct method:
ResponseEntity<Dummy> getDummy(MyCustomId id, MyCustomKey key)
and the correct import for MyId
import org.myord.MyCustomId;
But no import for MyKey (or MyCustomKey)
The models contain the correct imports. Dummy.java contains
import org.myord.MyCustomId;
import org.myorg.MyCustomKey;
Related issues/PRs
Suggest a fix
Workaround: use fully qualified name in schema-mappings
--schema-mappings MyKey=org.myorg.MyCustomKey
Bug Report Checklist
Description
schemaMapping + importMapping does not generate the import in the generated apis class.
It works only for Models.
typeMapping + importMapping correctly generated the parameters and the imports.
Example:
openapi-generator version
7.23.0
OpenAPI declaration file content or url
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g spring -i mapping.yaml -o /tmp/spring/ --type-mappings string+custom=MyCustomId --schema-mappings MyKey=MyCustomKey --import-mappings MyCustomId=org.myord.MyCustomId --import-mappings MyCustomKey=org.myorg.MyCustomKey
Steps to reproduce
The generated SomeApoi.java has the correct method:
and the correct import for MyId
import org.myord.MyCustomId;But no import for MyKey (or MyCustomKey)
The models contain the correct imports. Dummy.java contains
Related issues/PRs
Suggest a fix
Workaround: use fully qualified name in schema-mappings