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

BudgetSummary Model issue for dateFormat and currencyFormat #12

Open
TheFern2 opened this issue Nov 12, 2024 · 1 comment
Open

BudgetSummary Model issue for dateFormat and currencyFormat #12

TheFern2 opened this issue Nov 12, 2024 · 1 comment

Comments

@TheFern2
Copy link

I am getting a token with implicit flow:

image

I can make requests to the api just fine with the same token.

image

Ran again to print the error, doesn't say much though. Any idea what went wrong?

Error: The operation couldn’t be completed. (SwiftYNAB.SwiftYNABError error 0.)
Error Code: 0
Error Domain: SwiftYNAB.SwiftYNABError
@TheFern2 TheFern2 changed the title Not working? BudgetSummary Model issue for dateFormat and currencyFormat Nov 12, 2024
@TheFern2
Copy link
Author

Not sure why this issue occurred I assume at some point ynab created this budget and it looks like this:

From the json data of /budgets

{
  "id": "[redacted]",
  "name": "My Budget",
  "last_modified_on": "2023-08-04T19:53:23Z",
  "first_month": "2023-08-01",
  "last_month": "2023-09-01",
  "date_format": null,
  "currency_format": null
}

This is obviously creating a decoding error as those two properties are not Optional

/// Budget summary model
public struct BudgetSummary: Codable, Equatable {
    /// Budget id
    public let id: String

    /// Budget name
    public let name: String

    /// Date the budget was last modified
    public let lastModifiedOn: String

    /// Budget's first month
    public let firstMonth: String

    /// Budget's last month
    public let lastMonth: String

    /// Date formatting settings
    public let dateFormat: DateFormat

    /// Currency formatting settings
    public let currencyFormat: CurrencyFormat
}

I'll create a fork and make those two optionals, unless you think it really doesn't happen often.

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

1 participant