quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

[BUG]: Objective-C compatible Swift does not get Sendable conformance

Open ladvoc opened this issue 4 months ago • 0 comments

When the sendable and objective-c-support options are used together, the generated types do not get Sendable conformance.

Context (Environment, Version, Language)

Input Format: JSON schema Output Language: Swift

Using the NPM package, latest version.

Input Data

The issue can be demonstrated with this simple JSON schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Example",
  "definitions": {
    "Fruit": {
      "enum": ["apple", "banana", "orange"],
      "type": "string"
    }
  },
  "properties": {
    "favoriteFruit": {
      "items": {
        "$ref": "#/definitions/Fruit"
      },
      "type": "array"
    }
  },
  "type": "object"
}

Generation options:

rendererOptions: {
   "sendable": true,
   "struct-or-class": "class",
   "objective-c-support": true
}

Expected Behaviour / Output

All generated types should conform to Sendable. The generated class already meets most of the requirements: it has only stored properties that are immutable and Sendable (provided the other generated types are as well), and it has NSObject as its superclass; the class just needs to be marked as final.

Current Behaviour / Output

The sendable options is ignored, and the generated types do not get Sendable conformance.

ladvoc avatar Jun 04 '25 11:06 ladvoc