[RFC] Namespace error structures by location in response
See original GitHub issueI think there’s a case we never really considered: two schemas in a different location with a common field name.
In webargs 5, this is not possible in a single use_args
call. In a multi use_args
call, it depends if the user specifies the locations. The response is ambiguous about which field is wrong.
In current implementation in webargs 6, the response is ambiguous. A way to fix this would be to namespace the error structures by location.
Just thinking out loud, writing this here before I forget.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
RFC 5985 - HTTP-Enabled Location Delivery (HELD)
In case of success, the LIS replies with a locationResponse message, including a PIDF-LO document and/or one or more Location URIs. In the...
Read more >RFC Receiver channel: failed to read funtionname from XML
XML to a flat file structure. Now in Runtime Workbench I get the following error: "MP: exception caught with cause com.sap.engine.interfaces.
Read more >RFC 7807: Problem Details for HTTP APIs
RFC 7807 Problem Details March 2016 response body in a machine-readable format, the client can treat it appropriately; for example, triggering a transfer...
Read more >Extensible Messaging and Presence Protocol (XMPP): Core
Resource Binding Namespace A.8. Stanza Error Namespace Appendix B. Contact Addresses Appendix C. Account Provisioning Appendix D. Differences from RFC 3920
Read more >Language Guide (proto3) | Protocol Buffers - Google Developers
This guide describes how to use the protocol buffer language to structure your ... if you wanted to define the reply message format...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Were you thinking something like these structures, with the location as a top-level namespace for the error messages?
I’m looking at maybe doing this by rewriting the error messages in
Parser._on_validation_error
. Does that seem like a good idea? I’m also looking a bit at how we could change the error messages whenSchema.load
gets called, but I’m not seeing a way.I mostly agree, but I think we’re free to make changes to the
messages
field now (in 6.0) which we can’t do later without another major release. So I’d like to decide this before v6 is finished.👍 Cool. I didn’t really think about it before, so if you’re happy with what’s in #463, so am I.
Creating a new error class with
location
in a separate field is what I would do if I wanted to make this change in a minor release. Changingmessages
is a backwards incompatible change for anyone parsing that field’s contents.here's a simple example app which parses the messages
If we rewrite the
messages
field in 6.0, then we’re asking anyone with such an error handler to rewrite it.I don’t think this kind of rewrite would be hard for anyone unless they’re doing very exotic/complex stuff. And in that case, they might not want to rush to v6.0 anyway.
After writing a concrete example of something parsing
messages
, I feel less need to try to avoid changing it. Users could ignore the change by just traversing one level of themessages
dict, if they so choose, and it’s really not that different to have the information there vs in another attribute of the exception.Given the original suggestion was for the version in #463, let’s just go with that?