misc/elastic-inference-validator/elastic-inference-validator.go
func verifyResponseFieldNames(expectedFields []string, responseBody []byte, responseName string) error {
	var responseMap map[string]json.RawMessage
	if err := json.Unmarshal(responseBody, &responseMap); err != nil {
		fmt.Errorf("unable to unmarshal %s response to response map", responseName)
	}

	for _, field := range expectedFields {
		if _, ok := responseMap[field]; !ok {
			return fmt.Errorf("missing field '%s' in %s response", field, responseName)
		}
	}

	return nil
}
func verifyResponseFieldNames(expectedFields []string, responseBody []byte, responseName string) error {
	var responseMap map[string]json.RawMessage
	if err := json.Unmarshal(responseBody, &responseMap); err != nil {
		fmt.Errorf("unable to unmarshal %s response to response map", responseName)
	}

	for _, field := range expectedFields {
		if _, ok := responseMap[field]; !ok {
			return fmt.Errorf("missing field '%s' in %s response", field, responseName)
		}
	}

	return nil
}
// verify all the field names in the response are what we expected. this is needed because a direct unmarshal
// is not case sensitive so can't ensure that the response is in valid format