Skip to content

Commit b284768

Browse files
fix(openapi): address CodeRabbit review nits
Use stable repo-root docs path for FAQ route and enforce exactly-two standards via marshmallow Length validation on map analysis queries. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a9af0ab commit b284768

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

application/web/openapi_schemas.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ class MapAnalysisQuerySchema(Schema):
7474
standard = fields.List(
7575
fields.Str(),
7676
required=True,
77+
validate=validate.Length(min=2, max=2),
7778
metadata={"description": "Exactly two standard names"},
7879
)
7980

8081

8182
class MapAnalysisWeakLinksQuerySchema(Schema):
82-
standard = fields.List(fields.Str(), required=True)
83+
standard = fields.List(
84+
fields.Str(),
85+
required=True,
86+
validate=validate.Length(min=2, max=2),
87+
)
8388
key = fields.Str(required=True, metadata={"description": "Gap-analysis cache key"})
8489

8590

application/web/web_main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,17 @@ def page_not_found(e) -> Any:
659659
return "Resource Not found", 404
660660

661661

662+
_REPO_ROOT = os.path.abspath(
663+
os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")
664+
)
665+
_DOCS_DIR = os.path.join(_REPO_ROOT, "docs")
666+
667+
662668
@app.route("/docs/faq.md", methods=["GET"])
663669
def faq_markdown() -> Any:
664670
"""Serve FAQ markdown for the in-app docs page."""
665671
return send_from_directory(
666-
directory=os.path.join(
667-
os.path.dirname(os.path.realpath(__file__)),
668-
"../../docs",
669-
),
672+
directory=_DOCS_DIR,
670673
path="faq.md",
671674
mimetype="text/markdown; charset=utf-8",
672675
)

0 commit comments

Comments
 (0)