Skip to content

[BUG] [swift5] [objcCompatible] Property 'hash' with type 'String' cannot override a property with type 'Int' #7991

@Pe-te

Description

@Pe-te

My yaml file contains the following string property named "hash":

    hash:
      type: string

When I try to generate swift5 code with objcCompatible=true, the code is generated okay:

openapi-generator generate -g swift5 -i "${YAML_FILE}" -o "${SWIFT_PATH}" --additional-properties=objcCompatible=true

But Xcode complains about the generated field named "hash":

Property 'hash' with type 'String' cannot override a property with type 'Int'

This does not happen with objcCompatible=false.

Generator version:

openapi-generator-cli 4.3.1
  commit : 003165c
  built  : 2020-05-06T09:38:39Z

Suggested fix:

I would add "hash" in the objcReservedWords list here, but not sure that works:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions