Skip to content

Conversation

@mirkoCrobu
Copy link
Contributor

@mirkoCrobu mirkoCrobu commented Oct 24, 2025

Motivation

closes #795

Following bricks return 500 when asking for details.

  • v1/bricks/arduino:mood_detector
  • v1/bricks/arduino:streamlit_ui
  • v1/bricks/arduino:vibration_anomaly_detection
  • v1/bricks/arduino:video_image_classification
  • v1/bricks/arduino:motion_detection
  • v1/bricks/arduino:video_object_detection

These specific bricks do not have an associated code example. When details are requested, the system erroneously raises an error because the example is not found, rather than handling the missing data gracefully (by returning an empty field).

Change description

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

@mirkoCrobu mirkoCrobu requested a review from dido18 October 24, 2025 09:43
@mirkoCrobu mirkoCrobu self-assigned this Oct 24, 2025
@mirkoCrobu mirkoCrobu requested a review from a team October 24, 2025 09:43
@mirkoCrobu mirkoCrobu changed the title make code example not mandatory make example code optional for brick example details endpoint request Oct 24, 2025
@per1234 per1234 added the bug Something isn't working label Oct 24, 2025
Copy link
Contributor

@dido18 dido18 left a comment

Choose a reason for hiding this comment

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

I would organize the testdata with the content of the assets folder

Something like

testdata/assets
└── 0.4.8
│      ├── compose
│       │   └── arduino
│       │       ├── arduino_cloud
│       ├── docs
│       │   └── arduino
│       │       ├── arduino_cloud
│       └── examples
│           └── arduino
│               ├── arduino_cloud

@dido18 dido18 changed the title make example code optional for brick example details endpoint request fix: make example code optional for brick example details endpoint request Oct 27, 2025
Copy link
Contributor

@dido18 dido18 left a comment

Choose a reason for hiding this comment

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

Can you give an example of the HTTP response of the BricksDetails endpoint when the brick does not have the examples?
I would like to check the code_examples json field.
and avoid code_exampes:null response

@mirkoCrobu
Copy link
Contributor Author

@dido18 here a response with no examples

{
  "id": "arduino:mood_detector",
  "name": "Mood Detection",
  "author": "Arduino",
  "description": "This brick analyzes text sentiment to detect the mood expressed.\nIt classifies text as positive, negative, or neutral.\n",
  "category": "text",
  "status": "installed",
  "readme": "# Mood detector brick\n\nThis brick analyzes text sentiment to detect the mood expressed.\nIt classifies text as positive, negative, or neutral.\n\nExamples:\n- \"I love this board!\" -\u003E positive\n- \"The weather is awful\" -\u003E negative\n- \"I am sad today\" -\u003E negative\n- \"The temperature is 25\" -\u003E neutral\n\n## Code example and usage\n\n```python\nfrom arduino.app_bricks.mood_detector import MoodDetector\n\nmood_detection = MoodDetector()\n\n# Output: positive\nprint(mood_detection.get_sentiment(\"this application is nice\"))\n```\n",
  "api_docs_path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.4.8/api-docs/arduino/app_bricks/mood_detector/API.md",
  "code_examples": [],
  "used_by_apps": null
}

@mirkoCrobu mirkoCrobu merged commit 3680d3f into main Oct 27, 2025
5 checks passed
@mirkoCrobu mirkoCrobu deleted the issue_795 branch October 27, 2025 14:01
lucarin91 pushed a commit that referenced this pull request Oct 28, 2025
fix: make example code optional for brick example details endpoint request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants