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

validation issues #254

Open
martinschorb opened this issue Feb 15, 2024 · 1 comment
Open

validation issues #254

martinschorb opened this issue Feb 15, 2024 · 1 comment

Comments

@martinschorb
Copy link

Hi,

I am trying to write some tests and found some weird schema validation behavior:

  1. OneOf does not seem to work:
    "matchModelType" : "This type clearly does not exist!" throws no validation error for a MatchDerivationParameters object.

  2. a float validates even if Int is required.

I can only force validation errors when providing the completely wrong type (str vs. int).

From the dependencies (bigfeta and asap) I am stuck with rather old versions of argschema and marshmallow and I wonder if that could be a reason.

Have you observed something similar before?

RussTorres added a commit that referenced this issue Feb 22, 2024
Fixing bug mentioned in #254
@RussTorres
Copy link
Collaborator

Hi Martin,

The old versions of marshmallow and argschema particularly in bigfeta are a pain point -- I have been looking into modernizing them, but a lot of behavior has changed that makes it more difficult to follow through.
I see great benefits to upgrading, including benefits to automated pipelining, but it hasn't been on our radar for a long time, and will likely be a fairly large (though hopefully mostly transparent) change. This is captured in #205 when we forked versions, but it's probably time to work on this and avoid a mess of warnings and future problems.

For specific questions with this implementation:

asap.module.schemas.renderclient_schemas.MatchDerivationParameters does indeed have a typo that is causing this issue -- it should be validate=validate.OneOf instead of what is there (captured in #255, but I will double-check the rest of the repo).

Per marshmallow's documentation, anything that can be cast as an int will be a valid input to an integer field unless it is given strict=True, where the default is False. Please feel free to subclass with strict or put in a PR where you think it is generally applicable.

Thank you,
Russel

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

No branches or pull requests

2 participants