apple / pkl-pantry

Shared Pkl packages
Apache License 2.0
229 stars 31 forks source link

[JSON Schema] support passing in a module name #31

Open jstrachan opened 4 months ago

jstrachan commented 4 months ago

when generating a pkl file from a JSON schema file it tends to use the module "Jsonschema"

$ pkl eval package://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1.0.0#/generate.pkl -m . -p source="jsonschema.json"

Jsonschema.pkl

which includes the pkl...

module Jsonschema

...

it would be nice to be able to pass in the module name which is used to generate the pkl module and the name of the file

e.g.

$ pkl eval package://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1.0.0#/generate.pkl -m . -p source="jsonschema.json" -p module="mything"

mything.pkl

$ cat mything.pkl
module mything
...
jstrachan commented 4 months ago

I noticed its defaulting the module name to the last part of the filename; so a workaround for now is to rename the last part of the path from jsonschema