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)
- Automatic formatting of Pkl files HOT 1
- Stack overflow when parameter name is same as object property name HOT 2
- Type constraints on `typealias`es are evaluated eagerly HOT 3
- Question: Submit to CNCF HOT 3
- `gw buildNative` runs aarch64 tasks on amd64 HOT 1
- Allow overriding Java/Kotlin package name in codegen
- Rendering lists in XML may produce unexpected results HOT 1
- Type constraints are sometimes not enforced. HOT 3
- Unable to create test for non-empty constraint on listing HOT 2
- Add SLSA provenance to your releases
- Disable "Allow merge commits" and "Allow rebase merging" in GitHub UI HOT 3
- Non-constant globbed reads return wrong results HOT 1
- Reads with same glob pattern return same result even if located in different modules/directories HOT 1
- better source listing for IntelliJ to include line numbers? HOT 2
- Provide an ability to depend on a local project module from a non-project module HOT 1
- Feature Request: Add `hcl` format HOT 1
- [Feature Request] User-defined generics (type parameters for classes) HOT 1
- Unexpected caching with pkl-go and Evaluator.EvaluateOutputText HOT 1
- Output path placeholders don't expose `ValueRenderer.extension`
- Optimization: `const` members should be cached for all children in prototype chain
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.