We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to use the latest version of org.json_schema.contrib to generate a Pkl template from the GitHub Workflow Json Schema.
org.json_schema.contrib
When I execute:
pkl \ eval package://pkg.pkl-lang.org/pkl-pantry/[email protected]#/generate.pkl \ --multiple-file-output-path . \ --property source="https://json.schemastore.org/github-workflow.json"
I see the following error report:
–– Pkl Error –– A stack overflow occurred. 581 | members { ^^^^^^^^^ at org.json_schema.contrib.internal.TypesGenerator#generateUnionType.members (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/org.json_schema.contrib/internal/TypesGenerator.pkl#L581-594) 72 | let (childrenRendered = members.toList().map((t) -> t.render(currentIndent))) ^^^^^^^ at pkl.experimental.syntax.TypeNode#UnionTypeNode.render (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L72-72) ┌─ 3824 repetitions of: │ │ 49 | else "<" + typeArguments.toList().map((t) -> t.render(currentIndent)).join(", ") + ">" │ ^^^^^^^^^^^^^^^^^^^^^^^ │ at pkl.experimental.syntax.TypeNode#DeclaredTypeNode.renderTypeArguments.<function#1> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L49-49) │ │ 49 | else "<" + typeArguments.toList().map((t) -> t.render(currentIndent)).join(", ") + ">" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ at pkl.experimental.syntax.TypeNode#DeclaredTypeNode.renderTypeArguments (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L49-49) │ │ 51 | function render(currentIndent: String) = name.render(currentIndent) + renderTypeArguments(currentIndent) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ at pkl.experimental.syntax.TypeNode#DeclaredTypeNode.render (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L51-51) │ │ 72 | let (childrenRendered = members.toList().map((t) -> t.render(currentIndent))) │ ^^^^^^^^^^^^^^^^^^^^^^^ │ at pkl.experimental.syntax.TypeNode#UnionTypeNode.render.<function#3> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L72-72) │ │ 72 | let (childrenRendered = members.toList().map((t) -> t.render(currentIndent))) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ at pkl.experimental.syntax.TypeNode#UnionTypeNode.render (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeNode.pkl#L72-72) └─ 40 | type.render(currentIndent) ^^^^^^^^^^^^^^^^^^^^^^^^^^ at pkl.experimental.syntax.TypeAliasNode#renderAlias[#4] (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeAliasNode.pkl#L40-40) 35 | local function renderAlias(currentIndent: String) = new Listing { ^^^^^^^^^^^^^ at pkl.experimental.syntax.TypeAliasNode#renderAlias (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeAliasNode.pkl#L35-41) 46 | currentIndent + renderAlias(currentIndent) ^^^^^^^^^^^^^^^^^^^^^^^^^^ at pkl.experimental.syntax.TypeAliasNode#render (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/TypeAliasNode.pkl#L46-46) 122 | typealiases?.toList()?.map((t) -> t.render(currentIndent))?.join("\n\n") ^^^^^^^^^^^^^^^^^^^^^^^ at pkl.experimental.syntax.ModuleNode#render.<function#2> (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/ModuleNode.pkl#L122-122) 122 | typealiases?.toList()?.map((t) -> t.render(currentIndent))?.join("\n\n") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ at pkl.experimental.syntax.ModuleNode#render (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/ModuleNode.pkl#L122-122) 36 | text = render("") ^^^^^^^^^^ at pkl.experimental.syntax.Node#output.text (https://github.com/apple/pkl-pantry/blob/[email protected]/packages/pkl.experimental.syntax/Node.pkl#L36-36)
I'm not quite fluent enough with Pkl to understand where the error is occurring but I thought I'd share in case others are running into this.
The text was updated successfully, but these errors were encountered:
While working on my pkl GitHub Action module I ran into the same(?) problem. See also apple/pkl#263 (reply in thread)
Sorry, something went wrong.
Looks like this is because of a recursive reference:
"configuration": { "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object", "additionalProperties": { "$ref": "#/definitions/configuration" } }, { "type": "array", "items": { "$ref": "#/definitions/configuration" } } ] },
At the moment, Pkl's typealiases cannot be cyclic. Ideally, this turns into:
typealias Configuration = String|Boolean|Mapping<String, Configuration>|Listing<Configuration>
Side note: this means that arbitrarily nested values are accepted Configuration values, e.g. [[[[[[[1]]]]]]].
Configuration
[[[[[[[1]]]]]]]
No branches or pull requests
I'm trying to use the latest version of
org.json_schema.contrib
to generate a Pkl template from the GitHub Workflow Json Schema.When I execute:
I see the following error report:
I'm not quite fluent enough with Pkl to understand where the error is occurring but I thought I'd share in case others are running into this.
The text was updated successfully, but these errors were encountered: