OpenAPITools / OpenAPITools/openapi-generator
[SWIFT5][BUG] carriage return in summary field are being stripped
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
\r\n are being stripped from the summary field when generating Swift5 code
openapi-generator version
6.1.0
CLI 2.5.2
OpenAPI declaration file content or url
https://gist.github.com/otusweb/c5e00bdcdd659619b8fbf8f0827b8d49
Generation Details
@openapitools/openapi-generator-cli generate -i swaggerDoc.json -g swift5 -o ./swift5-client-generated --skip-validate-spec -c config.yaml
openAPITools.json
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.1.0"
}
}
config.yaml
enumUnknownDefaultCase: true
hideGenerationTimestamp: false # Hides the generation timestamp when files are generated. (Default: true)
library: alamofire
podAuthors: "Olivier Destrebecq" # Authors used for Podspec
podDescription: "XXXX" #Description used for Podspec
podDocumentationURL: "http://www.web.com" #Documentation URL used for Podspec
podHomepage: "http://www.web.com" #Homepage used for Podspec
podVersion: 0.3.0 #Version used for Podspec
projectName: "InternalRestService" #Project name in Xcode
swiftPackagePath: "InternalRestService/Classes/Swaggers"
useBacktickEscapes: true
Steps to reproduce
- run the generation
=> Code generated does not include those carriage returns
expected: the carriage returns are maintained
/**
Update an aggregated order. Requires that the UpdateToken matches the current update token. Update token will be updated for each update.
- parameter apiResponseQueue: The queue on which api response is dispatched.
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
open class func aggregatedOrdersUpdate(apiResponseQueue: DispatchQueue = InternalRestServiceAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask {
return aggregatedOrdersUpdateWithRequestBuilder().execute(apiResponseQueue) { result in
switch result {
case .success:
completion((), nil)
case let .failure(error):
completion(nil, error)
}
}
}
I tried replacing the \r\n with '\n' but got same issue.
Replacing '\r\n' with actual new line in the text cause the generation to fail because the character is within XML and needs to be escaped.
Related issues/PRs
?
Suggest a fix
?
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 with the Swift5 generator using the OpenAPI declaration in the linked gist and reproduce the issue with the documented openapi-generator-cli command and config.yaml. Compare the generated summary text with the source specification; done means carriage returns in the summary field are preserved in the generated Swift client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100