Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't overwrite marshmallow URL #6
Currently you are overwriting marshmallow's own URL field. I don't think this is a good choice generally because in my case I want to validate a URL (so I have an input schema) and obviously I don't have an endpoint to provide it with in this case. It doesn't even make sense to have URLs require endpoints for input/validation.
Perhaps you should call the URL within flask-marshmallow differently?
You could can still use the vanilla marshmallow URL field:
from marshmallow.fields import URL as ValidatedURL class InSchema(ma.Schema): url = ValidatedURL()
This makes me think, though: flask-marshmallow's URL field currently does not have any validation or deserialization behavior. It may make sense for it to have the same validation behavior as vanilla marshmallow's URL field.
I think the URL field within flask-marshmallow should be called differently in any case. Currently it's the only field that overwrites a regular marshmallow field which introduces inconsistency. It should be named after its purpose which is to provide a url_for to the serializer. Also, there is probably no need to deserialize this kind of URL and validate it.
What would that even look like? Check that it is a valid flask route?