Making a get request against /api/v1/acquisitions/orders/ generates the following exception when aqorders.created_by is null i database [2021-04-28 14:10:21.48828] [600131] [warn] OpenAPI >>> GET api/v1/acquisitions/orders/ [{"message":"Expected integer - got null.","path":"\/0\/created_by"},{"message":"Expected integer - got null.","path":"\/1\/created_by"},{"message":"Expected integer - got null.","path":"\/2\/created_by"},{"message":"Expected integer - got null.","path":"\/3\/created_by"},{"message":"Expected integer - got null.","path":"\/4\/created_by"},{"message":"Expected integer - got null."
Can be NULL in DB 638 `created_by` int(11) DEFAULT NULL COMMENT 'the borrowernumber of order line''s creator', But not in the API specs.
What version of Koha are you using, Stefan? This is fixed in 20.11+. I will submit a patch for 20.05.
They are using 20.05.09
This is fixed in master/21.05+ by bug 20212, so making it a target for 20.11 as well.
Created attachment 120318 [details] [review] Bug 28248: aqorders.created_by is nullable This patch introduces a change to the spec to acknowledge that the field is nullable. This is fixed in 21.05+ as part of bug 20212. To test: 1. Have an order with created_by = NULL 2. Use your favourite REST tool (Postman?) to fetch the order => FAIL: It throws a nasty error about non-nullable field being null 3. Apply this patch 4. Reload all 5. Repeat 2 => SUCCESS: It returns things, created_by is NULL, as it should 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Stefan, can you test this patch and confirm that it fixes the issue you reported?
Created attachment 120349 [details] [review] Bug 28248: aqorders.created_by is nullable This patch introduces a change to the spec to acknowledge that the field is nullable. This is fixed in 21.05+ as part of bug 20212. To test: 1. Have an order with created_by = NULL 2. Use your favourite REST tool (Advanced REST Client(libre), Postman?) to fetch the order => FAIL: It throws a nasty error about non-nullable field being null 3. Apply this patch 4. Reload all 5. Repeat 2 => SUCCESS: It returns things, created_by is NULL, as it should 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Works :) Testing notes: - don't forget it's for 20.11.x, not master. - Testing without REST client can be done via http://localhost:8081/api/v1/acquisitions/orders/1
Code looks good, QA script happy. Count my QA stamp in :) Signoff still needed if you can Stefan.
It's been over a week. I think it's safe to move forward on this one!
Created attachment 120675 [details] [review] Bug 28248: aqorders.created_by is nullable This patch introduces a change to the spec to acknowledge that the field is nullable. This is fixed in 21.05+ as part of bug 20212. To test: 1. Have an order with created_by = NULL 2. Use your favourite REST tool (Advanced REST Client(libre), Postman?) to fetch the order => FAIL: It throws a nasty error about non-nullable field being null 3. Apply this patch 4. Reload all 5. Repeat 2 => SUCCESS: It returns things, created_by is NULL, as it should 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Sending to 20.11 queue.
Pushed to 20.11.x for 20.11.06
Pushed to 20.05.x for 20.05.12
Missing dependencies for 19.11.x, it shouldn't be affected, no backport.