Skip to content

Port: do not call validator if unspecified and port not required#173

Merged
sphuber merged 2 commits intodevelopfrom
fix/172/port-validator-if-unspecified
Nov 13, 2020
Merged

Port: do not call validator if unspecified and port not required#173
sphuber merged 2 commits intodevelopfrom
fix/172/port-validator-if-unspecified

Conversation

@sphuber
Copy link
Copy Markdown
Collaborator

@sphuber sphuber commented Oct 3, 2020

Fixes #172

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the UNSPECIFIED value that is passed, but this is a global
constant that should remain internal to plumpy and not be used by
client code.

@sphuber sphuber requested review from greschd and muhrin October 3, 2020 21:22
@muhrin
Copy link
Copy Markdown
Collaborator

muhrin commented Oct 4, 2020

Looks good. Just a quick question: Does this work for port namespaces as well? I'm thinking of cases like when the port namespace is not required but there are children that are (logically in such a case I feel that the namespace itself should be required too).

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the `UNSPECIFIED` value that is passed, but this is a global
constant that should remain internal to `plumpy` and not be used by
client code.
@sphuber sphuber force-pushed the fix/172/port-validator-if-unspecified branch from d99a6cd to d438b82 Compare October 4, 2020 14:05
@sphuber
Copy link
Copy Markdown
Collaborator Author

sphuber commented Oct 4, 2020

Good point. I added an explicit test for namespaces as well.

Copy link
Copy Markdown
Collaborator

@muhrin muhrin 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.

@sphuber sphuber merged commit aa4ad7e into develop Nov 13, 2020
@sphuber sphuber deleted the fix/172/port-validator-if-unspecified branch November 13, 2020 19:53
unkcpz pushed a commit to unkcpz/plumpy that referenced this pull request Dec 14, 2024
…iidateam#173)

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the `UNSPECIFIED` value that is passed, but this is a global
constant that should remain internal to `plumpy` and not be used by
client code.
agoscinski pushed a commit to agoscinski/plumpy that referenced this pull request Apr 13, 2026
…iidateam#173)

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the `UNSPECIFIED` value that is passed, but this is a global
constant that should remain internal to `plumpy` and not be used by
client code.
agoscinski pushed a commit that referenced this pull request Apr 13, 2026
)

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the `UNSPECIFIED` value that is passed, but this is a global
constant that should remain internal to `plumpy` and not be used by
client code.
agoscinski pushed a commit that referenced this pull request Apr 13, 2026
)

If no value is specified for a non-required port, the validator should
not be called because there is nothing to be validated. The current
behavior of calling the validator regardless, forces all validators to
deal with the `UNSPECIFIED` value that is passed, but this is a global
constant that should remain internal to `plumpy` and not be used by
client code.
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.

Should Port.validator be called if the value is unspecified

2 participants