-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add flow_framework namespace specs #553
Conversation
Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
refactor: 1.add epilogues that deletes the workflow if it was created. 2.rewrite all the 'whether' 3. remove empty lines 4. add validation enum Signed-off-by: Junwei Dai <junweid@amazon.com>
@dbwiddis I have opened a new pull request and would appreciate it if you could take a moment to review it when you have the time. Thank you! |
Changes AnalysisCommit SHA: 67e89be API ChangesSummary
ReportThe full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10728488330/artifacts/1901913020 API Coverage
|
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 looks great! I only have some nits, up to you if you want to address them.
The validator failed for good reason, check, https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10709911469/job/29695704593?pr=553.
paths: {} | ||
components: | ||
schemas: | ||
FlowFrameworkException: |
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.
Does this one inherit from an OpenSearch error type?
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.
yes , it inherit from OpenSearchException
FlowFrameworkException extends OpenSearchException
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.
That makes it an Exception, though. "Error" in exception handling has a specific meaning (the program should be halted).
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.
https://github.com/opensearch-project/flow-framework/blob/b3f9d6514d2c0530c8bffac654fe175452673169/src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java#L113C5-L146C55
How about these, should i call it error or exception ?
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's interesting, the rest response includes the word "error" as an "error message" although it's an "exception". I'll defer to @dblock here on what the appropriate spec/api terminology is 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.
🤷♂️ @nhtruong ?
I would map to actual class names in OpenSearch.
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.
We've been calling them errors through out the Spec (e.g ReponseError). The clients also consider non 2XX responses as errors for error handling. As far as Client-Server communication is concerned (i.e. Web API), there's no distinction between Error and Exception, in my opinion. Any non-2XX response tells the user that something has gone wrong, and we usually call it a 500 Error Code etc instead of a 500 exception code.
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.
Let's go with 'Error' instead. I'll go ahead and update the naming from 'Exception' to 'Error'.
Spec Test Coverage Analysis
|
Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org> Signed-off-by: Junwei Dai <59641585+junweid62@users.noreply.github.com>
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 great! Just one missing param as mentioned in the earlier review (and I'm about to file a PR adding the missing docs)
- $ref: '#/components/parameters/flow_framework.create::query.provision' | ||
- $ref: '#/components/parameters/flow_framework.create::query.validation' | ||
# eslint-disable-next-line @cspell/spellchecker | ||
- $ref: '#/components/parameters/flow_framework.create::query.reprovision' |
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 you're missing use_case
: https://opensearch.org/docs/latest/automating-configurations/workflow-templates/
paths: {} | ||
components: | ||
schemas: | ||
FlowFrameworkException: |
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.
That makes it an Exception, though. "Error" in exception handling has a specific meaning (the program should be halted).
Signed-off-by: Junwei Dai <junweid@amazon.com> Signed-off-by: Junwei Dai <junweid@amazon.com>
@dblock Hi, I have addressed all the comments and made the necessary changes. Regarding the suggestion about:
I believe that using the error name directly like this:
makes the it clearer in this particular case. Please let me know your thoughts on this approach. |
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! Good for now, I've suggested some tests you can add, but those can also come in a later PR as you iterate.
response: | ||
status: 201 | ||
output: | ||
test_workflow_id: payload.workflow_id |
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.
Could add some invalid JSON here that would fail parsing for another test.
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 add in the next pr
- synopsis: Delete workflow. | ||
id: delete_flow_framework | ||
path: /_plugins/_flow_framework/workflow/{workflow_id} | ||
method: DELETE | ||
parameters: | ||
workflow_id: ${create_flow_framework.test_workflow_id} | ||
response: | ||
status: 200 |
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 test the wrong ID here as well.
Signed-off-by: Junwei Dai <junweid@amazon.com> Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
Makes sense to me. I am still figuring the best way to do these things too! @nhtruong might have other ideas. Iterate until https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10713232032/job/29722019367?pr=553 is green either way? |
sure, will do |
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
Feel free to merge unless you want to add more test cases.
Signed-off-by: Junwei Dai <junweid@amazon.com>
@dblock Hi, I just fix the lint spec errors, hope everything goes green this time ! |
Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
Signed-off-by: Junwei Dai <junweid@amazon.com>
@dblock Hi, got all lint spec passed locally, hope everything goes well this time! |
👏 |
Description
Part of Adding missing API specs #168
API covered in this PR:
POST /_plugins/_flow_framework/workflow
GET /_plugins/_flow_framework/workflow/{workflow_id}
PUT /_plugins/_flow_framework/workflow/{workflow_id}
DELETE /_plugins/_flow_framework/workflow/{workflow_id}
The rest of API spec will be added in the next PR.
Issues Resolved
Part of #508
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.