refactor: align crates/jina with OpenAPI specs#3943
Merged
Conversation
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor: align crates/jina with OpenAPI specs
Summary
Refactors
crates/jinato align with the Jina Reader (r.jina.ai) and Search (s.jina.ai) OpenAPI specs:reader.rs: ExpandedReadUrlRequestwith CrawlerOptions fields from the OpenAPI spec (no_cache,target_selector,remove_selector,token_budget,respond_with,retain_images, etc.). Switched fromGET r.jina.ai/{url}withAccept: text/plaintoPOST r.jina.ai/withAccept: application/jsonand JSON body, parsing a typedReaderResponseEnvelopeand returningdata.content.search.rs(new): AddedSearchRequestandJinaClient::search()for thes.jina.aiSearch API with key parameters (q,type,num,engine,gl,hl,page,site, etc.). ReturnsVec<SearchResultItem>.types.rs(new): Typed response envelopes (ReaderResponseEnvelope,SearchResponseEnvelope), data structs (ReaderData,SearchResultItem), and enums (RespondWith,RetainImages,SearchType,SearchEngine) from OpenAPI.client.rs: Changed defaultAcceptheader fromtext/plaintoapplication/json, addedContent-Type: application/json.Cargo.toml: Enabledreqwestjsonfeature.api-research(the only consumer) compiles without changes sinceread_urlstill returnsStringandReadUrlRequeststill hasurl: Stringas required with all new fields asOption.Review & Testing Checklist for Human
read_urlnow POSTs JSON and parses aReaderResponseEnvelopeinstead of reading raw text from a GET. All tests are#[ignore]'d so this is completely untested against the real API.ReaderDataandSearchResultItemfield names match the actual API response. These structs (title,url,content,description) are based on documented behavior, not empirical testing. If the real response uses different field names or nesting, deserialization will silently default to empty strings (due to#[serde(default)]) or fail outright.RespondWithis missingcontent,vlm,readerlm-v2;RetainImagesis missingall_p,alt_p;SearchEngineis missingreader. If these are sent in a response, serde will error. Decide if they should be added.ReadUrlRequestnow exposes 13 optional parameters to the MCP LLM tool schema (viaschemars), which changes the tool interface inapi-research.Notes