Skip to content

Conversation

@canercidam
Copy link
Contributor

@canercidam canercidam commented Dec 31, 2025

  • A few null array responses are turned into [] for clarity.
  • Bad request responses are now more informative as they contain a message and optionally an error:
    • All bad requests are now handled with the BadRequest() from the new base handler.
    • Enabling without active config: This caused a confusion during builder-playground integration so the "not found" is turned into a "bad request" with a message that explains the situation and makes a suggestion (i.e. creating a builder config).
  • Aligning Bruno collections to avoid errors with loading (and adding some notes)
  • Bruno collections are now using {{variable}} instead of {variable} since the latter doesn't seem to be working with the latest version.
  • Adding a sequence diagram to easily summarize the two parts of the flow:
    • Builder setup by an admin
    • Config access, credential registration and peer discovery by a builder

@canercidam canercidam requested a review from metachris December 31, 2025 03:23
@canercidam canercidam changed the title Improve docs Improve responses and docs Jan 6, 2026
@metachris metachris requested a review from Copilot January 7, 2026 07:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves API error handling and documentation. The key changes include standardizing bad request responses to return structured JSON with descriptive messages, preventing null array returns by pre-allocating slices with capacity, and updating Bruno API collections with proper variable syntax and additional flow documentation.

  • Introduces a base handler struct with a BadRequest() method that returns structured JSON error responses
  • Pre-allocates array responses to return empty slices instead of null
  • Adds a sequence diagram documenting the admin setup and builder access flows

Reviewed changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ports/handler.go New base handler with BadRequest() method for structured error responses
ports/http_handler.go Adopts base handler, uses BadRequest() for error handling, pre-allocates slices
ports/admin_handler.go Adopts base handler, uses BadRequest() for error handling, improves "no config" error message
docs/api-docs/instance-api/collection.bru Adds collection metadata and auth configuration
docs/api-docs/instance-api/Get measurements.bru Fixes URL and sequence number
docs/api-docs/instance-api/BuilderHub Instance API/Get measurements.bru Removes duplicate/moved file
docs/api-docs/admin-api/collection.bru Updates collection name and adds auth comment
docs/api-docs/admin-api/*.bru Updates variable syntax from {var} to {{var}}
docs/api-docs/README.md Adds sequence diagram documenting API flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@canercidam canercidam merged commit d9fbc83 into main Jan 8, 2026
6 checks passed
@canercidam canercidam deleted the caner/improve-docs branch January 8, 2026 11:59
@metachris
Copy link
Contributor

looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants