Re: [go-nuts] Unmarshal variable JSON structures

2022-12-26 Thread Marcin Romaszewicz
Here is an example of what I mean. https://go.dev/play/p/O6KIsxmSeaN This is why I wrote a code generator, it's tedious by hand :) On Mon, Dec 26, 2022 at 11:08 AM Marcin Romaszewicz wrote: > This is a very annoying problem, and one that we hit a lot in my project ( > https://github.com/deepma

Re: [go-nuts] Unmarshal variable JSON structures

2022-12-26 Thread Marcin Romaszewicz
This is a very annoying problem, and one that we hit a lot in my project ( https://github.com/deepmap/oapi-codegen), where we generate Go models from OpenAPI specs, and the OpenAPI "AnyOf" or "OneOf" schema does precisely this. You can partially unmarshal; store your "type" field in a typed variab