-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat:Add beta GET /search, new search schemas, is_official in model #128
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
WalkthroughAdds a new public GET /search endpoint (beta) with query and limit parameters, corresponding 200/400/500 responses, and new schemas for search results (collections, models with metadata, pages). Updates schemas_model_response to include an is_official boolean flag. All changes are in src/libs/Replicate/openapi.yaml. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as Client
participant A as API (OpenAPI-defined)
participant S as Search Service
U->>A: GET /search?query=...&limit=...
alt Valid request
A->>S: search(query, limit)
S-->>A: results {collections, models{metadata, model}, pages, query}
A-->>U: 200 OK (schemas_search_response)
else Missing/invalid query
A-->>U: 400 Bad Request
else Internal error
A->>S: search(...)
S-->>A: error
A-->>U: 500 Internal Server Error
end
note over A,S: models include is_official in schemas_model_response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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: 0
🧹 Nitpick comments (9)
src/libs/Replicate/openapi.yaml (9)
910-915: Align operationId naming and mark beta via vendor extension.
- Use the repo’s dotted operationId convention for consistency (e.g.,
search.get).- Add an explicit vendor extension to flag beta status.
Apply:
- operationId: search + operationId: search.get + x-beta: true
916-932: Tighten parameter validation and clarify intent.
- Add
minLength(and optionallymaxLength) toquery.- Current
limittext says “model results”; that’s good—keep it explicit.- name: query in: query description: The search query string required: true schema: type: string + minLength: 1 + maxLength: 512 example: nano banana
933-976: Make nulls explicit in 200 example to avoid generator ambiguity.YAML parsers differ on bare empty scalars. Use
nullexplicitly for optional URI fields anddefault_example.- default_example: + default_example: null - github_url: + github_url: null - license_url: + license_url: null - paper_url: + paper_url: null
977-995: Use RFC 7807 content type for error responses (consistent with other endpoints).Other endpoints here already use
application/problem+json. Switch 400/500 to match.'400': description: Bad Request - Missing or invalid query parameter content: - application/json: + application/problem+json: schema: type: object properties: detail: type: string example: Query parameter "query" is required '500': description: Internal Server Error - Search service error content: - application/json: + application/problem+json: schema: type: object properties: detail: type: string example: Search service error
1255-1257: Mark is_official as readOnly.This is server-derived metadata and should not be client-settable.
is_official: type: boolean description: 'Boolean indicating whether the model is officially maintained by Replicate. Official models are always on, have stable API interfaces, and predictable pricing.' + readOnly: true
1292-1302: Constrain page hrefs to path-like values.Add
formatand a simple leading-slash pattern.href: type: string description: URL path to the page + format: uri-reference + pattern: '^/.*'
1492-1514: Validate model identifiers in collections.Ensure
owner/nameform with a lightweight regex.models: type: array items: type: string description: Model name in owner/name format + pattern: '^[^/]+/[^/]+$' description: Array of model names in the collection nullable: true
1515-1530: Optional: add example and bounds for tags/score.Small polish to guide SDKs and docs.
score: type: number description: Search relevance score nullable: true + example: 0.87 tags: type: array items: type: string description: Array of descriptive tags for the model + example: ["image-editing", "text-to-image"]
1531-1564: Schema shape looks good; consider freezing fields.If you want a tighter contract, add
additionalProperties: falseto the wrapper object and model items. Non-blocking.schemas_search_response: required: - query - models - collections - pages type: object + additionalProperties: false properties: models: type: array items: required: - model - metadata type: object + additionalProperties: false properties: metadata: $ref: '#/components/schemas/schemas_search_model_metadata_response' model: $ref: '#/components/schemas/schemas_model_response'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (18)
src/libs/Replicate/Generated/Replicate.IReplicateApi.Search.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasModelResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPageResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPageResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchCollectionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchCollectionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchModelMetadataResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchModelMetadataResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchResponseModel.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasSearchResponseModel.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SearchResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SearchResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SearchResponse2.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SearchResponse2.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.Search.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Replicate/openapi.yaml(4 hunks)
Summary by CodeRabbit