Elite-Kode / elitebgs

BGS tracking tool for Elite Dangerous
https://elitebgs.app/
Apache License 2.0
59 stars 10 forks source link

Swagger spec v5 - Paged responses wrongly described to return list of Page Models in spec. #332

Closed Dimi1010 closed 1 year ago

Dimi1010 commented 1 year ago

The Swagger spec v5 for the EliteBGS Api contains wrong definitions for response bodies for /systems, /factions and /stations GET endpoints. The swagger spec describes that a list of page models should be returned, while in reality only a single page model is returned in the response body.

The wrongly described by swagger response bodies appear to mirror the /ticks GET endpoint response which is correctly defined.

Example for /systems endpoint

Swagger Model Definition ``` [ { "docs": [ { "_id": "string", "__v": 0, "eddb_id": 0, "name": "string", "name_lower": "string", "name_aliases": [ { "name": "string", "name_lower": "string" } ], "x": 0, "y": 0, "z": 0, "system_address": "string", "population": 0, "government": "string", "allegiance": "string", "state": "string", "security": "string", "primary_economy": "string", "secondary_economy": "string", "needs_permit": true, "reserve_type": "string", "controlling_minor_faction_cased": "string", "controlling_minor_faction": "string", "controlling_minor_faction_id": "string", "factions": [ { "faction_id": "string", "name": "string", "name_lower": "string", "faction_details": { "_id": "string", "__v": 0, "eddb_id": 0, "name": "string", "name_lower": "string", "updated_at": "string", "government": "string", "allegiance": "string", "home_system_name": "string", "is_player_faction": true, "faction_presence": [ { "system_name": "string", "system_name_lower": "string", "system_id": "string", "state": "string", "influence": 0, "happiness": "string", "active_states": [ { "state": "string" } ], "pending_states": [ { "state": "string", "trend": 0 } ], "recovering_states": [ { "state": "string", "trend": 0 } ], "conflicts": [ { "type": "string", "status": "string", "opponent_name": "string", "opponent_name_lower": "string", "opponent_faction_id": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } ], "updated_at": "string" } ], "history": [ { "_id": "string", "__v": 0, "updated_at": "string", "updated_by": "string", "system": "string", "system_lower": "string", "system_id": "string", "state": "string", "influence": 0, "happiness": "string", "active_states": [ { "state": "string" } ], "pending_states": [ { "state": "string", "trend": 0 } ], "recovering_states": [ { "state": "string", "trend": 0 } ], "conflicts": [ { "type": "string", "status": "string", "opponent_name": "string", "opponent_name_lower": "string", "opponent_faction_id": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } ], "systems": [ { "system_id": "string", "name": "string", "name_lower": "string" } ] } ] } } ], "conflicts": [ { "type": "string", "status": "string", "faction1": { "faction_id": "string", "name": "string", "name_lower": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 }, "faction2": { "faction_id": "string", "name": "string", "name_lower": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } } ], "faction_history": [ { "_id": "string", "__v": 0, "updated_at": "string", "updated_by": "string", "faction_name": "string", "faction_name_lower": "string", "faction_id": "string", "state": "string", "influence": 0, "happiness": "string", "active_states": [ { "state": "string" } ], "pending_states": [ { "state": "string", "trend": 0 } ], "recovering_states": [ { "state": "string", "trend": 0 } ], "conflicts": [ { "type": "string", "status": "string", "opponent_name": "string", "opponent_name_lower": "string", "opponent_faction_id": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } ], "systems": [ { "system_id": "string", "name": "string", "name_lower": "string" } ] } ], "history": [ { "_id": "string", "updated_at": "string", "updated_by": "string", "population": 0, "government": "string", "allegiance": "string", "state": "string", "security": "string", "controlling_minor_faction_cased": "string", "controlling_minor_faction": "string", "controlling_minor_faction_id": "string", "factions": [ { "faction_id": "string", "name": "string", "name_lower": "string", "faction_details": { "_id": "string", "__v": 0, "eddb_id": 0, "name": "string", "name_lower": "string", "updated_at": "string", "government": "string", "allegiance": "string", "home_system_name": "string", "is_player_faction": true, "faction_presence": [ { "system_name": "string", "system_name_lower": "string", "system_id": "string", "state": "string", "influence": 0, "happiness": "string", "active_states": [ { "state": "string" } ], "pending_states": [ { "state": "string", "trend": 0 } ], "recovering_states": [ { "state": "string", "trend": 0 } ], "conflicts": [ { "type": "string", "status": "string", "opponent_name": "string", "opponent_name_lower": "string", "opponent_faction_id": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } ], "updated_at": "string" } ], "history": [ { "_id": "string", "__v": 0, "updated_at": "string", "updated_by": "string", "system": "string", "system_lower": "string", "system_id": "string", "state": "string", "influence": 0, "happiness": "string", "active_states": [ { "state": "string" } ], "pending_states": [ { "state": "string", "trend": 0 } ], "recovering_states": [ { "state": "string", "trend": 0 } ], "conflicts": [ { "type": "string", "status": "string", "opponent_name": "string", "opponent_name_lower": "string", "opponent_faction_id": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } ], "systems": [ { "system_id": "string", "name": "string", "name_lower": "string" } ] } ] } } ], "conflicts": [ { "type": "string", "status": "string", "faction1": { "faction_id": "string", "name": "string", "name_lower": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 }, "faction2": { "faction_id": "string", "name": "string", "name_lower": "string", "station_id": "string", "stake": "string", "stake_lower": "string", "days_won": 0 } } ] } ], "updated_at": "string" } ], "total": 0, "limit": 0, "page": 0, "pages": 0 } ] ```
Actual response body ``` { "docs": [ { "_id": "59f4d402d22c775be0eaa144", "__v": 0, "allegiance": "alliance", "conflicts": [], "controlling_minor_faction": "applied science investments", "controlling_minor_faction_cased": "Applied Science Investments", "controlling_minor_faction_id": "61daa6a35ec5c1af81527fd8", "eddb_id": 4035, "factions": [ { "name": "HIP 71572 Fortune Interstellar", "name_lower": "hip 71572 fortune interstellar", "faction_id": "59f39984d22c775be07869cc" }, { "name": "HR 5550 Future", "name_lower": "hr 5550 future", "faction_id": "59f4d402d22c775be0eaa18b" }, { "name": "Dao Monarchy", "name_lower": "dao monarchy", "faction_id": "59f3a5a9d22c775be08d9166" }, { "name": "Applied Science Investments", "name_lower": "applied science investments", "faction_id": "61daa6a35ec5c1af81527fd8" }, { "name": "Razorback Astronautics", "name_lower": "razorback astronautics", "faction_id": "5c1e3f526089225b68d6a550" } ], "government": "$government_corporate;", "name": "Dao", "name_lower": "dao", "population": 2600, "primary_economy": "$economy_extraction;", "secondary_economy": "$economy_none;", "security": "$system_security_low;", "state": "boom", "system_address": "5068732966345", "updated_at": "2022-11-17T18:40:03.000Z", "x": -17.375, "y": 131.25, "z": 83.9375, "name_aliases": [] } ], "total": 1, "limit": 10, "page": 1, "pages": 1, "pagingCounter": 1, "hasPrevPage": false, "hasNextPage": false, "prevPage": null, "nextPage": null } ```
SayakMukhopadhyay commented 1 year ago

Thanks for creating this issue. This should be fixed now.