Skip to content

Invalid Generated code (conflicting declaration) #34

Open
@nlescure-pictet

Description

@nlescure-pictet

Hi,

Let me start by thanking you for the good work !!

Now, I have a use case where the generated code does not compile.
Given the schema:

{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Commodities.Forward.Forward.InstRefDataReporting.V1", "LastModifyDateTime": "2020-08-05T10:37:37", "type": "object", "properties": { "Header": { "title": "Header", "type": "object", "properties": { "AssetClass": { "title": "Asset Class", "description": "As defined by CFI code: ISO 10962 (2015); Character #2", "type": "string", "enum": [ "Commodities" ] } }, }, }, }

The generated code looks like:
`
data class CommoditiesForwardForwardInstRefDataReportingV1(
val Header: Header,
) {

data class Header(
    val AssetClass: AssetClass
)

enum class AssetClass {
Commodities
}
}
`

which does not compile with error "conflicting declaration" because the field name == class name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions