Originally created by @dshatokhin on GitHub (Oct 8, 2024).
I'm generating a json output for the object with key name output but even if I enclose it in backticks pkl throws an error:
`output` {
key = "value"
}
> pkl eval keywords.pkl -f json
–– Pkl Error ––
Cannot find property `key` in object of type `ModuleOutput`.
2 | key = "value"
^^^
at keywords#output (file:///home/denis/github/envoy-gateway-vm/private/keywords.pkl, line 2)
Available properties:
files
renderer
text
value
I'm expecting it to work as any other keywords such as class, module, string etc:
Originally created by @dshatokhin on GitHub (Oct 8, 2024).
I'm generating a `json` output for the object with key name `output` but even if I enclose it in backticks `pkl` throws an error:
```pkl
`output` {
key = "value"
}
```
```plain
> pkl eval keywords.pkl -f json
–– Pkl Error ––
Cannot find property `key` in object of type `ModuleOutput`.
2 | key = "value"
^^^
at keywords#output (file:///home/denis/github/envoy-gateway-vm/private/keywords.pkl, line 2)
Available properties:
files
renderer
text
value
```
I'm expecting it to work as any other keywords such as `class`, `module`, `string` etc:
```plain
> pkl eval keywords.pkl -f json
{
"class": {
"key": "value"
}
}
> pkl eval keywords.pkl -f json
{
"module": {
"key": "value"
}
}
> pkl eval keywords.pkl -f json
{
"string": {
"key": "value"
}
}
```
Version used `Pkl 0.26.3` on `amd64` Linux machine
The output property is a special property on Module, and can only be used to describe the module's output.
To get around this, you'll need to define a class with output as a property, then set your module's output to a value of that class.
class Foo {
output: Output
}
class Output {
key: String
}
foo: Foo = new {
output {
key = "foo"
}
}
output {
value = foo
}
This produces:
output {
key = "foo"
}
@bioball commented on GitHub (Oct 8, 2024):
The `output` property is a special property on `Module`, and can only be used to describe the module's output.
To get around this, you'll need to define a class with `output` as a property, then set your module's output to a value of that class.
```pkl
class Foo {
output: Output
}
class Output {
key: String
}
foo: Foo = new {
output {
key = "foo"
}
}
output {
value = foo
}
```
This produces:
```
output {
key = "foo"
}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @dshatokhin on GitHub (Oct 8, 2024).
I'm generating a
jsonoutput for the object with key nameoutputbut even if I enclose it in backtickspklthrows an error:I'm expecting it to work as any other keywords such as
class,module,stringetc:Version used
Pkl 0.26.3onamd64Linux machine@bioball commented on GitHub (Oct 8, 2024):
The
outputproperty is a special property onModule, and can only be used to describe the module's output.To get around this, you'll need to define a class with
outputas a property, then set your module's output to a value of that class.This produces:
@dshatokhin commented on GitHub (Oct 8, 2024):
@bioball , thanks for such a quick reply, I will then use the workaround you suggested