medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.7k stars 2.56k forks source link

"Property expand should not exist" error for "/admin/returns" API route #6587

Open AlexTechNoir opened 8 months ago

AlexTechNoir commented 8 months ago

Bug report

Describe the bug

Good day!

I tried to request /admin/returns?expand=items.item route, but terminal says it's not expandable:

error:   property expand should not exist
Error: property expand should not exist
    at C:\Users\Alex\Desktop\medusa-project\node_modules\@medusajs\medusa\dist\utils\validator.js:153:31
    at step (C:\Users\Alex\Desktop\medusa-project\node_modules\@medusajs\medusa\dist\utils\validator.js:44:23)
    at Object.next (C:\Users\Alex\Desktop\medusa-project\node_modules\@medusajs\medusa\dist\utils\validator.js:25:53)  
    at fulfilled (C:\Users\Alex\Desktop\medusa-project\node_modules\@medusajs\medusa\dist\utils\validator.js:16:58) {  
  type: 'invalid_data',
  code: undefined,
  date: 2024-03-05T14:56:16.211Z
}
::1 - - [05/Mar/2024:14:56:16 +0000] "GET /admin/returns?expand=items.item HTTP/1.1" 400 68 "http://localhost:7001/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"

Without expand, route is working properly

System information

Medusa version (including plugins): 1.20.0 Node.js version: 18.16.1 Database: PostgreSQL Operating system: Win 10 Browser (if relevant):

Steps to reproduce the behavior

  1. Setup Medusa project
  2. Create any Admin page/component and make a request to /admin/returns?expand=items.item
  3. See error in terminal

Expected behavior

Expandable API route

olivermrbl commented 8 months ago

@AlexTechNoir, thanks for highlighting. Would you like to send a PR for it? We will not prioritize this in the near future. You should follow the same pattern applied in many other endpoints. Let me know, and I can help.

AlexTechNoir commented 8 months ago

I don't know auto-tests, so I can't contribute, if that's a requirement

github-actions[bot] commented 2 days ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.