Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support flat YAML #69

Open
Bigyls opened this issue Aug 1, 2024 · 4 comments
Open

Feature: Support flat YAML #69

Bigyls opened this issue Aug 1, 2024 · 4 comments
Assignees

Comments

@Bigyls
Copy link

Bigyls commented Aug 1, 2024

Hello,

I'm having a problem with a YAML file that I call flat:

name: Test
author: Me
category: YAML

And when I try to create my schema I get the following error when launching the action:

name:
  type: string
  description: Name of the yaml value
  required: true
...
Error: workflow is not valid. 'schema.yml': yaml: unmarshal errors:
  line 3: cannot unmarshal !!map into string

Does anyone have an idea? I have the impression that this error is due to the handling of https://github.com/ketanSaxena/schema-validator

@GrantBirki
Copy link
Owner

👋 Hey @Bigyls! I tried to reproduce this error and I'm not able to see it. Here are some logs of a workflow run - logs from this pull request.

@Bigyls
Copy link
Author

Bigyls commented Aug 23, 2024

Thanks for the reply @GrantBirki!

Okay, I see! It was my local tests with act (https://github.com/nektos/act).

Flat YAML works very well.

But now I get an error because my YAML file contains a “type” entry:

My YAML:

flags:
  - {
    type: "regex",
    content: "^test$",
    data: "case_insensitive",
  }

Schema:

flags:
  - type: string
    type:
      type: string
      description: Type of the flag
      enum: ["regex", "static"]
    content:
      type: string
      description: Content of the flag
    data:
      type: string
      description: Data of the flag

Error:

ERROR : YAMLException: duplicated mapping key at line 82, column -92:
        type:
        ^

There is a way to counter this problem or disable the check of "flags" in my yaml to avoid the following errors:

      {
        "path": "flags.0",
        "message": "flags.0 is not present in schema"
      }

@GrantBirki
Copy link
Owner

@Bigyls hmm to be honest I'm not quite sure what the issue would be here

@Bigyls
Copy link
Author

Bigyls commented Aug 24, 2024

No problem @GrantBirki, there is a way to bypass a check of one item like hoobies is your examples ?

Because if the item is not in the schema, there is an error like hoobies not in schema but if I don't want to check this item how I can do ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants