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

Complete API spec implementation for flow_framework #565

Merged
merged 11 commits into from
Sep 11, 2024

Conversation

junweid62
Copy link
Contributor

@junweid62 junweid62 commented Sep 10, 2024

Description

Part of Adding missing API specs #168

API covered in this PR:

  • /_plugins/_flow_framework/workflow/_steps:

  • /_plugins/_flow_framework/workflow/_search:

  • /_plugins/_flow_framework/workflow/state/_search:

  • /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision:

  • /_plugins/_flow_framework/workflow/{workflow_id}/_provision:

  • /_plugins/_flow_framework/workflow/{workflow_id}/_status:

At this point, all FlowFramework APIs are covered

Issues Resolved

Resolved #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.

Junwei Dai added 8 commits September 9, 2024 20:35
Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
2. Adding Test for this API

Signed-off-by: Junwei Dai <[email protected]>
Signed-off-by: Junwei Dai <[email protected]>
@junweid62
Copy link
Contributor Author

@dbwiddis Just finished up the remaining API specs. I'd really appreciate it if you could check it out. Thanks!

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM from a Flow Framework API perspective! A few documentation nits/suggestions.

Did not review the technical details of the openapi spec.

CHANGELOG.md Outdated Show resolved Hide resolved
properties:
error:
type: string
description: Error message when a duplicate key is found in the request.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure "duplicate key" is self-descriptive here. Is this a duplicate param, or a duplicate field in the body JSON?

Copy link
Contributor Author

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/dc20feb9d25b7c60bd76c8f5cc66a5a1eed860e2/src/main/java/org/opensearch/flowframework/rest/RestProvisionWorkflowAction.java#L125C2-L128C22

Because we can pass it as a query parameter or as a string value of a request body field

The error message is this. I naming DuplicateKeyError by the error message, should i change it ?

Copy link
Member

Choose a reason for hiding this comment

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

This looks correct to me, should match the code.

Copy link
Member

Choose a reason for hiding this comment

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

For now as @dblock says it's ok to match the code. The error message should probably be "duplicate param" but not a big deal to leave it as is. If you get the message you'll know what you did wrong. Whoever wrote that code should have thought better. ;)

spec/schemas/flow_framework.common.yaml Outdated Show resolved Hide resolved
dblock
dblock previously approved these changes Sep 10, 2024
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Looks good. Will leave it unmerged to address various comments.

Consider breaking up the workflow test into workflow/privision.yaml, deprovision.yaml, etc. We are going to use these tests to provide samples for the documentation and users will be mostly looking to copy-paste examples to "privision a workflow" - it gets messy when there's too much going on and often setup may become unrelated (to deprovision a workflow you should have one privisioned in a prologue).

tests/default/flow_framework/workflow.yaml Outdated Show resolved Hide resolved
status: 200
- synopsis: Delete workflow With Wrong ID.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- synopsis: Delete workflow With Wrong ID.
- synopsis: Delete workflow using an invalid ID.

Copy link
Member

Choose a reason for hiding this comment

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

You don't like my suggestion? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dblock Sorry about that! I used GitHub's signoff and commit suggestion feature for that commit, so I did it directly on the page. The other changes are committed locally, but I haven't pushed them yet since I'm still working on the tests. I'll let you know once everything's done!

tests/default/flow_framework/workflow.yaml Outdated Show resolved Hide resolved
tests/default/flow_framework/workflow.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Sep 10, 2024

Changes Analysis

Commit SHA: 7c76787
Comparing To SHA: 3dcced9

API Changes

Summary

├─┬Paths
│ ├──[➕] path (3640:3)
│ ├──[➕] path (3691:3)
│ ├──[➕] path (3522:3)
│ ├──[➕] path (3473:3)
│ ├──[➕] path (3615:3)
│ ├──[➕] path (3668:3)
│ ├─┬/_plugins/_flow_framework/workflow/{workflow_id}
│ │ ├─┬PUT
│ │ │ ├──[➕] parameters (17160:13)❌ 
│ │ │ ├──[➕] parameters (17179:13)❌ 
│ │ │ ├──[➕] parameters (17184:13)❌ 
│ │ │ ├──[➕] parameters (17166:13)❌ 
│ │ │ └─┬Responses
│ │ │   └──[➕] codes (26367:7)
│ │ └─┬DELETE
│ │   └─┬Responses
│ │     └──[➖] codes (25977:7)❌ 
│ └─┬/_plugins/_flow_framework/workflow
│   └─┬POST
│     ├──[➕] parameters (17081:13)❌ 
│     └─┬Parameters
│       └─┬Schema
│         └──[🔀] $ref (45146:20)❌ 
└─┬Components
  ├──[➕] requestBodies (24159:7)
  ├──[➕] requestBodies (24171:7)
  ├──[➕] requestBodies (24165:7)
  ├──[➖] responses (25977:7)❌ 
  ├──[➕] responses (26290:7)
  ├──[➕] responses (26278:7)
  ├──[➕] responses (26254:7)
  ├──[➕] responses (26272:7)
  ├──[➕] responses (26282:7)
  ├──[➕] responses (26328:7)
  ├──[➕] responses (26336:7)
  ├──[➕] responses (26262:7)
  ├──[➕] responses (26312:7)
  ├──[➕] responses (26332:7)
  ├──[➕] responses (26268:7)
  ├──[➕] responses (26367:7)
  ├──[➕] responses (26294:7)
  ├──[➕] responses (26320:7)
  ├──[➕] responses (26308:7)
  ├──[➕] responses (26348:7)
  ├──[➕] responses (26340:7)
  ├──[➕] responses (26352:7)
  ├──[➕] responses (26344:7)
  ├──[➕] responses (26324:7)
  ├──[➕] responses (26258:7)
  ├──[➕] responses (26286:7)
  ├──[➕] parameters (17164:7)
  ├──[➕] parameters (17175:7)
  ├──[➕] parameters (17183:7)
  ├──[➕] parameters (17159:7)
  ├──[➕] parameters (17122:7)
  ├──[➕] parameters (17128:7)
  ├──[➕] parameters (17134:7)
  ├──[➕] parameters (17080:7)
  ├──[➕] parameters (17147:7)
  ├──[➕] parameters (17117:7)
  ├──[➕] parameters (17111:7)
  ├──[➕] schemas (45429:7)
  ├──[➕] schemas (45158:7)
  ├──[➕] schemas (45370:7)
  ├──[➕] schemas (45161:7)
  ├──[➕] schemas (45266:7)
  ├──[➕] schemas (45146:7)
  ├──[➕] schemas (45239:7)
  ├──[➕] schemas (45284:7)
  ├──[➕] schemas (45388:7)
  ├──[➕] schemas (45122:7)
  ├──[➕] schemas (45025:7)
  ├──[➕] schemas (45282:7)
  ├──[➕] schemas (45498:7)
  ├──[➕] schemas (45449:7)
  ├──[➕] schemas (45508:7)
  ├──[➕] schemas (45310:7)
  ├──[➕] schemas (45172:7)
  ├──[➕] schemas (45202:7)
  ├──[➕] schemas (45420:7)
  ├──[➕] schemas (45029:7)
  ├──[➕] schemas (45328:7)
  ├──[➕] schemas (45459:7)
  ├──[➕] schemas (45226:7)
  ├──[➕] schemas (45189:7)
  ├──[➕] schemas (45297:7)
  ├──[➕] schemas (45109:7)
  ├──[➕] schemas (45235:7)
  ├──[➕] schemas (45261:7)
  ├──[➕] schemas (45150:7)
  ├──[➕] schemas (45411:7)
  ├──[➕] schemas (45548:7)
  └─┬flow_framework.errors:BadRequestError
    ├──[➕] type (45390:13)❌ 
    ├──[➕] properties (45392:9)
    └──[➕] properties (45396:9)

Document Element Total Changes Breaking Changes
paths 14 7
components 71 2
  • BREAKING Changes: 9 out of 85
  • Modifications: 1
  • Removals: 2
  • Additions: 82
  • Breaking Removals: 2
  • Breaking Modifications: 1
  • Breaking Additions: 6

Report

The full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10818912020/artifacts/1921589083

API Coverage

Before After Δ
Covered (%) 537 (52.6 %) 545 (53.38 %) 8 (0.78 %)
Uncovered (%) 484 (47.4 %) 476 (46.62 %) -8 (-0.78 %)
Unknown 26 26 0

@dblock
Copy link
Member

dblock commented Sep 10, 2024

Looks like some legit test failures, might need to update the build ref in the CI.

        FAILED  Create workflow With Reprovision set true. (Operation "PUT /_plugins/_flow_framework/workflow" not found in the spec.)
        FAILED  Create workflow With Reprovision set true and UseCase Not null. (Operation "PUT /_plugins/_flow_framework/workflow" not found in the spec.)
        FAILED  Update workflow With Reprovision set true and UseCase Not null. (Operation "POST /_plugins/_flow_framework/workflow/{workflow_id}" not found in the spec.)

@dbwiddis
Copy link
Member

Looks like some legit test failures, might need to update the build ref in the CI.

        FAILED  Create workflow With Reprovision set true. (Operation "PUT /_plugins/_flow_framework/workflow" not found in the spec.)
        FAILED  Create workflow With Reprovision set true and UseCase Not null. (Operation "PUT /_plugins/_flow_framework/workflow" not found in the spec.)
        FAILED  Update workflow With Reprovision set true and UseCase Not null. (Operation "POST /_plugins/_flow_framework/workflow/{workflow_id}" not found in the spec.)

These seem reversed. POST ends at /workflow, PUT requires the workflow id.

Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Signed-off-by: Junwei Dai <[email protected]>
@junweid62
Copy link
Contributor Author

@dblock Hey, I just pushed a new version. Please take a look when you get a chance!:)

Copy link
Contributor

Spec Test Coverage Analysis

Total Tested
571 282 (49.39 %)

@junweid62
Copy link
Contributor Author

I was also wondering if there's a command that can remove all the empty lines?

@nhtruong
Copy link
Collaborator

@junweid62 most IDEs can do that for you "On Save". You should look up that feature for the IDE you're using.

@dblock dblock merged commit d05ba73 into opensearch-project:main Sep 11, 2024
17 checks passed
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.

[FEATURE] Add specs for flow framework APIs
4 participants