OpenAPITools / OpenAPITools/openapi-generator
[BUG] Request model generated in 5.0.0-beta3 but not in 5.0.0 and upwards
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 (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
With version 5.0.0-beta3 everything is fine
In version 5.0.0 (and 5.1.0) the filecreaterequest isn´t created
openapi-generator version
OpenAPI declaration file content or url
"openapi": "3.0.0",
"info": {
"title": "API",
"description": "Take it, hold it, love it! (convention: snake_case)",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:8100"
}
],
"paths": {
"/api/dms/file/": {
"post": {
"tags": ["File"],
"summary": "Create a new file.",
"operationId": "uploadFile",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/FileCreateRequest"
}
}
}
},
"responses": {
"200": {
"description": "The file has been created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FileCreateResponse"
}
}
}
},
"400": {
"description": "Form Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FormErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"FileMetaDto": {
"properties": {
"id": {
"type": "string"
},
"filename": {
"type": "string"
},
"title": {
"type": "string"
},
"mime_type": {
"type": "string"
},
"file_size": {
"title": "Filesize in Bytes",
"type": "integer"
},
"url": {
"type": "string"
}
},
"type": "object"
},
"FormErrorResponse": {
"properties": {
"status": {
"type": "string"
},
"errors": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FormError"
}
}
},
"type": "object"
},
"FileCreateRequest": {
"required": ["uploadedFile"],
"properties": {
"directory": {
"type": "string",
"format": "Nexus\\Plugin\\DMS\\Entity\\Directory id"
},
"title": {
"type": "string"
},
"uploadedFile": {
"type": "string",
"format": "binary"
}
},
"type": "object"
},
"FileCreateResponse": {
"properties": {
"status": {
"type": "string"
},
"id": {
"description": "The new created contact id",
"type": "string"
},
"file": {
"$ref": "#/components/schemas/FileMetaDto"
}
},
"type": "object"
},
"FormError": {
"properties": {
"key": {
"type": "string"
},
"translated_error": {
"type": "string"
}
},
"type": "object"
}
},
"securitySchemes": {
"bearerAuth": {
"type": "apiKey",
"description": "Value: Bearer {jwt}",
"name": "Authorization",
"in": "header"
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
Generation Details
openapi-generator generate -i ./spec.json -g typescript
Steps to reproduce
Create the spec.json with the above content and run
openapi-generator generate -i ./spec.json -g typescript
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 saving the supplied OpenAPI declaration as spec.json and running the documented openapi-generator command with the typescript generator in versions 5.0.0-beta3 and 5.0.0 or later. Compare the generated output for FileCreateRequest, then trace the TypeScript generator's handling of the multipart/form-data request. Done means the request model is generated again for the supplied specification and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- 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