Skip to content

opaque uris and resources interaction #1254

@BenFradet

Description

@BenFradet

with 0.29, opaque uris are invalid: https://pkl-lang.org/main/current/release-notes/0.29.html#opaque-file-uris-are-invalid

the error message says:

–– Pkl Error ––
Resource URI `file:../path/.manifest.yml` has invalid syntax.

30 | const manifest = yamlParser.parse(read("file:../\(manifestPath)"))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at Common#manifest (file:///pkl/Common.pkl, line 30)

File URIs must have a path that starts with `/` (e.g. file:/path/to/my_module.pkl).
To resolve relative paths, remove the scheme prefix (remove "file:").

However, read requires a Resource which mandates the file: prefix.

It is a bit awkward to do

const workingDirectory = read("env:PWD")
const manifest = yamlParser.parse(read("file:\(workingDirectory)/../\(manifestPath)"))

Are there any alternatives?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions