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

Handle empty arrays by returing null error #4

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<img src="images/logo.png" width="600" height="600">
<img src="images/logo.png" width="400" height="400">

# AIRLOCK

[![Go Report Card](https://goreportcard.com/badge/github.com/massdriver-cloud/airlock)](https://goreportcard.com/report/github.com/massdriver-cloud/airlock)
[![Build Status](https://travis-ci.com/massdriver-cloud/airlock.svg?branch=master)](https://travis-ci.com/massdriver-cloud/airlock)
[![Coverage Status](https://coveralls.io/repos/github/massdriver-cloud/airlock/badge.svg?branch=master)](https://coveralls.io/github/massdriver-cloud/airlock?branch=master)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/massdriver-cloud/airlock/blob/master/LICENSE)
[![License](https://img.shields.io/github/license/massdriver-cloud/airlock)](https://github.com/massdriver-cloud/airlock/blob/master/LICENSE)

## Overview
Briefly describe what your project does and what it's used for.

## Features
List the key features of your project.
Generate JSON Schema from various sources (terraform, helm)

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/helmtoschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func parseArrayNode(sch *schema.Schema, node *yaml.Node) error {
sch.Type = "array"

if len(node.Content) == 0 {
return fmt.Errorf("error: cannot infer element type in array %s. Arrays cannot be empty or the type is ambiguous", sch.Title)
return &nullError{}
}
sch.Items = new(schema.Schema)
err := parseValueNode(sch.Items, node.Content[0])
Expand Down
5 changes: 4 additions & 1 deletion pkg/helm/testdata/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ array:
- foo
- bar

nullValue:
# An empty array should not cause an error
emptyArray: []

nullValue: