Skip to content

[BUG][SWIFT6] generator doesn't respect x-nullable swagger 2.0 property for $ref attributes #21201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 of 6 tasks
bogdan opened this issue May 2, 2025 · 0 comments
Open
4 of 6 tasks

Comments

@bogdan
Copy link

bogdan commented May 2, 2025

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

When 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"
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant