The API tester on the docs page answers questions the real endpoint answers differently #59
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Try it panel on the API docs page re-implements the callsign lookup in the LiveView process instead of calling the endpoint. It applies a 30 day window the endpoint does not have and it matches only the sender column, so for an old packet, or for an object or item name the endpoint resolves through
object_nameanditem_name, the panel saysNo packets foundwhileGET /api/v1/callsign/<same>returns the packet. The page states it is calling the API, so a developer debugging their client trusts the wrong answer.Evidence
At
2f150f66:lib/aprsme_web/live/api_docs_live.ex:109buildsthirty_days_agoand:113passes it asstart_timewithlimit: 1intoPackets.get_recent_packets/1, which also filters by sender only (lib/aprsme/packets/query_builder.ex:58).lib/aprsme_web/controllers/api/v1/callsign_controller.ex:66callsPackets.get_latest_packet_for_callsign/1, which has no time bound and matchesobject_nameanditem_nameatlib/aprsme/packets/prepared_queries.ex:32.lib/aprsme_web/live/api_docs_live.ex:899tells the visitor the panel calls the API directly.Expected
The tester shows what the documented endpoint returns, either by issuing the HTTP request or by calling the same function the controller calls.
How to verify
Create one packet 45 days old and one packet whose
object_nameisEOC, then compare the panel output withcurl /api/v1/callsign/<name>for each. Both diverge today.Acceptance criteria
Effort: S
Lens: api