-
Notifications
You must be signed in to change notification settings - Fork 117
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
Should PyWPS automatically set minOccurs=0 when literal data default is provided? #625
Comments
Instead of being smart and make an automatic adjustment, maybe PyWPS could raise a Warning when instantiating the Process. We'd catch these issues during development and resolve them explicitly. |
@huard |
I have added a new process in Emu to show the usage of default values: Currently the default value is used when no value is provided both for Is this what is expected or should it be different? |
@cehbrecht |
I dug down in the specs. Looking at https://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints
and
There is a distinction between presence of the input and its contained value.
Therefore, it looks like it is valid to have So the test provided by @cehbrecht that defines input The input should be provided explicitly in the execute XML body, but with empty value to respect the That being said, I think the intended use of |
I still find it confusing :) The spec says (?):
I find it hard to set and recognize
In case of Currently we have |
I think the "conceptual" What we could do is define
I don't think we should worry about the case of "empty value provided", because the resulting value in Python code, whether parsed from XML or JSON, will result in |
@fmigneault I would agree with @huard and only raise a Warning when a I think the main trouble is the "mental confusion" ... it will be easier to update the wps services and make it clear in the docs and examples. Agree? Should we do this already for the 4.4.x branch or only on 4.5.x? |
@cehbrecht |
Description
Field
min_occurs=1
is the default of inputs. Whendefault
parameter is provided to define a default literal value, that default1
occurrence loses its meaning. I would imagine most people expect that adding thisdefault
parameter will make their process pick that value if it was omitted, but this will never happen due tomin_occurs=1
check at execution time. The process description also displays ``minOccurs=1and
defaultValue` simultaneously, which makes the default behaviour hard to understand.I am questioning whether PyWPS should be smart about it and automatically adjust the value to
0
whendefault
is provided, since it doesn't make sense to have that default if it cannot be resolved by default when omitting the input value.Although the fix is relatively simple to manually adjust any process I/O incorrectly defined, I find this is a quite common and recurring issue. See for example additional information which is just a list of cases I found within a week, over many WPS process implementations.
Environment
Additional Information
Following related issues/PR where similar problem was noticed:
The text was updated successfully, but these errors were encountered: