Hey there. My Visual Studio doesn't eat your https://api.youneedabudget.com/papi/spec-v1-swagger.json
[Fatal]Error parsing swagger file. Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Nullable`1[Microsoft.Rest.Modeler.Swagger.Model.DataType]' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path 'properties.last_modified_on.type', line 16, position 15.
I'd say that maybe I'm doing something wrong, but there's not a lot to do - enter the link, press "Go".
Some of our types are specified as nullable in the spec and this might be giving the Swagger parser you are using trouble. For example, some of our types look like this:
"type": ["string", "null"]
If you try to change this to:
and it works, then that would explain it. The Swagger 2.0 spec has limited and inconsistent support for nullable types and some parsers do not understand this format. We will eventually migrate to OpenAPI 3.0 spec which has full support for nullable types. In the meantime, you may be able to use an alternative parser or transform the spec on your side before parsing it.Reply
I ran into a similar issue as well, except my parser just ignored it and now I don't have memos on my transactions. I'm using the official swagger codegen.
I'm not an expert on swagger, but I believe the YNAB definition file is incorrect.
From https://swagger.io/docs/specification/data-models/data-types/: type takes a single value. type as a list is not valid in OpenAPI (even though it is valid in JSON Schema)
And from https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject: type - Value MUST be a string. Multiple types via an array are not supported.Reply
FYI - I am working on a change to remove these nullable types from our spec file to prevent the issues some parsers have with it. You can follow our Release Notes for information when this change is made. Thanks for letting us know!Reply