Pkl Error: Cannot render value of type Listing as Properties. #94

Open
opened 2025-12-30 01:20:43 +01:00 by adam · 1 comment
Owner

Originally created by @linux-china on GitHub (Mar 1, 2024).

I have the schema as following:

server: Server

class Server {
  endpoints: Listing<Endpoint>
}

class Endpoint {
  name: String
  port: UInt16(isBetween(1024, 65535))
}

and configuration:

server {
  endpoints {
    new {
      name = "localhost"
      port = 8080
    }
    new {
      name = "demo"
      port = 8080
    }
  }
}

when run pkl eval -f properties application.pkl and got the stackstrace:

– Pkl Error ––
Cannot render value of type `Listing` as Properties.
Value: new Listing { ?; ? }

I think pkl properties render could adopt list style.

foo.bar[0]="a"
foo.bar[1]="b"
foo.demo[0].host="localhost"
foo.bar[0].port=8080
Originally created by @linux-china on GitHub (Mar 1, 2024). I have the schema as following: ``` server: Server class Server { endpoints: Listing<Endpoint> } class Endpoint { name: String port: UInt16(isBetween(1024, 65535)) } ``` and configuration: ``` server { endpoints { new { name = "localhost" port = 8080 } new { name = "demo" port = 8080 } } } ``` when run `pkl eval -f properties application.pkl` and got the stackstrace: ``` – Pkl Error –– Cannot render value of type `Listing` as Properties. Value: new Listing { ?; ? } ``` I think pkl properties render could adopt list style. ``` foo.bar[0]="a" foo.bar[1]="b" foo.demo[0].host="localhost" foo.bar[0].port=8080 ```
Author
Owner

@stackoverflow commented on GitHub (Mar 1, 2024):

It's not clear how one would want a List/Listing rendered to properties.
A foo = List(1, 2, 3) could as well be rendered as foo=1, 2, 3.
That's why you should use a converter to decide how you want these classes to be handled.

@stackoverflow commented on GitHub (Mar 1, 2024): It's not clear how one would want a `List`/`Listing` rendered to properties. A `foo = List(1, 2, 3)` could as well be rendered as `foo=1, 2, 3`. That's why you should use a converter to decide how you want these classes to be handled.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#94