Skip to content

Minimal modelling to simply get started#3

Merged
petrubraha merged 21 commits intomainfrom
mvp
Mar 7, 2026
Merged

Minimal modelling to simply get started#3
petrubraha merged 21 commits intomainfrom
mvp

Conversation

@petrubraha
Copy link
Member

@petrubraha petrubraha commented Mar 5, 2026

One single operation needed to spin up the development. I was stuck in too many models with the previous PR.

Functional goals:

  • Being able to convert to openapi specification
  • Being able to create Java models
  • Being able to create Typescript models

Feel free to review the current code and add comments where problems could arise.

Summary by CodeRabbit

  • New Features

    • Introduced a complete API model including a new service with a TSP operation, request/response types, solution data structures, UUID types, and a set of client/server error shapes.
    • Added generation targets for Java, TypeScript, and OpenAPI outputs.
  • Documentation

    • Updated README with revised description and added References section.
  • Chores

    • Added gitignore entries for common IDEs, OS artifacts, and build outputs.
    • Added project build/codegen configuration.

@petrubraha
Copy link
Member Author

Install smithy cli https://smithy.io/2.0/guides/smithy-cli/cli_installation.html.

Would recommend use more options from here https://smithy.io/2.0/guides/smithy-build-json.html#projections.

The generation can be triggered with the following commands:

smithy build --projection openapi-spec
smithy build --projection typescript-client

@InAndOut-Stack InAndOut-Stack deleted a comment from coderabbitai bot Mar 6, 2026
@petrubraha petrubraha self-assigned this Mar 6, 2026
@petrubraha petrubraha added documentation Improvements or additions to documentation good first issue Good for newcomers labels Mar 6, 2026
@petrubraha petrubraha marked this pull request as ready for review March 6, 2026 08:17
@InAndOut-Stack InAndOut-Stack deleted a comment from coderabbitai bot Mar 6, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 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: 7bdae35f-8c55-44d8-8aee-1e2ac1627359

📥 Commits

Reviewing files that changed from the base of the PR and between 17a2dd0 and 89aab20.

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

📝 Walkthrough

Walkthrough

Adds a Smithy-based API project "InAndOut": build configuration and .gitignore, core UUID types, error shapes, a REST/JSON service declaration, and a Travelling Salesman Problem (TSP) operation with its input/output and domain types.

Changes

Cohort / File(s) Summary
Project Configuration
/.gitignore, README.md, smithy-build.json
Adds .gitignore, updates README description and references, and introduces Smithy build configuration with output directory, source path, Maven dependencies, and three projections (openapi-spec, java-client, typescript-client).
Common Types
smithy/model/common.smithy
Adds UUID string type with regex and fixed length traits, and UUIDList list type.
Errors
smithy/model/errors.smithy
Introduces five error structures with @error and @httpError annotations: InvalidInputError (400), ResourceNotFoundError (404), ResourceAlreadyExistsError (409), DeleteRestrictedError (409), InternalServerError (500).
Service Definition
smithy/model/main.smithy
Adds InAndOut service (version 2026-04-01) and declares FindTspSolution operation using restJson1.
TSP APIs & Types
smithy/model/tsp/tsp-apis.smithy, smithy/model/tsp/tsp-io.smithy, smithy/model/tsp/tsp-types.smithy
Defines FindTspSolution POST /tsp operation with input/output shapes and documented Solution / SolutionList types; wires errors and imports UUIDList where needed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through models, lines full of cheer,
UUIDs, errors, a TSP path clear.
Build files and docs, a project anew,
Clients in sight — codegen will do! 🥕✨

🚥 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 'Minimal modelling to simply get started' accurately reflects the PR's primary objective of establishing a basic, simplified API model structure to enable initial development.
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 mvp

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

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: 10

🧹 Nitpick comments (2)
README.md (1)

3-11: Add a minimal “how to generate” section for first-run onboarding.

Given the PR goal (“simply get started”), Line 3 onward should include runnable generation commands in addition to links.

Suggested README patch
 Complete API model for our system.
+
+## Quick start
+
+```bash
+smithy build --projection openapi-spec
+smithy build --projection typescript-client
+```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 3 - 11, Add a minimal "How to generate" section to
the README starting after the existing header (line 3 onward) that provides
runnable first-run commands; include the smithy commands suggested (e.g., smithy
build --projection openapi-spec and smithy build --projection
typescript-client), a short note about required prerequisites (Smithy installed
and project root), and a one-liner example showing where outputs land so new
contributors can run generation immediately without following external links.
smithy-build.json (1)

31-37: Add explicit service property to typescript-codegen plugin.

The typescript-codegen plugin should explicitly set the service property for consistency with other projections (openapi and java-client) and to ensure deterministic generation. While Smithy's TypeScript codegen auto-infers the service when exactly one exists, explicitly setting it provides safer future proofing if additional services are added to the model.

Suggested patch
     "typescript-client": {
       "plugins": {
         "typescript-codegen": {
+          "service": "com.shopping.inandout#InAndOut",
           "package": "@inandout/client",
           "packageVersion": "0.0.1"
         }
       }
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smithy-build.json` around lines 31 - 37, Add an explicit "service" property
to the "typescript-codegen" plugin configuration in the smithy-build.json so the
plugin no longer relies on auto-inference; update the "typescript-codegen" block
(the object under "typescript-client" -> "plugins" -> "typescript-codegen") to
include "service": "YourServiceName" (replace with the actual Smithy service ID
from the model) alongside "package" and "packageVersion" to ensure deterministic
generation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@build.gradle.kts`:
- Around line 32-35: The repositories block is declared after dependencies which
can break dependency resolution; move the repositories { mavenLocal();
mavenCentral() } block so it appears before any dependencies { ... }
declarations (including the other occurrence noted) so Gradle knows where to
fetch artifacts when evaluating the dependencies blocks; ensure every
repositories block in the file is placed above its corresponding dependencies
block.
- Around line 8-11: The build currently pins smithy codegen and client-core to
version "0.0.3" using smithyBuild(...) and implementation(...); verify that
"software.amazon.smithy.java:client-codegen:0.0.3" and
"software.amazon.smithy.java:client-core:0.0.3" are acceptable for your
stability requirements and, if a more stable or newer release is required,
update those version strings (in the smithyBuild(...) and implementation(...)
declarations) to the vetted release version or to a project version property so
you can manage upgrades centrally.

In `@gradle.properties`:
- Around line 1-2: Remove the unused gradle property by deleting the orphaned
smithyVersion entry from gradle.properties and then align Smithy artifact
versions by updating smithy-build.json to reference the same Smithy core version
used elsewhere (e.g., change smithy-build.json smithy artifact versions to
1.68.0) or, alternatively, add a comment in smithy-build.json documenting the
intentional version difference; ensure build.gradle.kts is not relying on
smithyVersion before removal and update any references if present.

In `@gradle/wrapper/gradle-wrapper.properties`:
- Around line 3-6: Add a distributionSha256Sum entry next to the existing
distributionUrl property to enable download integrity verification: compute or
obtain the SHA-256 checksum for the gradle-8.2.1-bin.zip (matching
distributionUrl) from the official Gradle distribution metadata or by hashing
the ZIP, then add a distributionSha256Sum=<sha256> property alongside
distributionUrl, keeping networkTimeout, zipStoreBase and zipStorePath
unchanged; ensure the checksum string exactly matches the ZIP file for
gradle-8.2.1.

In `@settings.gradle.kts`:
- Around line 7-11: The unconditional mavenLocal() call in the
pluginManagement.repositories (repositories block) causes machine-specific
plugin resolution; remove mavenLocal() or make it opt-in by checking an
environment variable (e.g., USE_MAVEN_LOCAL) before adding mavenLocal() so CI
and other developers use consistent Maven Central/Gradle Plugin Portal
resolution. Update the repositories block to either drop the mavenLocal() entry
entirely or wrap its inclusion behind an env-var check so only developers
explicitly opting in will use the local Maven cache.

In `@smithy-build.json`:
- Around line 23-29: The smithy projection config defines a "java-client" plugin
"java-client-codegen" but the maven.dependencies array is missing the
corresponding Smithy Java client-codegen artifact; add the dependency
"software.amazon.smithy.java:client-codegen:0.0.3" to the maven.dependencies so
the "java-client-codegen" plugin will have its required Maven artifact (ensure
the group:artifact:version matches exactly and aligns with the entry referenced
in build.gradle.kts).

In `@smithy/model/common.smithy`:
- Around line 5-7: The UUID string constraint is wrong: the `@length`(min: 32,
max: 32) conflicts with the hyphenated `@pattern` and should be corrected; update
the definition of UUID (the string UUID type with the `@pattern`) to either remove
the `@length` constraint entirely or change it to `@length`(min: 36, max: 36) so it
matches hyphenated UUIDs (e.g., 550e8400-e29b-41d4-a716-446655440000).

In `@smithy/model/main.smithy`:
- Around line 9-14: The service-level `@paginated` trait on the InAndOut service
references pagination fields (nextToken, pageSize, tokens) that do not exist on
the operation shapes; update either the trait or the I/O shapes: remove the
`@paginated` trait if FindTspSolution is not paginated, or add the required fields
to the FindTspSolutionInput and FindTspSolutionOutput structures (in
tsp-io.smithy) — add nextToken and pageSize to FindTspSolutionInput and add
tokens (rename soltuionList to tokens or map its contents) and nextToken to
FindTspSolutionOutput so the names match the `@paginated` parameters.

In `@smithy/model/tsp/tsp-io.smithy`:
- Around line 12-15: Update the misspelled field and type in the
FindTspSolutionOutput structure: rename the field soltuionList to solutionList
and its type SoltuionList to SolutionList in tsp-io.smithy; then update
tsp-types.smithy to rename the Soltuion shape to Solution and SoltuionList to
SolutionList so generated classes/fields (Solution, SolutionList, solutionList)
use the correct spelling and stay consistent across the API.

In `@smithy/model/tsp/tsp-types.smithy`:
- Around line 8-16: Rename the misspelled Smithy types: change the structure
name Soltuion to Solution and the list type SoltuionList to SolutionList,
keeping the field nodeIdList and its UUIDList type unchanged; update any
references/usages of Soltuion and SoltuionList in the model or codegen inputs to
the corrected names so generated code and imports reflect Solution and
SolutionList.

---

Nitpick comments:
In `@README.md`:
- Around line 3-11: Add a minimal "How to generate" section to the README
starting after the existing header (line 3 onward) that provides runnable
first-run commands; include the smithy commands suggested (e.g., smithy build
--projection openapi-spec and smithy build --projection typescript-client), a
short note about required prerequisites (Smithy installed and project root), and
a one-liner example showing where outputs land so new contributors can run
generation immediately without following external links.

In `@smithy-build.json`:
- Around line 31-37: Add an explicit "service" property to the
"typescript-codegen" plugin configuration in the smithy-build.json so the plugin
no longer relies on auto-inference; update the "typescript-codegen" block (the
object under "typescript-client" -> "plugins" -> "typescript-codegen") to
include "service": "YourServiceName" (replace with the actual Smithy service ID
from the model) alongside "package" and "packageVersion" to ensure deterministic
generation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7f09ca8a-8994-45f6-85ec-6865da1ce85d

📥 Commits

Reviewing files that changed from the base of the PR and between e5bd6b4 and a49a358.

⛔ Files ignored due to path filters (1)
  • gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
📒 Files selected for processing (16)
  • .gitattributes
  • .gitignore
  • README.md
  • build.gradle.kts
  • gradle.properties
  • gradle/wrapper/gradle-wrapper.properties
  • gradlew
  • gradlew.bat
  • settings.gradle.kts
  • smithy-build.json
  • smithy/model/common.smithy
  • smithy/model/errors.smithy
  • smithy/model/main.smithy
  • smithy/model/tsp/tsp-apis.smithy
  • smithy/model/tsp/tsp-io.smithy
  • smithy/model/tsp/tsp-types.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

♻️ Duplicate comments (1)
gradle/wrapper/gradle-wrapper.properties (1)

3-4: ⚠️ Potential issue | 🟠 Major

Add Gradle wrapper checksum verification.

Line 3 sets the distribution URL, but distributionSha256Sum is still missing. This leaves wrapper downloads unverified.

🔧 Suggested patch
 distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
+distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
 networkTimeout=10000

Use this to verify expected checksum vs file configuration:

#!/bin/bash
set -euo pipefail

PROP_FILE="gradle/wrapper/gradle-wrapper.properties"

echo "== distributionUrl =="
rg -n '^distributionUrl=' "$PROP_FILE"

echo "== Official checksum for gradle-8.2.1-bin.zip =="
EXPECTED_SHA="$(curl -fsSL https://services.gradle.org/distributions/gradle-8.2.1-bin.zip.sha256 | tr -d '\r\n')"
echo "$EXPECTED_SHA"

echo "== Configured distributionSha256Sum (if any) =="
rg -n '^distributionSha256Sum=' "$PROP_FILE" || true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gradle/wrapper/gradle-wrapper.properties` around lines 3 - 4, Add checksum
verification by adding the distributionSha256Sum property to
gradle-wrapper.properties to match the Gradle distribution set in
distributionUrl; fetch the official SHA-256 for gradle-8.2.1-bin.zip and add a
line distributionSha256Sum=<EXPECTED_SHA> alongside the existing distributionUrl
and networkTimeout entries so the Gradle wrapper validates the downloaded
archive.
🧹 Nitpick comments (1)
README.md (1)

5-11: Consider adding usage instructions to the README.

The PR comments mention useful commands like smithy build --projection openapi-spec and smithy build --projection typescript-client. Including these in the README would improve developer onboarding.

Also, the Google Doc link (line 7) may not be accessible to all contributors—consider summarizing key points or noting access requirements.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 5 - 11, Add a short "Usage / Developer onboarding"
section to README that lists the key smithy commands (e.g., `smithy build
--projection openapi-spec` and `smithy build --projection typescript-client`)
with one-line descriptions of what each does, and include example invocation
notes; also replace or augment the Google Doc link with a brief summary of its
critical points or an "Access required" note so contributors know the doc may be
private and what to request if they need access.
🤖 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/common.smithy`:
- Around line 5-6: The `@pattern` annotation for the UUID type currently restricts
hex letters to lowercase
("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"); update this
pattern to accept both cases (e.g., use [0-9a-fA-F] for each hex group or a
case-insensitive flag) so uppercase UUIDs are allowed, and keep the `@length`(min:
36, max: 36) unchanged; modify the pattern in common.smithy where the `@pattern`
is declared.

---

Duplicate comments:
In `@gradle/wrapper/gradle-wrapper.properties`:
- Around line 3-4: Add checksum verification by adding the distributionSha256Sum
property to gradle-wrapper.properties to match the Gradle distribution set in
distributionUrl; fetch the official SHA-256 for gradle-8.2.1-bin.zip and add a
line distributionSha256Sum=<EXPECTED_SHA> alongside the existing distributionUrl
and networkTimeout entries so the Gradle wrapper validates the downloaded
archive.

---

Nitpick comments:
In `@README.md`:
- Around line 5-11: Add a short "Usage / Developer onboarding" section to README
that lists the key smithy commands (e.g., `smithy build --projection
openapi-spec` and `smithy build --projection typescript-client`) with one-line
descriptions of what each does, and include example invocation notes; also
replace or augment the Google Doc link with a brief summary of its critical
points or an "Access required" note so contributors know the doc may be private
and what to request if they need access.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4f9f702-9b1f-44bd-ba8c-7c176914f02a

📥 Commits

Reviewing files that changed from the base of the PR and between e5bd6b4 and 4b0929f.

⛔ Files ignored due to path filters (1)
  • gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
📒 Files selected for processing (16)
  • .gitattributes
  • .gitignore
  • README.md
  • build.gradle.kts
  • gradle.properties
  • gradle/wrapper/gradle-wrapper.properties
  • gradlew
  • gradlew.bat
  • settings.gradle.kts
  • smithy-build.json
  • smithy/model/common.smithy
  • smithy/model/errors.smithy
  • smithy/model/main.smithy
  • smithy/model/tsp/tsp-apis.smithy
  • smithy/model/tsp/tsp-io.smithy
  • smithy/model/tsp/tsp-types.smithy

@InAndOut-Stack InAndOut-Stack deleted a comment from coderabbitai bot Mar 6, 2026
Copy link

@narenkarthik370h narenkarthik370h left a comment

Choose a reason for hiding this comment

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

everything's decent for me kudos to you...let's build more and see whether things are working or not...approved from my side

@petrubraha petrubraha merged commit f1a4501 into main Mar 7, 2026
1 check passed
@petrubraha petrubraha deleted the mvp branch March 7, 2026 11:42
This was referenced Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants