-
Notifications
You must be signed in to change notification settings - Fork 104
Generator redesign read meta for resource name to class struct (DCNE-345) #1350
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
base: generator_redesign
Are you sure you want to change the base?
Generator redesign read meta for resource name to class struct (DCNE-345) #1350
Conversation
aba6ba9
to
9012df2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
gen/utils/data/class.go
Outdated
func (c *Class) setResourceName() error { | ||
genLogger.Debug(fmt.Sprintf("Setting resource name for class '%s'.", c.ClassName)) | ||
|
||
// TODO: add logic to override the resource name from an definition file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not important but..
->
// TODO: add logic to override the resource name from a definition file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming the change was an
to a
, changed this now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
if label, ok := c.MetaFileContent["label"]; ok && label != "" { | ||
c.ResourceName = utils.Underscore(label.(string)) | ||
} else { | ||
return fmt.Errorf("failed to set resource name for class '%s': label not found", c.ClassName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also does not account for relational classes right where we need to add relation_ right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will include logic for this
for _, test := range tests { | ||
genLogger.Info(fmt.Sprintf("Executing: %s' with input '%s' and expected output '%s'", t.Name(), test["input"], test["expected"])) | ||
result, err := Plural(test["input"]) | ||
assert.NoError(t, err, fmt.Sprintf("Expected no error, but got '%s'", err)) | ||
assert.Equal(t, test["expected"], result, fmt.Sprintf("Expected '%s', but got '%s'", test["expected"], result)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be repeated in some fashion quite a bit. Should this be a function that accept a series of attribute including the tested function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have a look at creating functions for all the repeating tests
fixes DCNE-345