Git Product home page Git Product logo

Comments (4)

shikharish avatar shikharish commented on August 15, 2024 2

@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.

jakezhu9 avatar jakezhu9 commented on August 15, 2024 1

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.

Peefy avatar Peefy commented on August 15, 2024 1

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

from kcl-go.

EraKin575 avatar EraKin575 commented on August 15, 2024 1

If this issue is still relevant, I would like to work on it!

from kcl-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.