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

Check validity of process arguments based on JSON Schema #48

Open
jonathom opened this issue Jun 22, 2021 · 2 comments
Open

Check validity of process arguments based on JSON Schema #48

jonathom opened this issue Jun 22, 2021 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@jonathom
Copy link
Member

I submitted a filter_bands process as so: var red = builder.filter_bands(cubes, "B04"), which is accepted and passed to backend (VITO). The process graph then contains

"filter1": {
      "arguments": {
        "bands": "B04",

Which causes a problem in the execution: Invalid band name/index 'B'. Valid names: ['VV', 'B02', 'B04', 'B08']
When I submit the process like this, as intended by specification: var red = builder.filter_bands(cubes, ["B04"]) everything works fine.

Should that throw and error upon submission?
In a quick search I also couldn't find documentation for filter_bands, doesn't look like it's in this repository.. why's that?

@m-mohr
Copy link
Member

m-mohr commented Jun 22, 2021

The processes are built automatically from the process description the back-end returns, which is more flexible then the hardcoded variants e.g. in Python. On the other hand, it's less easy to "customize" and improve the experience. That's why you find them in the Python code, but not in JS or R.

What I'd need to do here is to check the values against the JSON Schema for the parameters. I did not do that because it adds another dependency (ajv) to the JS client. But it's actually a good idea to have that in the repo and as a potential improvement for the future.

@m-mohr m-mohr added the enhancement New feature or request label Jun 22, 2021
@m-mohr m-mohr changed the title filter_bands: client allows submission of non-arrays Check validity of process argument based on JSON Schema Jun 22, 2021
@m-mohr m-mohr changed the title Check validity of process argument based on JSON Schema Check validity of process arguments based on JSON Schema Jun 22, 2021
@m-mohr m-mohr added this to the 1.4.0 milestone Jun 22, 2021
@m-mohr m-mohr self-assigned this Jun 24, 2021
@m-mohr
Copy link
Member

m-mohr commented Jun 25, 2021

This is actually not as easy as it sounds like on first sight.

I tried client validation using openeo/js-processgraphs, but for that I'd need to request all the user processes, which can result in a lot of HTTP requests.

If I do it "on demand" (per parameter), I'd need to first check the back-end processes and if not available, I'd need to load the user-defined process. This makes the process builder methods async, which is undesirable.

For now, I've decided against the validation and moved it to milestone 3.0.0 for now.

@m-mohr m-mohr modified the milestones: 2.0.0, 3.0.0 Jun 25, 2021
@m-mohr m-mohr removed their assignment Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants