Skip to content

Wrong json returned from the api  #1590

Closed
@Leptopoda

Description

@Leptopoda

Description
like #1464 but this time with the recipe_stub it can be seen in the categories and recipe api endpoint.
adding a simple $json['recipe_id'] = strval($json['recipe_id']); to
https://github.com/Leptopoda/cookbook/blob/1fd2668f0ca1311b0585fda5effeeabea1f42d6a/lib/Helper/Filter/JSON/RecipeIdTypeFilter.php#L15
Did not fix it and my php was not good enough to find out why :)

Reproduction
see #1464

Expected behavior
recipe_id is a String

Actual behavior
recipe_id is an integer

Screenshots

Error: Deserializing '[{recipe_id: 248, name: Chef John's Gazpacho, keywords: null, dateCreated: 20...' to 'BuiltList<RecipeStub>'
failed due to: Deserializing '[recipe_id, 248, name, Chef John's Gazpacho, dateCreated, 2021-01-30 14:58:28...' to 'RecipeStub'
failed due to: Deserializing '248' to 'String' failed due to: type 'int' is not a subtype of type 'String' in type cast

Browser
n.a.

Versions
Nextcloud server version: 26.0.0
Cookbook version: 0.10.2
Database system: Sqlite and MariaDB

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions