-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Set OpenAPI operationId for /v1/serp/{path} to serp_v1_serp__path__get #622
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
Conversation
WalkthroughRenamed the OpenAPI operationId for both GET and POST methods on /v1/serp/{path} in src/libs/Jina/openapi.yaml to serp_v1_serp__path__get. No other schema, parameters, or responses were modified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
src/libs/Jina/Generated/Jina.Models.SerpV1SerpPathGetResponse.Json.g.csis excluded by!**/generated/**src/libs/Jina/Generated/Jina.Models.SerpV1SerpPathGetResponse.g.csis excluded by!**/generated/**src/libs/Jina/Generated/Jina.Models.SerpV1SerpPathGetResponse2.Json.g.csis excluded by!**/generated/**src/libs/Jina/Generated/Jina.Models.SerpV1SerpPathGetResponse2.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Jina/openapi.yaml(2 hunks)
| - serp | ||
| summary: Serp | ||
| operationId: serp_v1_serp__path__post | ||
| operationId: serp_v1_serp__path__get |
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.
🧩 Analysis chain
Blocker: Duplicate operationId for GET and POST on /v1/serp/{path}.
operationId must be unique per operation. Having both methods use serp_v1_serp__path__get will break OpenAPI validation and many client/server generators.
Apply this diff to fix POST while keeping GET as-is:
- operationId: serp_v1_serp__path__get
+ operationId: serp_v1_serp__path__postRun to detect any remaining duplicate operationIds and validate the spec:
Also applies to: 330-330
🏁 Script executed:
#!/bin/bash
set -euo pipefail
SPEC="src/libs/Jina/openapi.yaml"
python - <<'PY'
import sys, collections, yaml
spec_path = sys.argv[1]
with open(spec_path, 'r', encoding='utf-8') as f:
doc = yaml.safe_load(f)
dups = collections.defaultdict(list)
for path, item in (doc.get('paths') or {}).items():
for method, op in item.items():
if method.lower() not in ('get','post','put','patch','delete','options','head','trace'):
continue
op_id = (op or {}).get('operationId')
if op_id:
dups[op_id].append(f"{method.upper()} {path}")
problems = {k:v for k,v in dups.items() if len(v)>1}
if problems:
print("Duplicate operationIds found:")
for k,v in problems.items():
print(f" {k}: {', '.join(v)}")
sys.exit(1)
print("No duplicate operationIds.")
PY
"$SPEC"
pip -q install 'openapi-spec-validator>=0.7,<1.0' pyyaml >/dev/null
python - <<'PY'
from openapi_spec_validator import validate_spec
import yaml, sys
with open(sys.argv[1], 'r', encoding='utf-8') as f:
spec = yaml.safe_load(f)
validate_spec(spec)
print("OpenAPI spec is valid.")
PY
"$SPEC"Length of output: 108
🏁 Script executed:
#!/bin/bash
set -euo pipefail
SPEC="src/libs/Jina/openapi.yaml"
if [ ! -f "$SPEC" ]; then
echo "Spec not found at $SPEC"
exit 2
fi
export SPEC
# Install dependencies (best-effort, quiet)
python -m pip install --user -q pyyaml openapi-spec-validator >/dev/null 2>&1 || true
# Check for duplicate operationIds
python - <<'PY'
import os, sys, collections
try:
import yaml
except Exception as e:
print("PyYAML is required but not available:", e, file=sys.stderr)
sys.exit(2)
spec_path = os.environ.get('SPEC', 'src/libs/Jina/openapi.yaml')
with open(spec_path, 'r', encoding='utf-8') as f:
doc = yaml.safe_load(f)
dups = collections.defaultdict(list)
paths = doc.get('paths') or {}
for path, item in paths.items():
for method, op in (item or {}).items():
if method.lower() not in ('get','post','put','patch','delete','options','head','trace'):
continue
op_id = (op or {}).get('operationId')
if op_id:
dups[op_id].append(f"{method.upper()} {path}")
problems = {k:v for k,v in dups.items() if len(v)>1}
if problems:
print("Duplicate operationIds found:")
for k,v in problems.items():
print(f" {k}: {', '.join(v)}")
sys.exit(1)
print("No duplicate operationIds.")
PY
# Validate OpenAPI spec using openapi-spec-validator (best-effort)
python - <<'PY'
import sys
try:
from openapi_spec_validator import validate_spec
import yaml
except Exception as e:
print("openapi-spec-validator not available; skipping validation:", e)
sys.exit(0)
spec_path = "src/libs/Jina/openapi.yaml"
with open(spec_path, 'r', encoding='utf-8') as f:
spec = yaml.safe_load(f)
try:
validate_spec(spec)
print("OpenAPI spec is valid.")
except Exception as e:
print("OpenAPI spec validation failed:", e)
sys.exit(1)
PYLength of output: 98
Blocker: Duplicate operationId for GET and POST on /v1/serp/{path}
operationId must be unique; serp_v1_serp__path__get is used by both GET and POST in src/libs/Jina/openapi.yaml (lines 306, 330). Change POST to a distinct id:
- operationId: serp_v1_serp__path__get
+ operationId: serp_v1_serp__path__post📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| operationId: serp_v1_serp__path__get | |
| operationId: serp_v1_serp__path__post |
🤖 Prompt for AI Agents
In src/libs/Jina/openapi.yaml around lines 306 and 330, the operationId
"serp_v1_serp__path__get" is duplicated for both the GET and POST operations on
/v1/serp/{path}; change the POST operationId to a unique name (for example
"serp_v1_serp__path__post" or another consistent POST-specific identifier),
update any references that rely on that operationId (SDKs/codegen or internal
links), and then regenerate any client code or API docs to reflect the new
unique operationId.
Summary by CodeRabbit
Documentation
Chores