Open-EO / openeo-processes

Interoperable processes for openEO's big Earth observation cloud processing.
https://processes.openeo.org
Apache License 2.0
48 stars 15 forks source link

count: `condition=false`? #375

Closed soxofaan closed 2 years ago

soxofaan commented 2 years ago

https://github.com/Open-EO/openeo-processes/blob/d0ce91fcd347360b907ea2d9589d7564a2c1e1e3/count.json#L56-L64

count supports, apart from a full process graph, two special values for condition:

The schema of condition in the docs at e.g. https://processes.openeo.org/#count say

process-graph:object|boolean|null

Which also include the boolean value false, but its is undefined in the docs.

possible definitions:

soxofaan commented 2 years ago

background story:

m-mohr commented 2 years ago

false is not allowed as input value according to the spec. The part that is defining that is "const: true" in the boolean schema. That means false must be rejected right now (comparable to an integer value with constraint "minimum: 0", which would also reject all values < 0).

Honestly, I regret defining the condition parameter as it is right now. It should have been defined in at least two processes:

That would have been more straightforward. Or I should have used string values instead of the null/false "mis-use". It's just not very intuitive.

soxofaan commented 2 years ago

false is not allowed as input value according to the spec. The part that is defining that is "const: true" in the boolean schema.

Indeed, I see that from the spec in JSON, but the docs are misleading, because they say "boolean" in general Screenshot from 2022-06-30 17-32-25

And apart from that it is very confusing on itself (as you note yourself), that value true is allowed, but false is not

m-mohr commented 2 years ago

Yes, but that is normal behavior in programming language signatures?! It just lists the types/classes without value constraints, otherwise you'd also need to list all other constraints in the signature, e.g. min and max values for numbers or allowed string values for strings.

soxofaan commented 2 years ago

I understand, it's just very weird to see "boolean" as type, but false is illegal.

Also note that the representation of these union schema's (I don't know the correct terminology) in the docs is pretty obscure. Because I've been already exposed to a bit of JSON schema, I kind of get it, but I wonder what the less-initiated user makes from this visual structure:

Screenshot from 2022-06-30 17-52-29

Anyway, I think we should add an explicit note in the docs that false is (currently) not supported

m-mohr commented 2 years ago

Also note that the representation of these union schema's (I don't know the correct terminology) in the docs is pretty obscure.

Yes, I agree. Please open an issue in openeo-vue-components with suggestions and we can try to improve it.

m-mohr commented 2 years ago

ToDo:

soxofaan commented 2 years ago

Please open an issue in openeo-vue-components with suggestions and we can try to improve it.

Is that something we have much control over? I thought this just part of the doc building tool

m-mohr commented 2 years ago

That is something we have control over, the doc building tool is based on the openEO vue components and is developed by me :-)

soxofaan commented 2 years ago

:laughing: I didn't know that, I assumed we were using an off-the-shelf OpenAPI doc generation tool

m-mohr commented 2 years ago

Yes, we do. For the API. But our processes have nothing to do with OpenAPI. :-) The processes are something custom in mainly JSON Schema. The DocGen for the Processes ist just a slightly extended version of the Process(es) Vue Component that we also use in the Web Editor etc.