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
[OPENAPI] [swagger-codegen-maven-plugin] Parameters and responses are copied to components/parameters and components/responses, but not referenced to
#12511
Open
irina-bostan opened this issue
Jan 6, 2025
· 0 comments
When using references to parameters and responses from another file or current file, after generation the references are erased and the content is copied, but duplicated to components/parameters and components/responses.
When using schema validation tools on this contract, it will flag vulnerability: unused component definition.
openapi: 3.0.3info:
title: Service APIdescription: Service APIcontact:
name: API Supporturl: https://dummy/supportemail: [email protected]version: 1.0.0servers:
- url: /apidescription: Used with swagger-ui for any servertags:
- name: Healthdescription: Healthpaths:
/health:
get:
tags:
- Healthsummary: Returns the statusdescription: Returns the health statusoperationId: getHealthStatusparameters:
- name: Dummy-Headerin: headerdescription: Dummy headerschema:
type: stringexample: 463ac4
- name: Dummy2-Headerin: headerdescription: Dummy 2 headerrequired: falsestyle: simpleexplode: falseschema:
maxLength: 256type: stringexample: W9114responses:
"200":
description: Successcontent:
application/json:
schema:
$ref: '#/components/schemas/ApiHealth'"400":
description: Bad requestcontent:
application/json:
schema:
$ref: '#/components/schemas/Error'"404":
description: Not foundcontent:
application/json:
schema:
$ref: '#/components/schemas/Error'components:
schemas:
ApiHealth:
required:
- statustype: objectproperties:
status:
type: stringdescription: Overall connect platform availability statusexample: UPenum:
- UP
- DOWN
- DEGRADEDstatusMessage:
type: stringdescription: Additional informational messageexample: Not Useddescription: API Health response objectError:
type: objectproperties:
code:
type: integerdescription: The error codeexample: 200status:
maxLength: 256minLength: 1type: stringdescription: The error statusexample: NOT_FOUNDdescription:
maxLength: 256minLength: 1type: stringdescription: The error descriptionexample: Descriptionresponses:
BadRequest:
description: Bad requestcontent:
application/json:
schema:
$ref: '#/components/schemas/Error'NotFound:
description: Not foundcontent:
application/json:
schema:
$ref: '#/components/schemas/Error'parameters:
Dummy2Header:
name: Dummy2-Headerin: headerdescription: Dummy 2 headerrequired: falsestyle: simpleexplode: falseschema:
maxLength: 256type: stringexample: W9114DummyHeader:
name: Dummy-Headerin: headerdescription: Dummy headerschema:
type: stringexample: 463ac4
Conclusion: All parameters and responses are copied to parameters after generation and not referenced to. The components/schemas are referenced as expected. In this case, the components/parameters objects are present, but not referenced to.
The text was updated successfully, but these errors were encountered:
Description
When using references to parameters and responses from another file or current file, after generation the references are erased and the content is copied, but duplicated to components/parameters and components/responses.
When using schema validation tools on this contract, it will flag vulnerability: unused component definition.
Swagger-codegen version
Swagger declaration file content or url
common.yaml
main.yaml
Command line used for generation
maven pom.xml definition:
Steps to reproduce
Conclusion: All parameters and responses are copied to parameters after generation and not referenced to. The components/schemas are referenced as expected. In this case, the components/parameters objects are present, but not referenced to.
The text was updated successfully, but these errors were encountered: