Comments (4)
Good timing; we just submitted apple/pkl-pantry#12 that adds support for this!
from pkl.
That PR has landed.
You can generate Pkl schema from JSON Schema; for example:
pkl eval package://pkg.pkl-lang.org/pkl-pantry/[email protected]#/generate.pkl -m . -p source="https://json.schemastore.org/github-action.json"
Note: depending on the input JSON Schema, you might need to tinker with the generated result to make it more useful. Some of JSON Schema is more expressive than Pkl; take a look at the docs for more details: https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib/current/generate/index.html
from pkl.
Great to hear! JSON Schema also conditional blocks i.e if/else
and I assume that it's not supported yet. Not sure if it's feasible in addition to the work for anyOf/allOff
but maybe something to consider.
BTW, the speed you ship the integrations today is impressive. This was something that I tried with Jsonnet a while and I couldn't manage to get it done in a seamless way. Great work!
from pkl.
generate.pkl
works great and was absolutely critical for our team to start considering pkl adoption, thank you for that 👏
I see apple/pkl-pantry#12 mentions it:
provides support for generating JSON Schema from Pkl
but I'm wondering if one is actually able to convert Pkl classes into a JSON Schema; for example:
- use
generate.pkl
to generate Pkl from a JSON Schema - now de-transform the generated Pkl code back into a JSON Schema
I'm describing the scenario above just to be clear about what kind of Pkl code I'm trying to convert to a JSON Schema, in general I don't expect people to do those exact 2 steps. But something like those steps would be helpful for our project to confidently migrate from JSON Schemas to Pkl, and not have to change all the systems to Pkl at once.
Thank you!
from pkl.
Related Issues (20)
- Package aliases HOT 4
- [Feature] Support OCI registries for packages HOT 1
- `NullPointerException` when leveraging `Module.text` HOT 2
- Execution failed for task ':platform:featureflags:launchdarkly:evalPkl' HOT 1
- Entry of which key is same with an element index HOT 5
- Verbose errors HOT 1
- package resolve does not save packages in cache HOT 10
- Why does LoadFromPath() function of generated .pkl.go file needs .pkl file at runtime when there is already generated .pkl.go files. HOT 2
- default values not being used in mapping when explicitly calling new on Object HOT 4
- Nested Type Annotations HOT 9
- [Bug] sorting HOT 4
- Pkldoc generates broken page anchors HOT 3
- For generators are eager in values, but should be lazy
- Execution failed for task ':platform:featureflags:launchdarkly:evalPkl'. HOT 1
- Typo in the Language Reference: "protoypical" HOT 1
- Feature request - subtype support for member predicates HOT 5
- Type parameters in `new Mapping<TypeA, TypeB>`/ `new Listing<Type>` are not checked
- Type checking a mapping/listing should be lazy HOT 2
- CODE_OF_CONDUCT.adoc not recognized by GitHub
- Cannot clone Git repo on Win10 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkl.