Comments (4)
@Peefy Hello, I would like to work on this issue. I am new to the project so can you please give me an overview of the issue.
from kcl-go.
For allOf keyword, a basic use case coule be:
{
"allOf": [
{ "type": "string" },
{ "minLength": 2 }
]
}
In this case, the desgin to add AllOf validations is great. However, things get complicated if it is:
{
"allOf": [
{
"type": "object",
"properties": {
"name": { "type": "string" }
}
},
{
"type": "object",
"properties": {
"address": { "type": "string" }
}
}
]
}
In this case, just adding some validation rules doesn't seem to be enough. Even worse, in some real-world situations, allOf is used with other conditional keywords (not, if, then...) For example in github workflow schema:
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "boolean"
}
},
"required": [
"type"
]
},
"then": {
"properties": {
"default": {
"type": "boolean"
}
}
},
"else": {
"properties": {
"default": {
"type": "string"
}
}
}
}
...
I'm not quite sure if it can all be perfectly converted to KCL. And more design and transformation rules is needed. I'm currently working on improving the import tool (#200) and have made some progress. Maybe later we can have further communication on how to make it better :)
from kcl-go.
Great job 👍 For complex validation combinations, my current idea is to aim to connect 5 typical use cases, such as the GitHub workflow JSON schema. For specific implementation, we can first represent the input and output of some typical cases.
Of course, for some corner cases, there may indeed be conversion difficulties that need to be viewed separately.
Here's some references
- CUE extract test data: https://github.com/cue-lang/cue/tree/master/encoding/jsonschema/testdata
from kcl-go.
If this issue is still relevant, I would like to work on it!
from kcl-go.
Related Issues (20)
- Import tool use wrong mode and generate schema with error
- KCL Go Plugin API and documents HOT 1
- error get depends HOT 2
- [Question] [API] How can i get all params (option function call) from the kcl code HOT 26
- Disable auto block pr option of contributor-assistant/github-action HOT 1
- Request: allow disabling shared lib download behavior at build time HOT 8
- Inconsistent native and service KCL api `ParseFile` behaviour HOT 2
- version miss match HOT 2
- ‘_’ seems to be a bit unexpected. HOT 3
- [Enhancement] kcl import muti yaml resource HOT 3
- how to give a dict var HOT 7
- Get locally depended .k files of a given .k file (from imports)
- [Enhancement] Gen KCL config from toml config. HOT 14
- [Enhancement] Gen KCL schema from protobuf message HOT 5
- [Enhancement] Gen KCL config from textproto and KCL type/protobuf message
- [Enhancement] Import multiple documents in single YAML file into one KCL file with the `manifests.yaml_stream` function calling.
- [Enhancement] KCL Import supports importing the entire Go package into KCL schema HOT 5
- [Enhancement] Add log message output for the testing API and tool.
- [Enhancement] `kcl-lang.io/kcl-go` has too many third-party dependencies HOT 1
- Where are the cgo dependencies? HOT 1
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 kcl-go.