-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Get the name of the board #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
| type: object | ||
|
|
||
|
|
||
| /v1/system/name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to use a more generic endpoint like /v1/system/information.
This would make the API more cohesive and easier to extend in the future if new properties are added that still fall under the general “information” category.
If you only need to retrieve the system name, you could either include a query parameter filter (e.g. ?filter=name) or use a more specific endpoint such as /v1/system/information/name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the openapi.yaml file is generated from cmd/gendoc/docs.go file.
You have to add your definition programmatically.
You can take inspiration from:
arduino-app-cli/cmd/gendoc/docs.go
Lines 795 to 825 in 5a33829
| 'data: {"code":"INTERNAL_SERVER_ERROR","message":"An error occurred during operation"}' | |
| `, | |
| }, | |
| Description: "Returns the system resources usage, such as memory, disk and CPU.", | |
| Summary: "Get system resources usage", | |
| Tags: []Tag{SystemTag}, | |
| PossibleErrors: []ErrorResponse{ | |
| {StatusCode: http.StatusInternalServerError, Reference: "#/components/responses/InternalServerError"}, | |
| }, | |
| }, | |
| { | |
| OperationId: "checkUpdate", | |
| Method: http.MethodGet, | |
| Path: "/v1/system/update/check", | |
| Parameters: (*struct { | |
| OnlyArduino bool `query:"only-arduino" description:"If true, check only for Arduino packages that require an upgrade. Default is false."` | |
| })(nil), | |
| CustomSuccessResponse: &CustomResponseDef{ | |
| ContentType: "application/json", | |
| DataStructure: handlers.UpdateCheckResult{}, | |
| Description: "Successful response", | |
| StatusCode: http.StatusOK, | |
| }, | |
| Description: "Returns the details of packages to be upgraded.", | |
| Summary: "Get the packages that requires an upgrade", | |
| Tags: []Tag{SystemTag}, | |
| PossibleErrors: []ErrorResponse{ | |
| {StatusCode: http.StatusInternalServerError, Reference: "#/components/responses/InternalServerError"}, | |
| {StatusCode: http.StatusBadRequest, Reference: "#/components/responses/BadRequest"}, | |
| {StatusCode: http.StatusNoContent, Reference: "#/components/responses/NoContent"}, | |
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucarin91 perhaps would be better to go back to spec first approach, to ease future contributions?
Fix for Issue #55
Issue: Get the name of the board
Changes:
internal/api/api.go,internal/api/docs/openapi.yamlPlease review carefully before merging.