Skip to content

All Brand APIs#13

Merged
petrubraha merged 3 commits intomainfrom
9-brand-resource-apis
Mar 7, 2026
Merged

All Brand APIs#13
petrubraha merged 3 commits intomainfrom
9-brand-resource-apis

Conversation

@petrubraha
Copy link
Member

@petrubraha petrubraha commented Mar 7, 2026

Summary by CodeRabbit

  • New Features
    • Brand management API added with full CRUD REST endpoints.
    • Brands include name, logo URL, created/updated timestamps.
    • Validation for name and logo URL formats and lengths.
    • Delete operation is idempotent and documents restricted cascading behavior.
    • Endpoints return clear error responses for invalid input, missing resources, conflicts, and server errors.

@petrubraha petrubraha self-assigned this Mar 7, 2026
@petrubraha petrubraha added the documentation Improvements or additions to documentation label Mar 7, 2026
@petrubraha petrubraha added the enhancement New feature or request label Mar 7, 2026
@petrubraha petrubraha linked an issue Mar 7, 2026 that may be closed by this pull request
@petrubraha petrubraha removed the documentation Improvements or additions to documentation label Mar 7, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34c4328d-39ce-4640-91b9-ae95ebb6f4f1

📥 Commits

Reviewing files that changed from the base of the PR and between fa4626d and 59537ba.

📒 Files selected for processing (1)
  • smithy/model/brand/brand-types.smithy
🚧 Files skipped from review as they are similar to previous changes (1)
  • smithy/model/brand/brand-types.smithy

📝 Walkthrough

Walkthrough

Adds a new Brand resource and full CRUD API surface to the Smithy model, plus IO and type definitions for Brand fields (ResourceName, ImageUrl) and registers Brand in the InAndOut service resources list.

Changes

Cohort / File(s) Summary
Brand API Operations
smithy/model/brand/brand-apis.smithy
New Brand resource and CRUD operations: CreateBrand (POST), GetBrand (GET, @readonly), UpdateBrand (PATCH), DeleteBrand (DELETE, @idempotent, documentation note). Each op has HTTP bindings and error unions (InvalidInputError, ResourceNotFoundError, ResourceAlreadyExistsError, DeleteRestrictedError, InternalServerError).
Brand IO Structures
smithy/model/brand/brand-io.smithy
Added input structures: CreateBrandInput, GetBrandInput, UpdateBrandInput, DeleteBrandInput with required fields and @httpLabel usage for brandId.
Brand Types
smithy/model/brand/brand-types.smithy
Added BrandSummary structure with brandId, name, optional logoUrl, and required createdAt/updatedAt.
Shared Types
smithy/model/common.smithy
Introduced ResourceName and ImageUrl string types with pattern and length constraints.
Service Integration
smithy/model/main.smithy
Imported Brand and added it to InAndOut service resources list (minor import/order update).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • vardhan3236
  • lefcos
  • narenkarthik370h

Poem

🐰 I hop through lines of Smithy bright,
New brands appear beneath moonlight,
Names and logos neatly play—
CRUD carrots laid along the way,
I nibble bytes and bound with delight.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'All Brand APIs' directly and clearly summarizes the main change: introducing a complete set of Brand API operations (CRUD) with all necessary models and type definitions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 9-brand-resource-apis

Comment @coderabbitai help to get the list of available commands and usage tips.

@petrubraha petrubraha moved this from Todo to In Progress in InAndOut-Planning Mar 7, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
smithy/model/brand/brand-apis.smithy (1)

14-28: Consider adding a ListBrands operation.

The Brand resource has full CRUD operations, but there's no list operation defined. Clients typically need to retrieve all or paginated brands. If this is intentional for the initial implementation, consider adding it as a follow-up.

📋 Example ListBrands operation
// In brand-io.smithy, add:
structure ListBrandsInput {
    `@httpQuery`("maxResults")
    maxResults: Integer

    `@httpQuery`("nextToken")
    nextToken: String
}

structure ListBrandsOutput {
    `@required`
    brands: BrandSummaryList

    nextToken: String
}

list BrandSummaryList {
    member: BrandSummary
}

// In brand-apis.smithy, add to resource:
resource Brand {
    // ... existing
    list: ListBrands
}

`@readonly`
`@http`(method: "GET", uri: "/brands")
`@paginated`(inputToken: "nextToken", outputToken: "nextToken", pageSize: "maxResults", items: "brands")
operation ListBrands {
    input: ListBrandsInput
    output: ListBrandsOutput
    errors: [
        InvalidInputError
        InternalServerError
    ]
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smithy/model/brand/brand-apis.smithy` around lines 14 - 28, The Brand
resource lacks a list operation; add a paginated ListBrands operation by
defining ListBrandsInput (with maxResults and nextToken as `@httpQuery`),
ListBrandsOutput (with required brands and nextToken), a
BrandSummary/BrandSummaryList type for list items, and wire it into the Brand
resource with list: ListBrands; then declare the `@readonly` `@http` GET /brands
operation with `@paginated`(inputToken="nextToken", outputToken="nextToken",
pageSize="maxResults", items="brands") and include relevant errors (e.g.,
InvalidInputError, InternalServerError) so clients can retrieve paginated brand
lists.
smithy/model/common.smithy (1)

17-19: ImageUrl pattern may reject valid image URLs with query parameters.

The current regex requires the URL to end with an image extension (.jpg, .png, etc.), but many CDN-hosted images include query parameters for versioning or transformations (e.g., https://cdn.example.com/logo.png?v=123 or https://cdn.example.com/logo.jpg?width=200). These would fail validation.

Also, the minimum length of 8 may be slightly low—even http://x.jpg is 13 characters.

♻️ Suggested pattern to allow query strings
-@pattern("^https?://[a-zA-Z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=%]+\\.(jpg|jpeg|png|gif)$")
-@length(min: 8, max: 255)
+@pattern("^https?://[a-zA-Z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=%]+\\.(jpg|jpeg|png|gif)(\\?[a-zA-Z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=%]*)?$")
+@length(min: 12, max: 255)
 string ImageUrl
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smithy/model/common.smithy` around lines 17 - 19, The ImageUrl string type's
`@pattern` currently requires the URL to end with an image extension and will
reject valid URLs with query strings or fragments; update the `@pattern` on
ImageUrl to allow an optional query string and fragment after the extension
(ensure the extension like .jpg|.jpeg|.png|.gif appears before any ? or #) and
adjust the `@length` annotation to a higher minimum (e.g., min: 13) to avoid
too-short URLs; modify the `@pattern` annotation and the `@length`(min: ...) value
on the ImageUrl definition accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@smithy/model/brand/brand-apis.smithy`:
- Around line 14-28: The Brand resource lacks a list operation; add a paginated
ListBrands operation by defining ListBrandsInput (with maxResults and nextToken
as `@httpQuery`), ListBrandsOutput (with required brands and nextToken), a
BrandSummary/BrandSummaryList type for list items, and wire it into the Brand
resource with list: ListBrands; then declare the `@readonly` `@http` GET /brands
operation with `@paginated`(inputToken="nextToken", outputToken="nextToken",
pageSize="maxResults", items="brands") and include relevant errors (e.g.,
InvalidInputError, InternalServerError) so clients can retrieve paginated brand
lists.

In `@smithy/model/common.smithy`:
- Around line 17-19: The ImageUrl string type's `@pattern` currently requires the
URL to end with an image extension and will reject valid URLs with query strings
or fragments; update the `@pattern` on ImageUrl to allow an optional query string
and fragment after the extension (ensure the extension like .jpg|.jpeg|.png|.gif
appears before any ? or #) and adjust the `@length` annotation to a higher minimum
(e.g., min: 13) to avoid too-short URLs; modify the `@pattern` annotation and the
`@length`(min: ...) value on the ImageUrl definition accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 136c4eb0-7cbb-4aeb-96d0-e20490586914

📥 Commits

Reviewing files that changed from the base of the PR and between f1a4501 and c442f82.

📒 Files selected for processing (5)
  • smithy/model/brand/brand-apis.smithy
  • smithy/model/brand/brand-io.smithy
  • smithy/model/brand/brand-types.smithy
  • smithy/model/common.smithy
  • smithy/model/main.smithy

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@smithy/model/brand/brand-types.smithy`:
- Around line 9-12: Remove the redundant `@resourceIdentifier`("brandId") trait
from the BrandSummary structure: edit the BrandSummary definition and delete the
`@resourceIdentifier` annotation on the brandId member so only `@required` remains
for the brandId field; locate the brandId member in the BrandSummary structure
to make this change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 540464fe-973f-42e9-8413-b84fcbeec3f8

📥 Commits

Reviewing files that changed from the base of the PR and between c442f82 and fa4626d.

📒 Files selected for processing (1)
  • smithy/model/brand/brand-types.smithy

@petrubraha petrubraha merged commit aa36548 into main Mar 7, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in InAndOut-Planning Mar 7, 2026
@petrubraha petrubraha deleted the 9-brand-resource-apis branch March 7, 2026 21:30
@coderabbitai coderabbitai bot mentioned this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Brand Resource APIs

2 participants