You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using typesystem to implement a client for an HTTP API, and it's almost perfect for the jobs of constructing payloads to send and parsing payloads that have been received.
The API in question includes nested structures, so I'd like to be able to feed response.json() straight into a schema to get back what's effectively a data class. Using MySchema.validate(payload) works, but it makes the library fragile to changes in the API, like extra options being added to Choice fields that would then cause validation errors on all responses. MySchema(payload) has the right (liberal) behaviour for flat schemas, but nested structures don't get parsed into the Reference fields:
Could you explain the reasoning behind the current behaviour of the Schema.__init__ method when passed a single arg?
Would it be possible to instantiate Reference fields in this way? E.g. the current:
I'm using typesystem to implement a client for an HTTP API, and it's almost perfect for the jobs of constructing payloads to send and parsing payloads that have been received.
The API in question includes nested structures, so I'd like to be able to feed
response.json()
straight into a schema to get back what's effectively a data class. UsingMySchema.validate(payload)
works, but it makes the library fragile to changes in the API, like extra options being added toChoice
fields that would then cause validation errors on all responses.MySchema(payload)
has the right (liberal) behaviour for flat schemas, but nested structures don't get parsed into theReference
fields:Could you explain the reasoning behind the current behaviour of the
Schema.__init__
method when passed a singlearg
?Would it be possible to instantiate
Reference
fields in this way? E.g. the current:could become
The text was updated successfully, but these errors were encountered: