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

Testing search validation and unmarshal #29

Merged
merged 13 commits into from
Nov 29, 2017
Merged

Conversation

skryja
Copy link
Collaborator

@skryja skryja commented Nov 29, 2017

No description provided.

api/search.go Outdated
@@ -3,8 +3,8 @@ package api
// TODO: validation

type Attributes struct {
Attributes []string `json:"attributes,omitempty"`
ExcludedAttributes []string `json:"excludedAttributes,omitempty"`
Attributes []string `json:"attributes,omitempty"` // TODO: validate Attribute Notation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use attrname validator.

api/search.go Outdated
Attributes []string `json:"attributes,omitempty"`
ExcludedAttributes []string `json:"excludedAttributes,omitempty"`
Attributes []string `json:"attributes,omitempty"` // TODO: validate Attribute Notation
ExcludedAttributes []string `json:"excludedAttributes,omitempty"` // TODO: validate Attribute Notation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem with potatoes.

api/search.go Outdated
@@ -3,8 +3,8 @@ package api
// TODO: validation

type Attributes struct {
Attributes []string `json:"attributes,omitempty"` // TODO: validate Attribute Notation
ExcludedAttributes []string `json:"excludedAttributes,omitempty"` // TODO: validate Attribute Notation
Attributes []string `json:"attributes,omitempty" validate:"attrname"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually correct, thanks.

Anyway you should create a new custom validator - ie., attrpath - and use it here ad per RFC 7644 attribute notation.

cc @skryja @samechelon

api/attr/path.go Outdated
@@ -53,6 +55,14 @@ func Parse(s string) *Path {
return a
}

func (a Path) Valid() bool {
s := a.Name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return len(a.Name) > 0 was too long?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leogr please use my style.

@leodido leodido merged commit 6ff1f0d into develop Nov 29, 2017
@leodido leodido deleted the feature/test-search branch November 29, 2017 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants