OpenAPITools / OpenAPITools/openapi-generator
[BUG] Schema generation fails when lowercase schema (item) is aliased to PascalCase (Item)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator? (The spec is valid OAS 3.0)
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output? (See Description below)
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating a client, the model is not correctly created if the primary schema definition is in lowercase (item) but is referenced via a PascalCase alias (Item) which is then used in a path operation.
The generator fails to resolve the properties from the lowercase definition and skips the final Item model entirely, leading to TypeScript compilation errors when using TypeScript as a generator.
openapi-generator version
7.17.0
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: "Case-Sensitive Alias Bug"
version: 1.0.0
paths:
/items:
get:
summary: Get an Item
responses:
'200':
description: A single item object
content:
application/json:
schema:
$ref: "#/components/schemas/Item" # <-- References the PascalCase alias
components:
schemas:
# 1. Primary model definition (lowercase)
item:
type: object
properties:
id:
type: string
name:
type: string
# 2. Explicit alias (PascalCase) referencing the lowercase model
Item:
$ref: "#/components/schemas/item"
Generation Details
openapi-generator-cli generate -i schema.yaml -g typescript-axios
Steps to reproduce
- Save the minimal OpenAPI specification above as
schema.yaml. - Run the generation command using the
typescript-axiosgenerator. - Examine the generated model file for the
Iteminterface.
Related issues/PRs
N/A
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 by running the minimal schema.yaml with the typescript-axios generator and inspect how the lowercase item definition and PascalCase Item alias are resolved. Compare the generated Item model and TypeScript compilation with the expected id and name properties; done means the aliased model is generated successfully without compilation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100