OpenAPITools / OpenAPITools/openapi-generator
[BUG][SWIFT6] generator doesn't respect x-nullable swagger 2.0 property for $ref attributes
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
x-nullable is ignored when $ref is used on an object property by swift6 generator
openapi-generator version
$ yarn openapi-generator-cli version
7.13.0
OpenAPI declaration file content or url
https://gist.github.com/bogdan/f5fbf0f5940d5540b60ca086beef3fea
Steps to reproduce
openapi-generator-cli generate -i spec.json -g swift6 -o .
Open Source/API/Models/Item.swift.
Actual:
public var activeListing: Listing
Expected:
public var activeListing: Listing?
Note that it is only reproducable when x-nullable and $ref are used together:
{
"active_listing": {
"x-nullable": true,
"$ref": "#/definitions/Listing"
}
}
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
Reproduce with the linked OpenAPI declaration and openapi-generator-cli generate -i spec.json -g swift6 -o ., then inspect Source/API/Models/Item.swift. Trace the swift6 generator handling of the active_listing property when x-nullable and $ref are combined; done means the generated declaration is public var activeListing: Listing?.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, swift
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100