Bug Report Checklist
Description
Schema mappings don't seem to be applied to schemas referenced from an endpoint's parameters. With this:
openapi-generator-cli generate -g java -i example.yml -o output --schema-mappings=Limit=com.example.Limit
the generated code still uses a raw Integer rather than com.example.Limit:
public List<Pet> listPets(Integer limit) throws ApiException {
In contrast, --schema-mappings=Pet=com.example.Pet works as expected:
public List<com.example.Pet> listPets(Integer limit) throws ApiException {
openapi-generator version
6.0.1
OpenAPI declaration file content or url
This is a modified version of the pet store example, with the limit query parameter extracted into a separate schema:
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
$ref: "#/components/schemas/Limit"
responses:
'200':
description: A paged array of pets
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
components:
schemas:
Limit:
type: integer
format: int32
Pet:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Related issues/PRs
#12600
Bug Report Checklist
Description
Schema mappings don't seem to be applied to schemas referenced from an endpoint's
parameters. With this:the generated code still uses a raw
Integerrather thancom.example.Limit:In contrast,
--schema-mappings=Pet=com.example.Petworks as expected:openapi-generator version
6.0.1
OpenAPI declaration file content or url
This is a modified version of the pet store example, with the limit query parameter extracted into a separate schema:
Related issues/PRs
#12600