Skip to content

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

Open
@ladvoc

Description

@ladvoc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions