Skip to content

[FAQ] What is the equivalent of cue export in KCL #482

Open
@fchastanet

Description

@fchastanet

General Question

Hello,

Maybe I didn't get the aim of your tool.
I found the way to validate my yaml file

---
vars:
  AA: test
binData:
  commands:
    default:
      mainFile: null
      definitionFiles:
        - file: "test"
          order: 1
        - file: "test2"
          order: 1

with this k file

import regex

schema BinFileSchema:
  vars?: VarsSchema
  compilerConfig?: CompilerConfigSchema
  binData: BinDataSchema
  test: str = "toto"

schema BinDataSchema:
  commands: CommandsSchema

schema CompilerConfigSchema:
  test?: str = "toto"

schema DefaultCommandSchema:
  mainFile?: str
  definitionFiles?: [DefinitionFilesSchema]
  check:
    definitionFiles and isunique([ int(_x["order"]) \
      for _, _x in definitionFiles]) if definitionFiles, \
      "definitionFiles: order property value should be unique, check for duplicates"

schema CommandsSchema:
  default: DefaultCommandSchema

schema DefinitionFilesSchema:
  file: str
  order: int
  check:
    order > 0, "order must >0"

schema VarsSchema:
  [attr: str]: str
  check:
    regex.match(attr, r'^[A-Z0-9_]+$')

Using the validation command:
kcl vet testsKcl/data.yaml binFile.k --format yaml

it works very well

but I didn't find the right command or ability to import my yaml file to be processed by the k file in order to interpolate the default properties that would be missing from my yaml file (eg: the test properties of the k file).

I tried several commands but no success to generate any viable output:
kcl run data.yaml binFile.k --format yaml

Here I get an empty output {}

The command kcl -Y data.yaml binFile.k --format yaml gives {} as well

what am I missing ?

kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions