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

launch: include validation warnings in returned message #611

Merged

Conversation

giuseppe-steduto
Copy link
Member

In case some warnings are issued when launching a workflow, the launch endpoint will now include them in the returned message.
Closes reanahub/reana-client#660.

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #611 (d5d9438) into master (6cce102) will decrease coverage by 0.07%.
The diff coverage is 44.44%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #611      +/-   ##
==========================================
- Coverage   59.31%   59.25%   -0.07%     
==========================================
  Files          32       32              
  Lines        3230     3235       +5     
==========================================
+ Hits         1916     1917       +1     
- Misses       1314     1318       +4     
Files Changed Coverage Δ
reana_server/rest/launch.py 40.00% <20.00%> (-0.70%) ⬇️
reana_server/validation.py 76.81% <75.00%> (-1.13%) ⬇️

@giuseppe-steduto giuseppe-steduto force-pushed the reana-yaml-allow-unexpected-props branch from 56b23ac to 9215f28 Compare August 9, 2023 14:29
response_data = {
"workflow_id": workflow.id_,
"workflow_name": workflow.name,
"message": "The workflow has been successfully submitted.",
"message": message,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can serialise the warnings in a new validation_warnings (name can be changed) field of the reply, so that we can keep it structured? Otherwise it is impossible client/frontend-side to know whether there were warnings when validating the specification without parsing the message.

Something like

{
  "...": "...",
  "validation_warnings": {
    "additional_properties": ["x", "y", "z"]
  }
}

We can discuss this in IRL, too.

@giuseppe-steduto giuseppe-steduto force-pushed the reana-yaml-allow-unexpected-props branch 2 times, most recently from ca901bd to a939da8 Compare August 24, 2023 14:23
@giuseppe-steduto giuseppe-steduto marked this pull request as ready for review August 24, 2023 14:50
@giuseppe-steduto giuseppe-steduto force-pushed the reana-yaml-allow-unexpected-props branch 2 times, most recently from 9a78d6b to 31e1ac7 Compare August 29, 2023 16:44
CHANGES.rst Outdated
@@ -4,6 +4,7 @@ Changes
Version 0.9.1 (UNRELEASED)
--------------------------

- Changes OpenAPI specification to include the optional ``validation_warnings`` key in the response of the ``launch`` endpoint.
Copy link
Member

Choose a reason for hiding this comment

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

Given that not only the OpenAPI spec has changed, but also what the endpoint returns, I would say something like Changes ``launch`` endpoint to also include the warnings of the validation of the workflow specification. What do you think?

description: >-
Dictionary of validation warnings, if any. Each
key is a property that was not correctly validated.
type: object
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about specifying this more, so that it is easily usable also in r-client-go? With the current specification, validation_warnings is a interface{} (note that currently we do not use the launch endpoint in the clients, but I think it's still a good idea to have precise OpenAPI specs)

@@ -107,7 +107,7 @@ def validate_inputs(reana_yaml: Dict) -> None:
)


def validate_workflow(reana_yaml: Dict, input_parameters: Dict) -> None:
def validate_workflow(reana_yaml: Dict, input_parameters: Dict) -> List[Exception]:
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be Dict[...] and not List[Exception]

@giuseppe-steduto giuseppe-steduto force-pushed the reana-yaml-allow-unexpected-props branch 2 times, most recently from 1375649 to 8c490d8 Compare August 30, 2023 15:46
In case some warnings are issued when launching a workflow, the `launch`
endpoint will now include them in a new `validation_warnings` key.

Closes reanahub/reana-client#660.
@giuseppe-steduto giuseppe-steduto force-pushed the reana-yaml-allow-unexpected-props branch from 8c490d8 to d5d9438 Compare August 30, 2023 15:52
@mdonadoni mdonadoni merged commit d5d9438 into reanahub:master Aug 31, 2023
11 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.

reana.yaml: consider allowing unexpected properties
2 participants