-
Notifications
You must be signed in to change notification settings - Fork 151
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
Throw errors when dots are in fields in targets #1699
Conversation
@@ -89,7 +89,7 @@ export class Assertion extends ActionBuilder<dataform.Assertion> { | |||
} | |||
|
|||
if (!config.name) { | |||
config.name = Path.fileName(config.filename); | |||
config.name = Path.basename(config.filename); |
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.
i still think this capitalized import name is super weird (Path
as opposed to path
which would be more standard)
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.
It should probably be called pathUtils
instead. It's capitalized for importing our path.ts file, but lowercase for our node path imports
Line 5 in b5368e0
import * as path from "path"; |
Will update in a subsequent CL.
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.
IMO it's fine as path
everywhere, but up to you
core/session.ts
Outdated
@@ -392,6 +392,16 @@ export class Session { | |||
) | |||
); | |||
|
|||
this.checkNoDotsInTargetFields( |
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.
why do we need to do this at the end of compilation? IMO it should be happening well before then - at action declaration time.
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.
Where are you suggesting to put it?
Would it be both:
- Action functions in the session https://github.com/dataform-co/dataform/blob/b5368e04a047c6f2c958b6dd14d9bd5f872e4e0f/core/session.ts#L236C11-L236C21
- Action constructors
dataform/core/actions/table.ts
Line 291 in b5368e0
const target = actionConfigToCompiledGraphTarget(tableTypeConfig);
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.
Everything passes through the action constructors, right? So we should only do it there.
…e-errors Throw errors when dots are in fields in targets
Fixes #1362 (comment), which contains the explanation for this solution
Also update filename in utils to basename as it is more correct.