apple / apple/pkl

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

Open
#275 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
11.5k
Forks
402
Avg merge
1d 15h
Merged PRs (30d)
20

Description

I have the schema as following:

```
server: Server

class Server {
endpoints: Listing
}

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
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `pkl eval -f properties application.pkl` using the schema and configuration in the issue, then trace the Properties rendering entry point. Determine how Listing values are handled and define indexed output such as `foo.bar[0]="a"`; done means listings render without the current error and their nested values use stable indexes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.