Skip to content

DSL for defining interfaces #71

@jeggy

Description

@jeggy

It would be nice to be able to define interface properties that are not actually part of the Kotlin interface.

Idea being something like this:

interface MyInterface
data class MyDataClass(val id: Int): MyInterface
...
interface<MyInterface> {
  property<String>("field1") // No default implementation and will run into runtime schema creation error if not implement in all types that implement this interface
  property<String>("field2") { // This property has a default implementation, but can be overwritten within implemented types
    resolver { a: MyInterface ->
      "FIELD-2"
    }
  }
}
type<MyDataClass> {
  property<String>("field1") {
    resolver { data: MyDataClass ->
      "FIELD-${data.id}"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions