You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When openapi-generator-cli validate is run on an OpenAPI in either YAML or JSON format, it reports a warning about an unused model when that model is referred by an array item. It is clearly an error since the model is referred so it isn't unused. The same warning doesn't appear when the model is referred by an object.
openapi-generator version
6.3.0, 7.2.0 and 7.3.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.1.0info:
version: DEVELOPMENTtitle: Titledescription: | Sample APIpaths:
/api:
get:
operationId: accessAPIsummary: Access the APIdescription: API descriptionrequestBody:
description: Information about the accesscontent:
application/json:
schema:
type: objectrequired:
- infoproperties:
info:
type: arraydescription: A list of info itemsitems:
$ref: '#/components/schemas/Item'responses:
'200':
description: OK responsecomponents:
schemas:
Item:
type: objectdescription: Info itemproperties:
summary:
type: stringdescription: Summarydetail:
type: stringdescription: Detail
Generation Details
Steps to reproduce
Put the OpenAPI spec in a YAML file and run openapi-generator-cli validate on it, such as:
The described issue still occurs in the latest master.
Please note that the shown input spec uses openapi: 3.1.0, which isn't fully supported yet by OpenAPI Generator. see e.g. #9083. When using openapi: 3.0.3 instead, the described problem does not occur. So you could use that as workaround for now.
For anyone who wants to work on this: The place where Item gets flagged as unused model is ModelUtils.getUnusedSchemas.
Bug Report Checklist
Description
When openapi-generator-cli validate is run on an OpenAPI in either YAML or JSON format, it reports a warning about an unused model when that model is referred by an array item. It is clearly an error since the model is referred so it isn't unused. The same warning doesn't appear when the model is referred by an object.
openapi-generator version
6.3.0, 7.2.0 and 7.3.0-SNAPSHOT
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Put the OpenAPI spec in a YAML file and run openapi-generator-cli validate on it, such as:
It will generate the following output:
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: