Skip to content

Commit

Permalink
chore: updates spelling and docs and sorts imports
Browse files Browse the repository at this point in the history
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
  • Loading branch information
jpower432 committed Aug 16, 2022
1 parent 246a53d commit 2bfe139
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions attributes/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ package attributes
// This package defines types and methods for performing attributing matching,
// implementation, and node searching.

// NOTE: This package contains helper functions when create new attributes namely (attributes.Reflect).
// A warning, the functions in this package use reflect and therefore will incur a performance penalty.
// This package contains helper functions when creating new attributes.
// WARNING: The helper functions (attribute.Reflect) in this package use reflection and therefore will incur a performance penalty.
6 changes: 3 additions & 3 deletions builder/config/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"github.com/uor-framework/uor-client-go/model"
)

// ConvertToModel converts an attribute query to an attribute set.
func ConvertToModel(v1attributes v1alpha1.Attributes) (model.AttributeSet, error) {
// ConvertToModel converts v1alpha1.Attributes to an model.AttributeSet.
func ConvertToModel(input v1alpha1.Attributes) (model.AttributeSet, error) {
set := attributes.Attributes{}
for key, val := range v1attributes {
for key, val := range input {
mattr, err := attributes.Reflect(key, val)
if err != nil {
return nil, fmt.Errorf("error converting attribute %s to model: %v", key, err)
Expand Down
2 changes: 1 addition & 1 deletion cli/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func prepTestArtifact(t *testing.T, ref string, host string) {
ocimanifest.AnnotationCollectionLinks: linked1Ref,
}
linkedRef := fmt.Sprintf("%s/linked:test", host)
publishFunc(fileLinkedName, linkedRef, fileContent, map[string]string{"test": "" + "linkedannotation"}, middleAnnotations)
publishFunc(fileLinkedName, linkedRef, fileContent, map[string]string{"test": "linkedannotation"}, middleAnnotations)
rootAnnotations := map[string]string{
ocimanifest.AnnotationSchema: "test.com/schema:latest",
ocimanifest.AnnotationSchemaLinks: "test.com/schema:latest",
Expand Down
2 changes: 1 addition & 1 deletion cli/testdata/configs/nomatch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kind: AttributeQuery
apiVersion: client.uor-framework.io/v1alpha1
attributes:
- "test": annotation"
- "test2": annotation"
2 changes: 1 addition & 1 deletion docs/design/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Matcher is an interface that defines methods for node searching/matching that ca
# Attribute

Attribute is an interface that defines a single attribute values with a key that is a type of string and a value that
can be a string, boolean, number or null value.
can be a string, boolean, integer, number, or null value.

# AttributeSet

Expand Down
7 changes: 4 additions & 3 deletions docs/design/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ declarations MUST follow the following syntax and guidelines:
and are expressions with JSON syntax:

1. Number (expressed at float)
2. String
3. Boolean
4. Null
2. Integer
3. String
4. Boolean
5. Null

### Algorithm Reference

Expand Down
3 changes: 2 additions & 1 deletion model/nodes/collection/collection_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package collection

import (
"github.com/uor-framework/uor-client-go/attributes"
"sort"
"testing"

"github.com/stretchr/testify/require"

"github.com/uor-framework/uor-client-go/attributes"
"github.com/uor-framework/uor-client-go/model"
"github.com/uor-framework/uor-client-go/util/testutils"
)
Expand Down
4 changes: 2 additions & 2 deletions model/nodes/descriptor/descriptor.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package descriptor

import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"

"github.com/uor-framework/uor-client-go/model"
"github.com/uor-framework/uor-client-go/ocimanifest"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

// Node defines a single unit containing information about a UOR dataset node.
Expand Down
4 changes: 2 additions & 2 deletions ocimanifest/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/uor-framework/uor-client-go/builder/api/v1alpha1"
"github.com/uor-framework/uor-client-go/builder/config"
"regexp"
"strings"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"

"github.com/uor-framework/uor-client-go/attributes"
"github.com/uor-framework/uor-client-go/builder/api/v1alpha1"
"github.com/uor-framework/uor-client-go/builder/config"
"github.com/uor-framework/uor-client-go/model"
)

Expand Down
1 change: 1 addition & 0 deletions ocimanifest/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ func TestAnnotationsToAttributeSet(t *testing.T) {
require.Equal(t, expJSON, string(set.AsJSON()))
// JSON standard lib will unmarshal all numbers as float64
exists, err := set.Exists(attributes.NewFloat("size", 2))
require.NoError(t, err)
require.True(t, exists)
}

0 comments on commit 2bfe139

Please sign in to comment.