github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/providers/discovery/inventory/schema.go (about)

     1  // Copyright (c) 2021, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package inventory
     6  
     7  import (
     8  	"encoding/json"
     9  
    10  	iu "github.com/choria-io/go-choria/internal/util"
    11  )
    12  
    13  func ValidateInventory(i []byte) (warnings []string, err error) {
    14  	var d any
    15  	err = json.Unmarshal(i, &d)
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	return iu.ValidateSchemaFromFS("schemas/choria/discovery/v1/inventory_file.json", d)
    21  }