fix(flows): replace GET /flows/exists with POST to support URI-unsaflow names#264
fix(flows): replace GET /flows/exists with POST to support URI-unsaflow names#264Jayant-kernel wants to merge 4 commits intoopenml:mainfrom
Conversation
… flow names
The GET /flows/exists/{name}/{external_version} endpoint broke for flows
with URI-unsafe characters in their names (e.g. sklearn flows with
parentheses). Replaced with POST /flows/exists accepting name and
external_version in the request body, resolving issue openml#166.
Closes openml#166
for more information, see https://pre-commit.ci
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe flow existence check endpoint was changed from a GET with path parameters to a POST with a JSON body. A new Pydantic model 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Hey - I've left some high level feedback:
- Removing the
GET /flows/exists/{name}/{external_version}route entirely may break existing Python API consumers that construct URLs directly; consider keeping the GET route as a thin wrapper around the new POST handler for a deprecation period. - Since the request model is just a simple name/version pair, you might want to reuse or place
FlowExistsBodyin a shared schemas module so it can be consistently referenced by any future endpoints that need the same shape.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Removing the `GET /flows/exists/{name}/{external_version}` route entirely may break existing Python API consumers that construct URLs directly; consider keeping the GET route as a thin wrapper around the new POST handler for a deprecation period.
- Since the request model is just a simple name/version pair, you might want to reuse or place `FlowExistsBody` in a shared schemas module so it can be consistently referenced by any future endpoints that need the same shape.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@PGijsbers |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/routers/openml/flows.py (1)
5-18:⚠️ Potential issue | 🟡 MinorReject empty strings in the new request body.
The old path route could not match empty
nameorexternal_version, butFlowExistsBodyaccepts""for both fields via plain Pydanticstrtype. This widens the contract and turns requests with empty strings into a DB lookup that returns no match, resulting in a 404 instead of early validation.Suggested fix
-from pydantic import BaseModel +from pydantic import BaseModel, Field ... class FlowExistsBody(BaseModel): - name: str - external_version: str + name: str = Field(min_length=1) + external_version: str = Field(min_length=1)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/routers/openml/flows.py` around lines 5 - 18, FlowExistsBody currently allows empty strings for name and external_version because both are plain str; change the model to reject empty values by specifying non-empty constraints (e.g., use pydantic.constr(min_length=1) or Field(..., min_length=1)) for the name and external_version fields in the FlowExistsBody class so validation fails early instead of passing empty strings to the DB lookup in database.flows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/routers/openml/flows.py`:
- Around line 5-18: FlowExistsBody currently allows empty strings for name and
external_version because both are plain str; change the model to reject empty
values by specifying non-empty constraints (e.g., use
pydantic.constr(min_length=1) or Field(..., min_length=1)) for the name and
external_version fields in the FlowExistsBody class so validation fails early
instead of passing empty strings to the DB lookup in database.flows.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 21fd2185-be28-4cb4-ab90-ec25fd991100
📒 Files selected for processing (1)
src/routers/openml/flows.py
…cated wrapper
- Move FlowExistsBody to schemas/flows.py for reusability
- Keep GET /flows/exists/{name}/{version} as a deprecated thin wrapper
around POST /flows/exists for backward compatibility
- Update test imports accordingly
Description:
Summary
GET /flows/exists/{name}/{external_version}endpointPOST /flows/existsaccepting{"name", "external_version"}in the request bodysklearn.ensemble.AdaBoostClassifier(base_estimator=sklearn.tree.DecisionTreeClassifier)) that were previously broken with the GET approachCloses #166
Test plan
POST /flows/existswith JSON bodyflow_id