Skip to content

[0.81] CustomClasses doesn't support generic types #15

Open
@Tzrlk

Description

@Tzrlk

With the following property definition:

"repositories": {
	"description": "The list of repositories being sourced.",
	"type": "object",
	"format": "map",
	"additionalProperties": {
		"$ref": "https://aetheric.co.nz/schema/gsm/repository"
	}
}

and the following config:

"customClasses": {
	"format": {
		"map": "kotlin.collections.Map"
	}
}

I end up with:

import kotlin.collections.Map

data class Settings(
    val repositories: Map? = null
)

which is invalid.

If I add the generic signature to the type, it includes it in the import, which is also invalid.

I worked around the issue by creating a typealias and mapping to that, but I can see two ways to improve the experience:

  • Strip off generic typing on the import declaration.
  • Make object types without an explicit name or $id default to Map<String,?> where ? is the common property type.

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