-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat:Add explicit JSON response schemas to Replicate HTTP API OpenAPI spec #117
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
WalkthroughThe OpenAPI specification for the Replicate HTTP API was updated to include explicit JSON response schemas for several endpoints, defining the structure of returned data. New schema components were introduced for paginated and singular responses, and these schemas are now referenced in the endpoint response definitions to clarify expected outputs. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
Client->>API: GET /collections
API-->>Client: PaginatedCollectionResponse (JSON schema)
Client->>API: GET /collections/{collection_slug}
API-->>Client: CollectionResponse (JSON schema)
Client->>API: GET /models/{owner}/{name}/examples
API-->>Client: PaginatedPredictionResponse (JSON schema)
Client->>API: GET /models/{owner}/{name}/versions
API-->>Client: PaginatedVersionResponse (JSON schema)
Client->>API: GET /models/{owner}/{name}/versions/{version_id}
API-->>Client: VersionResponse (JSON schema)
Client->>API: POST /models/{owner}/{name}/predictions
API-->>Client: PaginatedPredictionResponse (JSON schema)
Poem
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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 (3)
src/libs/Replicate/openapi.yaml (3)
990-1027: Consider adding examples for new collection schemas
schemas_collection_list_itemandschemas_collection_responsehave clear property definitions, but they lack example payloads (example:blocks). Supplying even a minimal example helps interactive tools (e.g., Swagger UI) render sample data and aids SDK authors.This is optional but low-effort documentation polish.
1201-1216: Addformat: urifor pagination URLs for consistencyElsewhere in the spec (e.g.
schemas_paginated_model_response, hardware listings, files APIs) thenext/previousfields frequently includeformat: uri. Doing the same here keeps validators & generated types aligned.next: type: string + format: uri previous: type: string + format: uriReplicate the same tweak for the prediction and version paginated schemas below.
1233-1248: Keep paginated schema names generic to avoid repetitionYou now have three nearly identical paginated schemas that differ only by the item type under
results. Consider collapsing them into a single generic template (e.g.,PaginatedResponse) and usingallOf/oneOfor component parametrisation to DRY the spec. This reduces maintenance overhead whenever you tweak pagination metadata.Also applies to: 1250-1264
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (26)
src/libs/Replicate/Generated/Replicate..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.CollectionsGet.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.CollectionsList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsExamplesList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsVersionsGet.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.IReplicateApi.ModelsVersionsList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasCollectionListItem.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasCollectionListItem.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasCollectionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasCollectionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedCollectionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedCollectionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedPredictionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedPredictionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedVersionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasPaginatedVersionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasVersionResponse.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasVersionResponse.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasVersionResponseOpenapiSchema.Json.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.Models.SchemasVersionResponseOpenapiSchema.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsGet.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.CollectionsList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsExamplesList.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsGet.g.csis excluded by!**/generated/**src/libs/Replicate/Generated/Replicate.ReplicateApi.ModelsVersionsList.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Replicate/openapi.yaml(9 hunks)
🔇 Additional comments (2)
src/libs/Replicate/openapi.yaml (2)
56-59: 👍 Explicit response schemas tighten the contractReferencing concrete component schemas for the various
200responses makes the spec dramatically more useful for client generation and validation. Nicely done.Also applies to: 75-78, 615-618, 711-714, 768-771
1528-1545: Missingrequiredarray onschemas_version_response
idandcreated_atare always present according to the API examples, yet they aren’t marked as required. Explicitly listing them prevents client code from treating these as optional.schemas_version_response: type: object + required: + - id + - created_at properties:Double-check if other fields (
cog_version,openapi_schema) should stay optional.
Summary by CodeRabbit