Skip to content

Commit 4b60af7

Browse files
teetanghclaude
andcommitted
fix: Address valid Gemini Code Assist feedback
Fixes 4 valid issues identified in PR #8 code review: 1. HIGH PRIORITY - Fixed constant re-assignment in couchbase.rb - Changed DB_USERNAME, DB_PASSWORD, DB_CONN_STR to local variables - Eliminates Ruby "already initialized constant" warnings - Constants at top of file remain for CI environment - Local variables used only in dev environment 2. Fixed rswag spec grammar (line 5) - Changed "Retrieve suggestion" → "Retrieve suggestions" - Matches plural array return type 3. Fixed misleading response description (line 22) - Changed "No suggestion" → "List of hotel name suggestions" - 200 status should describe success case, not edge case 4. Fixed incorrect response descriptions (lines 73 & 93) - Changed "only one Hotels found" → "List of hotels matching the filter criteria" - Fixed grammar and made description generic for filter endpoint Note: Rejected Gemini's metaprogramming suggestion for search index assignment as it adds unnecessary complexity without benefit. Regenerated swagger.yaml from updated rswag specs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 8d0b810 commit 4b60af7

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

config/initializers/couchbase.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
DEFAULT_DB_PASSWORD = 'password'
2424
DEFAULT_DB_CONN_STR = 'couchbase://localhost'
2525

26-
# Get environment variables with fallback to default values
27-
DB_USERNAME = ENV.fetch('DB_USERNAME', DEFAULT_DB_USERNAME)
28-
DB_PASSWORD = ENV.fetch('DB_PASSWORD', DEFAULT_DB_PASSWORD)
29-
DB_CONN_STR = ENV.fetch('DB_CONN_STR', DEFAULT_DB_CONN_STR)
26+
# Get environment variables with fallback to default values (using local variables)
27+
db_username = ENV.fetch('DB_USERNAME', DEFAULT_DB_USERNAME)
28+
db_password = ENV.fetch('DB_PASSWORD', DEFAULT_DB_PASSWORD)
29+
db_conn_str = ENV.fetch('DB_CONN_STR', DEFAULT_DB_CONN_STR)
3030

3131
# Connect to the Couchbase cluster
3232
options = Couchbase::Cluster::ClusterOptions.new
33-
options.authenticate(DB_USERNAME, DB_PASSWORD)
34-
COUCHBASE_CLUSTER = Couchbase::Cluster.connect(DB_CONN_STR, options)
33+
options.authenticate(db_username, db_password)
34+
COUCHBASE_CLUSTER = Couchbase::Cluster.connect(db_conn_str, options)
3535
end
3636

3737
# Open the bucket

spec/requests/api/v1/hotels_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe 'Hotels API', type: :request do
44
path '/api/v1/hotels/autocomplete' do
5-
get 'Retrieve suggestion for Hotel names' do
5+
get 'Retrieve suggestions for Hotel names' do
66
tags 'Hotels'
77
produces 'application/json'
88
parameter name: :name, in: :query, type: :string, description: 'name of the hotel'
@@ -19,7 +19,7 @@
1919
end
2020
end
2121

22-
response '200', 'No suggestion' do
22+
response '200', 'List of hotel name suggestions' do
2323
schema type: :Array,
2424
items: {
2525
type: :string
@@ -70,7 +70,7 @@
7070
expect(data.length()).to be >(0)
7171
end
7272
end
73-
response '200', 'only one Hotels found' do
73+
response '200', 'List of hotels matching the filter criteria' do
7474
schema type: :Array,
7575
items: {
7676
type: :object,
@@ -90,7 +90,7 @@
9090
expect(data.length()).to eq(1)
9191
end
9292
end
93-
response '200', 'only one Hotels found' do
93+
response '200', 'List of hotels matching the filter criteria' do
9494
schema type: :Array,
9595
items: {
9696
type: :object,

swagger/v1/swagger.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ paths:
443443
description: bad request
444444
"/api/v1/hotels/autocomplete":
445445
get:
446-
summary: Retrieve suggestion for Hotel names
446+
summary: Retrieve suggestions for Hotel names
447447
tags:
448448
- Hotels
449449
parameters:
@@ -454,7 +454,7 @@ paths:
454454
type: string
455455
responses:
456456
'200':
457-
description: No suggestion
457+
description: List of hotel name suggestions
458458
content:
459459
application/json:
460460
schema:
@@ -469,7 +469,7 @@ paths:
469469
parameters: []
470470
responses:
471471
'200':
472-
description: only one Hotels found
472+
description: List of hotels matching the filter criteria
473473
content:
474474
application/json:
475475
schema:

0 commit comments

Comments
 (0)