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

Schema partial=True ignored for location="json" #525

Open
Anti-Distinctlyminty opened this issue Jun 22, 2023 · 1 comment
Open

Schema partial=True ignored for location="json" #525

Anti-Distinctlyminty opened this issue Jun 22, 2023 · 1 comment

Comments

@Anti-Distinctlyminty
Copy link

I am attempting to have an option JSON body, but the user of partial does not work when location="json"

bp = Blueprint(...)

@bp.route("")
class ModelsResource(MethodView):
    @bp.response(HTTPStatus.OK, ModelSchema)
    @bp.arguments(
        ModelSchema(exclude=("model_id", "parameter_schema"), partial=True),   # Partial works
        location="query",
        as_kwargs=True,
    )
    @bp.arguments(
        ModelSchema(only=("parameter_schema",), partial=True), # Partial does *not* work
        location="json",
        as_kwargs=True,
    )
    def put(self, **kwargs):
        result = db.session.scalar(
            sqlalchemy.insert(Model).values(**kwargs).returning(Model)
        )
        db.session.commit()
        return result

Am I doing something incorrect in the above example?

@lafrech
Copy link
Member

lafrech commented Jul 9, 2024

I don't think you're doing anything wrong.

This does sound like a bug. But I'd be surprised if this had been overlooked in webargs.

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