-
Notifications
You must be signed in to change notification settings - Fork 234
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
766 store circuit inputs translation schema #783
766 store circuit inputs translation schema #783
Conversation
...ri/workgroup/worksteps/capabilities/setCircuitInputsSchema/setCircuitInputsSchema.command.ts
Outdated
Show resolved
Hide resolved
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.
@ognjenkurtic left some questions. Bit confused.
@Therecanbeonlyone1969 Please have a look at my answers and let me know if there is anything else to clarify |
see my replies ... JSON and use a library such as suretype. @ognjenkurtic |
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.
looks good
regarding string vs json, it seems that using json in prisma is straightforward (sorry if assumption is wrong) so maybe lets just do it in this PR
public throwIfCircuitInputTranslationSchemaInvalid(schema): void { | ||
const [result, error] = | ||
this.cips.validateCircuitInputTranslationSchema(schema); | ||
if (!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.
probably should check if there is error instead of result and returning error imo
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.
renamed 'result' to 'valid' for better readability
workstepToUpdate: Workstep, | ||
schema: string, | ||
): void { | ||
workstepToUpdate.updateCircuitInputTranslationSchema(schema); |
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.
can error occur here?
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 really, asigning string value
@@ -71,6 +73,17 @@ export class WorkstepController { | |||
); | |||
} | |||
|
|||
@Put('/:id/circuitinputsschema') | |||
@CheckAuthz({ action: 'update', type: 'Workstep' }) | |||
async setCircuitInputsSchemaCommand( |
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.
small thing but i would name this update
instead of set
to be clear, but up to you
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.
done
} | ||
} | ||
|
||
return [true, '']; |
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 dont think we should return both boolean and error, looks kinda weird in javascript, lets just return error which implies that validation is true or false? but up to you
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 ike it
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.
@ognjenkurtic are you going to leave it like that? L57 still returns a boolean and error message. Same with L55 ... I would return a No-Error Message
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.
Fixed
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.
Had one comment as a follow-up. Once addressed, good to be merged after resolving merge conflicts.
@skosito @Therecanbeonlyone1969 waiting for the other one to be merged to main so that i can resolve confilcts here and verify the e2e test. Everything else is addressed. |
…ircuitInputParser service
…d to postman collection; Rename add cis command to set cis command;
…hrow error in case validation fails
…string representing error
9295224
to
3c9230d
Compare
@Therecanbeonlyone1969 @biscuitdey @skosito ready for rereview. tests green, rebased on top of main. |
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.
Looks good!
Description
Implements an endpoint through which a circuit input translation schema can be attached to a workstep.
Implements a command handler that validates the provided schema and stores it.
Implements a method in the CircuitInputsParserService for schema validation together with tests
Extends the e2e test to trigger dummy schema creation, in preparation for #777
Related Issue
#766
Motivation and Context
Given in the discussions in the related issues and docs
How Has This Been Tested
Wrote a set of new unit tests
Extended e2e tests
Added an endpoint to Postman collection and tested manually
Screenshots (if appropriate)
Types of changes
Checklist