Skip to content

[BUG] Inline model schema's name is wrong #14688

@davidediak

Description

@davidediak

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When we have 2 operations (where operation = HTTP VERB + PATH) with the same path e.g.

GET path/{id}
PATCH path/{id}

and

  1. the GET response body schema is just a reference to a well defined schema (e.g. GenericDTO)
  2. the PATCH request body is an inline schema

you''ll have, in the openAPI's components, these 2 schemas:

  1. GenericDTO
  2. ApiV1PathIdGetRequest

the second schema 's name is wrong, it should instead be ApiV1PathIdPatchRequest

Sorry for not providing a spec to reproduce, I fixed it working against my day job's swagger.

Will try, eventually if I find the time, to create a spec in my free time.

openapi-generator version

6.4.0-SNAPSHOT

OpenAPI declaration file content or url

JSON spec

Generation Details

On master run
./run-in-docker.sh mvn package
./run-in-docker.sh generate -i spec.json -g typescript-angular --global-property models

You'll get 2 interfaces:

apiV1CustomerIdGetRequest.ts
customerResponse.ts

the first file name is wrong, it should be called apiV1CustomerIdPatchRequest.ts since it's the inline schema for the patch 's requestBody

Steps to reproduce
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions