Skip to content

Commit

Permalink
Handle empty arrays by returing null error (#4)
Browse files Browse the repository at this point in the history
* Update README

* Handle empty arrays by returing null error
  • Loading branch information
dramich authored Jan 25, 2024
1 parent 1e9ec5d commit 9527fc7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
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:

0 comments on commit 9527fc7

Please sign in to comment.