From 21122cdafa61b2faa8324368499443c5563536e8 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Tue, 17 Mar 2026 23:20:49 +0700 Subject: [PATCH 1/9] fix: autogenerated structures with unused lifetimes Fixed https://github.com/typesense/typesense-rust/issues/65 Only request models and models whose name ending with `Parameters` are made to use Cow. --- openapi-generator-template/model.mustache | 2 +- .../reqwest/api.mustache | 16 +- preprocessed_openapi.yml | 501 +++++++++++++++++- typesense/src/client/curation_set/items.rs | 2 +- .../docs/AnalyticsRuleUpdateParams.md | 17 + .../src/apis/curation_sets_api.rs | 2 +- .../models/analytics_rule_update_params.rs | 51 ++ .../src/models/curation_item_create_schema.rs | 12 +- .../src/models/curation_set_create_schema.rs | 4 +- .../src/models/curation_set_schema.rs | 4 +- .../src/models/nl_search_model_base.rs | 28 +- xtask/src/main.rs | 1 + xtask/src/mark_borrowed_data.rs | 235 ++++++++ xtask/src/preprocess_openapi.rs | 217 +++++--- 14 files changed, 980 insertions(+), 112 deletions(-) create mode 100644 typesense_codegen/docs/AnalyticsRuleUpdateParams.md create mode 100644 typesense_codegen/src/models/analytics_rule_update_params.rs create mode 100644 xtask/src/mark_borrowed_data.rs diff --git a/openapi-generator-template/model.mustache b/openapi-generator-template/model.mustache index ab15a350..41d178f3 100644 --- a/openapi-generator-template/model.mustache +++ b/openapi-generator-template/model.mustache @@ -223,7 +223,7 @@ pub enum {{classname}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendo {{#description}} /// {{{.}}} {{/description}} - {{{name}}}({{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{/isModel}}{{#isArray}}Vec<{{{items.dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}>{{/isArray}}{{^isArray}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isArray}}{{#isModel}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}), + {{{name}}}({{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{/isModel}}{{#isArray}}Vec<{{{items.dataType}}}{{#items.vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/items.vendorExtensions.x-rust-has-borrowed-data}}{{^items.vendorExtensions.x-rust-has-borrowed-data}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/items.vendorExtensions.x-rust-has-borrowed-data}}>{{/isArray}}{{^isArray}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isArray}}{{#isModel}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}), {{/composedSchemas.oneOf}} } diff --git a/openapi-generator-template/reqwest/api.mustache b/openapi-generator-template/reqwest/api.mustache index 038480e2..e1243b7e 100644 --- a/openapi-generator-template/reqwest/api.mustache +++ b/openapi-generator-template/reqwest/api.mustache @@ -13,15 +13,7 @@ use serde::{Deserialize, Serialize, de::Error as _}; {{#-first}} /// struct for passing parameters to the method [`{{operationId}}`] #[derive(Clone, Debug)] -pub struct {{{operationIdCamelCase}}}Params<'p{{! - Iterate through ALL parameters in the operation. - Only the requestBody has this extension defined, so it will print "". - The other parameters have nothing, so they will print nothing. - This effectively extract the generic parameter from the requestBody - and places it on the struct definition line. -}}{{#allParams}} -{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}} -{{/allParams}}> { +pub struct {{{operationIdCamelCase}}}Params{{#vendorExtensions.x-rust-has-borrowed-data}}<'p{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#allParams}}{{#-first}}{{#vendorExtensions.x-rust-params-generic-parameter}}<{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-first}}{{/allParams}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{#allParams}}{{#-last}}{{#vendorExtensions.x-rust-params-generic-parameter}}>{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}} { {{/-first}} {{#description}} /// {{{.}}} @@ -37,8 +29,8 @@ pub struct {{{operationIdCamelCase}}}Params<'p{{! }}{{^isUuid}}{{#isString}}{{#isArray}}Vec<{{/isArray}}Cow<'p, str>{{#isArray}}>{{/isArray}}{{/isString}}{{/isUuid}}{{! ### UUIDs }}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}String{{#isArray}}>{{/isArray}}{{/isUuid}}{{! - ### Models and primative types - }}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{#isModel}}<'p>{{/isModel}}{{/isUuid}}{{/isString}}{{! + ### Models and primitive types + }}{{^isString}}{{^isUuid}}{{#isArray}}Vec<{{#items}}{{^isPrimitiveType}}models::{{/isPrimitiveType}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'p>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/items}}>{{/isArray}}{{^isArray}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{^isContainer}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'p>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isContainer}}{{/isArray}}{{/isUuid}}{{/isString}}{{! ### Option End }}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{! ### Comma for next arguement @@ -108,7 +100,7 @@ pub enum {{{operationIdCamelCase}}}Error { {{#vendorExtensions.x-group-parameters}} pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}(configuration: &configuration::Configuration{{#allParams}}{{#-first}}, {{! ### Params -}}params: &{{{operationIdCamelCase}}}Params<'_{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}>{{/-first}}{{/allParams}}{{! +}}params: &{{{operationIdCamelCase}}}Params<{{#vendorExtensions.x-rust-has-borrowed-data}}'_{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}}>{{/-first}}{{/allParams}}{{! ### Function return type }}) -> Result<{{#vendorExtensions.x-rust-return-type}}{{{.}}}{{/vendorExtensions.x-rust-return-type}}{{^vendorExtensions.x-rust-return-type}}{{! }}{{#isResponseFile}}{{#supportAsync}}reqwest::Response{{/supportAsync}}{{^supportAsync}}reqwest::blocking::Response{{/supportAsync}}{{/isResponseFile}}{{! diff --git a/preprocessed_openapi.yml b/preprocessed_openapi.yml index 229d79c7..de2a26ec 100644 --- a/preprocessed_openapi.yml +++ b/preprocessed_openapi.yml @@ -98,6 +98,8 @@ paths: schema: type: string description: Comma-separated list of fields from the collection to exclude from the response + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: limit in: query schema: @@ -119,6 +121,7 @@ paths: items: $ref: '#/components/schemas/CollectionResponse' x-go-type: '[]*CollectionResponse' + x-rust-has-borrowed-data: true post: tags: - collections @@ -132,6 +135,8 @@ paths: application/json: schema: $ref: '#/components/schemas/CollectionSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '201': description: Collection successfully created @@ -151,6 +156,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /collections/{collectionName}: get: tags: @@ -165,6 +171,8 @@ paths: description: The name of the collection to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Collection fetched @@ -178,6 +186,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true patch: tags: - collections @@ -191,6 +200,8 @@ paths: description: The name of the collection to update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The document object with fields to be updated @@ -217,6 +228,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - collections @@ -230,6 +242,8 @@ paths: description: The name of the collection to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Collection deleted @@ -243,6 +257,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /collections/{collectionName}/documents: post: tags: @@ -257,6 +272,8 @@ paths: description: The name of the collection to add the document to schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: action in: query description: Additional action to perform @@ -264,6 +281,8 @@ paths: type: string example: upsert $ref: '#/components/schemas/IndexAction' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: dirty_values in: query description: Dealing with Dirty Data @@ -278,7 +297,6 @@ paths: type: object description: Can be any key-value pair x-go-type: interface{} - x-rust-has-borrowed-data: true responses: '201': description: Document successfully created/indexed @@ -293,6 +311,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true patch: tags: - documents @@ -306,11 +325,15 @@ paths: description: The name of the collection to update documents in schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The document fields to be updated @@ -320,7 +343,6 @@ paths: type: object description: Can be any key-value pair x-go-type: interface{} - x-rust-has-borrowed-data: true x-rust-params-generic-parameter: B x-rust-type: B responses: @@ -350,6 +372,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'B: Serialize' + x-rust-has-borrowed-data: true delete: tags: - documents @@ -363,11 +386,15 @@ paths: description: The name of the collection to delete documents from schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: batch_size in: query schema: @@ -400,6 +427,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /collections/{collectionName}/documents/search: get: tags: @@ -414,16 +442,22 @@ paths: description: The name of the collection to search for the document under schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: q in: query schema: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: query_by in: query schema: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: nl_query in: query schema: @@ -434,26 +468,36 @@ paths: schema: type: string description: The ID of the natural language model to use. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: query_by_weights in: query schema: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: text_match_type in: query schema: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: prefix in: query schema: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: infix in: query schema: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: max_extra_prefix in: query schema: @@ -470,6 +514,8 @@ paths: type: string description: Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: max_filter_by_candidates in: query schema: @@ -481,11 +527,15 @@ paths: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` example: num_employees:desc + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: facet_by in: query schema: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: max_facet_values in: query schema: @@ -496,12 +546,16 @@ paths: schema: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: num_typos in: query schema: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: page in: query schema: @@ -528,6 +582,8 @@ paths: schema: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: group_limit in: query schema: @@ -545,16 +601,22 @@ paths: schema: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_full_fields in: query schema: type: string description: List of fields which should be highlighted fully without snippeting + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_affix_num_tokens in: query schema: @@ -567,12 +629,16 @@ paths: type: string description: | The start tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_end_tag in: query schema: type: string description: | The end tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: enable_highlight_v1 in: query schema: @@ -599,6 +665,8 @@ paths: type: string description: List of synonym set names to associate with this search query example: synonym_set_1,synonym_set_2 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: drop_tokens_threshold in: query schema: @@ -652,6 +720,8 @@ paths: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: hidden_hits in: query schema: @@ -659,23 +729,31 @@ paths: description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: override_tags in: query schema: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_fields in: query schema: type: string description: | A list of custom fields that must be highlighted even if you don't query for them + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: split_join_tokens in: query schema: type: string description: | Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: pre_segmented_query in: query schema: @@ -689,6 +767,8 @@ paths: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: enable_overrides in: query schema: @@ -772,6 +852,8 @@ paths: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: remote_embedding_timeout_ms in: query schema: @@ -790,24 +872,32 @@ paths: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: stopwords in: query schema: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: facet_return_parent in: query schema: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: voice_query in: query schema: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: conversation in: query schema: @@ -820,12 +910,16 @@ paths: type: string description: | The Id of Conversation Model to be used. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: conversation_id in: query schema: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Search results @@ -847,6 +941,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'D: for<''de> serde::Deserialize<''de> + Serialize' x-rust-return-type: models::SearchResult + x-rust-has-borrowed-data: true /synonym_sets: get: tags: @@ -877,6 +972,8 @@ paths: description: The name of the synonym set to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Synonym set fetched @@ -890,6 +987,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - synonyms @@ -903,6 +1001,8 @@ paths: description: The name of the synonym set to create/update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The synonym set to be created/updated @@ -923,6 +1023,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - synonyms @@ -936,6 +1037,8 @@ paths: description: The name of the synonym set to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Synonym set successfully deleted @@ -949,6 +1052,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /synonym_sets/{synonymSetName}/items: get: tags: @@ -963,6 +1067,8 @@ paths: description: The name of the synonym set to retrieve items for schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: List of synonym items @@ -978,6 +1084,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /synonym_sets/{synonymSetName}/items/{itemId}: get: tags: @@ -992,12 +1099,16 @@ paths: description: The name of the synonym set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Synonym item fetched @@ -1011,6 +1122,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - synonyms @@ -1024,12 +1136,16 @@ paths: description: The name of the synonym set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to upsert schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The synonym item to be created/updated @@ -1037,6 +1153,8 @@ paths: application/json: schema: $ref: '#/components/schemas/SynonymItemUpsertSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Synonym item successfully created/updated @@ -1050,6 +1168,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - synonyms @@ -1063,12 +1182,16 @@ paths: description: The name of the synonym set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Synonym item successfully deleted @@ -1082,6 +1205,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /curation_sets: get: tags: @@ -1112,6 +1236,8 @@ paths: description: The name of the curation set to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Curation set fetched @@ -1125,6 +1251,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - curation_sets @@ -1138,6 +1265,8 @@ paths: description: The name of the curation set to create/update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The curation set to be created/updated @@ -1145,6 +1274,8 @@ paths: application/json: schema: $ref: '#/components/schemas/CurationSetCreateSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Curation set successfully created/updated @@ -1158,6 +1289,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - curation_sets @@ -1171,6 +1303,8 @@ paths: description: The name of the curation set to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Curation set successfully deleted @@ -1184,6 +1318,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /curation_sets/{curationSetName}/items: get: tags: @@ -1198,6 +1333,8 @@ paths: description: The name of the curation set to retrieve items for schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: List of curation items @@ -1213,6 +1350,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /curation_sets/{curationSetName}/items/{itemId}: get: tags: @@ -1227,12 +1365,16 @@ paths: description: The name of the curation set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Curation item fetched @@ -1246,6 +1388,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - curation_sets @@ -1259,12 +1402,16 @@ paths: description: The name of the curation set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to upsert schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The curation item to be created/updated @@ -1285,6 +1432,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - curation_sets @@ -1298,12 +1446,16 @@ paths: description: The name of the curation set schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Curation item successfully deleted @@ -1317,6 +1469,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /collections/{collectionName}/documents/export: get: tags: @@ -1331,21 +1484,29 @@ paths: description: The name of the collection schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string description: Filter conditions for refining your search results. Separate multiple conditions with &&. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: include_fields in: query schema: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Exports all the documents in a given collection. @@ -1364,6 +1525,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-supports-plain-text: true + x-rust-has-borrowed-data: true /collections/{collectionName}/documents/import: post: tags: @@ -1378,6 +1540,8 @@ paths: description: The name of the collection schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: batch_size in: query schema: @@ -1411,6 +1575,8 @@ paths: schema: type: string description: The JSONL file to import + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Result of the import operation. Each line of the response indicates the result of each document present in the request body (in the same order). If the import of a single document fails, it does not affect the other documents. If there is a failure, the response line will include a corresponding error message and as well as the actual document content. @@ -1435,6 +1601,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-body-is-raw-text: true x-supports-plain-text: true + x-rust-has-borrowed-data: true /collections/{collectionName}/documents/{documentId}: get: tags: @@ -1449,12 +1616,16 @@ paths: description: The name of the collection to search for the document under schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: The document referenced by the ID @@ -1469,6 +1640,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true patch: tags: - documents @@ -1482,12 +1654,16 @@ paths: description: The name of the collection to search for the document under schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: dirty_values in: query description: Dealing with Dirty Data @@ -1502,7 +1678,6 @@ paths: type: object description: Can be any key-value pair x-go-type: interface{} - x-rust-has-borrowed-data: true x-rust-params-generic-parameter: B x-rust-type: B responses: @@ -1520,6 +1695,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'B: Serialize' + x-rust-has-borrowed-data: true delete: tags: - documents @@ -1533,12 +1709,16 @@ paths: description: The name of the collection to search for the document under schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: The document referenced by the ID was deleted @@ -1553,6 +1733,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /conversations/models: get: tags: @@ -1582,6 +1763,8 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelCreateSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '201': description: Created Conversation Model @@ -1595,6 +1778,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /conversations/models/{modelId}: get: tags: @@ -1609,6 +1793,8 @@ paths: description: The id of the conversation model to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: A conversation model @@ -1616,6 +1802,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' + x-rust-has-borrowed-data: true put: tags: - conversations @@ -1629,12 +1816,16 @@ paths: description: The id of the conversation model to update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ConversationModelUpdateSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: The conversation model was successfully updated @@ -1642,6 +1833,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' + x-rust-has-borrowed-data: true delete: tags: - conversations @@ -1655,6 +1847,8 @@ paths: description: The id of the conversation model to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: The conversation model was successfully deleted @@ -1662,6 +1856,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' + x-rust-has-borrowed-data: true /keys: get: tags: @@ -1687,6 +1882,8 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiKeySchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '201': description: Created API key @@ -1706,6 +1903,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /keys/{keyId}: get: tags: @@ -1794,12 +1992,16 @@ paths: description: The name of the alias to create/update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: description: Collection alias to be created/updated content: application/json: schema: $ref: '#/components/schemas/CollectionAliasSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: The collection alias was created/updated @@ -1819,6 +2021,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true get: tags: - collections @@ -1832,6 +2035,8 @@ paths: description: The name of the alias to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Collection alias fetched @@ -1845,6 +2050,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - collections @@ -1857,6 +2063,8 @@ paths: description: The name of the alias to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Collection alias was deleted @@ -1870,6 +2078,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /debug: get: tags: @@ -1932,6 +2141,8 @@ paths: description: The directory on the server where the snapshot should be saved. schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '201': description: Snapshot is created. @@ -1939,6 +2150,7 @@ paths: application/json: schema: $ref: '#/components/schemas/SuccessStatus' + x-rust-has-borrowed-data: true /operations/vote: post: tags: @@ -2000,7 +2212,6 @@ paths: properties: log-slow-requests-time-ms: type: integer - x-rust-has-borrowed-data: true responses: '200': description: Toggle Slow Request Log database succeeded. @@ -2021,31 +2232,43 @@ paths: schema: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: query_by in: query schema: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: query_by_weights in: query schema: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: text_match_type in: query schema: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: prefix in: query schema: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: infix in: query schema: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: max_extra_prefix in: query schema: @@ -2062,16 +2285,22 @@ paths: type: string description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: sort_by in: query schema: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: facet_by in: query schema: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: max_facet_values in: query schema: @@ -2082,12 +2311,16 @@ paths: schema: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: num_typos in: query schema: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: page in: query schema: @@ -2114,6 +2347,8 @@ paths: schema: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: group_limit in: query schema: @@ -2131,16 +2366,22 @@ paths: schema: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_full_fields in: query schema: type: string description: List of fields which should be highlighted fully without snippeting + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_affix_num_tokens in: query schema: @@ -2153,12 +2394,16 @@ paths: type: string description: | The start tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_end_tag in: query schema: type: string description: | The end tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: snippet_threshold in: query schema: @@ -2225,6 +2470,8 @@ paths: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: hidden_hits in: query schema: @@ -2232,17 +2479,23 @@ paths: description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: override_tags in: query schema: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: highlight_fields in: query schema: type: string description: | A list of custom fields that must be highlighted even if you don't query for them + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: pre_segmented_query in: query schema: @@ -2257,6 +2510,8 @@ paths: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: enable_overrides in: query schema: @@ -2334,6 +2589,8 @@ paths: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: remote_embedding_timeout_ms in: query schema: @@ -2352,24 +2609,32 @@ paths: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: stopwords in: query schema: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: facet_return_parent in: query schema: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: voice_query in: query schema: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: conversation in: query schema: @@ -2382,17 +2647,23 @@ paths: type: string description: | The Id of Conversation Model to be used. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: conversation_id in: query schema: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: content: application/json: schema: $ref: '#/components/schemas/MultiSearchSearchesParameter' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Search results @@ -2407,6 +2678,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-return-type: serde_json::Value + x-rust-has-borrowed-data: true /analytics/events: post: tags: @@ -2421,6 +2693,8 @@ paths: application/json: schema: $ref: '#/components/schemas/AnalyticsEvent' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics event successfully created @@ -2434,6 +2708,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true get: tags: - analytics @@ -2446,12 +2721,16 @@ paths: in: query schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: name required: true in: query description: Analytics rule name schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true - name: n required: true in: query @@ -2471,6 +2750,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /analytics/flush: post: tags: @@ -2514,10 +2794,14 @@ paths: schema: oneOf: - $ref: '#/components/schemas/AnalyticsRuleCreate' + x-rust-has-borrowed-data: true - type: array items: $ref: '#/components/schemas/AnalyticsRuleCreate' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics rule(s) successfully created @@ -2540,6 +2824,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true get: tags: - analytics @@ -2553,6 +2838,8 @@ paths: description: Filter rules by rule_tag schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics rules fetched @@ -2562,6 +2849,7 @@ paths: type: array items: $ref: '#/components/schemas/AnalyticsRule' + x-rust-has-borrowed-data: true /analytics/rules/{ruleName}: put: tags: @@ -2576,6 +2864,8 @@ paths: description: The name of the analytics rule to upsert schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The Analytics rule to be upserted @@ -2583,6 +2873,8 @@ paths: application/json: schema: $ref: '#/components/schemas/AnalyticsRuleUpdate' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics rule successfully upserted @@ -2596,6 +2888,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true get: tags: - analytics @@ -2609,6 +2902,8 @@ paths: description: The name of the analytics rule to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics rule fetched @@ -2622,6 +2917,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - analytics @@ -2635,6 +2931,8 @@ paths: description: The name of the analytics rule to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Analytics rule deleted @@ -2648,6 +2946,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /metrics.json: get: tags: @@ -2704,7 +3003,9 @@ paths: description: The ID of the stopwords set to upsert. schema: type: string + x-rust-has-borrowed-data: true example: countries + x-rust-has-borrowed-data: true requestBody: required: true description: The stopwords set to upsert. @@ -2712,6 +3013,8 @@ paths: application/json: schema: $ref: '#/components/schemas/StopwordsSetUpsertSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Stopwords set successfully upserted. @@ -2725,6 +3028,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true get: tags: - stopwords @@ -2738,7 +3042,9 @@ paths: description: The ID of the stopwords set to retrieve. schema: type: string + x-rust-has-borrowed-data: true example: countries + x-rust-has-borrowed-data: true responses: '200': description: Stopwords set fetched. @@ -2752,6 +3058,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - stopwords @@ -2765,7 +3072,9 @@ paths: description: The ID of the stopwords set to delete. schema: type: string + x-rust-has-borrowed-data: true example: countries + x-rust-has-borrowed-data: true responses: '200': description: Stopwords set rule deleted. @@ -2786,6 +3095,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /presets: get: tags: @@ -2814,7 +3124,9 @@ paths: description: The ID of the preset to retrieve. schema: type: string + x-rust-has-borrowed-data: true example: listing_view + x-rust-has-borrowed-data: true responses: '200': description: Preset fetched. @@ -2828,6 +3140,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - presets @@ -2841,7 +3154,9 @@ paths: description: The name of the preset set to upsert. schema: type: string + x-rust-has-borrowed-data: true example: listing_view + x-rust-has-borrowed-data: true requestBody: required: true description: The stopwords set to upsert. @@ -2849,6 +3164,8 @@ paths: application/json: schema: $ref: '#/components/schemas/PresetUpsertSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Preset successfully upserted. @@ -2862,6 +3179,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - presets @@ -2875,7 +3193,9 @@ paths: description: The ID of the preset to delete. schema: type: string + x-rust-has-borrowed-data: true example: listing_view + x-rust-has-borrowed-data: true responses: '200': description: Preset deleted. @@ -2889,6 +3209,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /stemming/dictionaries: get: tags: @@ -2925,7 +3246,9 @@ paths: description: The ID of the dictionary to retrieve schema: type: string + x-rust-has-borrowed-data: true example: irregular-plurals + x-rust-has-borrowed-data: true responses: '200': description: Stemming dictionary details @@ -2939,6 +3262,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /stemming/dictionaries/import: post: tags: @@ -2953,7 +3277,9 @@ paths: description: The ID to assign to the dictionary schema: type: string + x-rust-has-borrowed-data: true example: irregular-plurals + x-rust-has-borrowed-data: true requestBody: required: true description: The JSONL file containing word mappings @@ -2964,6 +3290,8 @@ paths: example: | {"word": "people", "root": "person"} {"word": "children", "root": "child"} + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: Dictionary successfully imported @@ -2981,6 +3309,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-body-is-raw-text: true x-supports-plain-text: true + x-rust-has-borrowed-data: true /nl_search_models: get: tags: @@ -3010,6 +3339,8 @@ paths: application/json: schema: $ref: '#/components/schemas/NLSearchModelCreateSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '201': description: NL search model successfully created @@ -3023,6 +3354,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true /nl_search_models/{modelId}: get: tags: @@ -3037,6 +3369,8 @@ paths: description: The ID of the NL search model to retrieve schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: NL search model fetched @@ -3050,6 +3384,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true put: tags: - nl_search_models @@ -3063,6 +3398,8 @@ paths: description: The ID of the NL search model to update schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true requestBody: required: true description: The NL search model fields to update @@ -3070,6 +3407,8 @@ paths: application/json: schema: $ref: '#/components/schemas/NLSearchModelUpdateSchema' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: NL search model successfully updated @@ -3089,6 +3428,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true delete: tags: - nl_search_models @@ -3102,6 +3442,8 @@ paths: description: The ID of the NL search model to delete schema: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true responses: '200': description: NL search model successfully deleted @@ -3115,6 +3457,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' + x-rust-has-borrowed-data: true components: schemas: CollectionSchema: @@ -3127,6 +3470,7 @@ components: type: string description: Name of the collection example: companies + x-rust-has-borrowed-data: true fields: type: array description: A list of fields for querying, filtering and faceting @@ -3147,6 +3491,7 @@ components: default: '' description: The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. example: num_employees + x-rust-has-borrowed-data: true token_separators: type: array default: [] @@ -3156,12 +3501,16 @@ components: type: string minLength: 1 maxLength: 1 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true synonym_sets: type: array description: List of synonym set names to associate with this collection items: type: string example: synonym_set_1 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true enable_nested_fields: type: boolean default: false @@ -3176,13 +3525,14 @@ components: type: string minLength: 1 maxLength: 1 + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true voice_query_model: $ref: '#/components/schemas/VoiceQueryModelCollectionConfig' metadata: type: object description: | Optional details about the collection, e.g., when it was created, who created it etc. - x-rust-has-borrowed-data: true x-rust-builder: true x-rust-has-borrowed-data: true CollectionUpdateSchema: @@ -3215,8 +3565,6 @@ components: type: object description: | Optional details about the collection, e.g., when it was created, who created it etc. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true CollectionResponse: allOf: - $ref: '#/components/schemas/CollectionSchema' @@ -3367,6 +3715,7 @@ components: collection_name: type: string description: Name of the collection you wish to map the alias to + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true CollectionAlias: type: object @@ -3698,16 +4047,22 @@ components: properties: value: type: string + x-rust-has-borrowed-data: true description: type: string + x-rust-has-borrowed-data: true actions: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true collections: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true expires_at: type: integer format: int64 @@ -3775,27 +4130,34 @@ components: q: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. + x-rust-has-borrowed-data: true query_by: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true nl_query: type: boolean description: Whether to use natural language processing to parse the query. nl_model_id: type: string description: The ID of the natural language model to use. + x-rust-has-borrowed-data: true query_by_weights: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true text_match_type: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. + x-rust-has-borrowed-data: true prefix: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. + x-rust-has-borrowed-data: true infix: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results + x-rust-has-borrowed-data: true max_extra_prefix: type: integer description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. @@ -3806,6 +4168,7 @@ components: type: string description: Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true max_filter_by_candidates: type: integer description: Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*. @@ -3813,19 +4176,23 @@ components: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` example: num_employees:desc + x-rust-has-borrowed-data: true facet_by: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. + x-rust-has-borrowed-data: true max_facet_values: type: integer description: Maximum number of facet values to be returned. facet_query: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". + x-rust-has-borrowed-data: true num_typos: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 + x-rust-has-borrowed-data: true page: type: integer description: Results from this specific page number would be fetched. @@ -3842,6 +4209,7 @@ components: group_by: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. + x-rust-has-borrowed-data: true group_limit: type: integer description: | @@ -3853,12 +4221,15 @@ components: include_fields: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true highlight_full_fields: type: string description: List of fields which should be highlighted fully without snippeting + x-rust-has-borrowed-data: true highlight_affix_num_tokens: type: integer description: | @@ -3867,10 +4238,12 @@ components: type: string description: | The start tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true highlight_end_tag: type: string description: | The end tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true enable_highlight_v1: type: boolean default: true @@ -3889,6 +4262,7 @@ components: type: string description: List of synonym set names to associate with this search query example: synonym_set_1,synonym_set_2 + x-rust-has-borrowed-data: true drop_tokens_threshold: type: integer description: | @@ -3924,22 +4298,27 @@ components: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true hidden_hits: type: string description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true override_tags: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. + x-rust-has-borrowed-data: true highlight_fields: type: string description: | A list of custom fields that must be highlighted even if you don't query for them + x-rust-has-borrowed-data: true split_join_tokens: type: string description: | Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. + x-rust-has-borrowed-data: true pre_segmented_query: type: boolean description: | @@ -3949,6 +4328,7 @@ components: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. + x-rust-has-borrowed-data: true enable_overrides: type: boolean default: false @@ -4006,6 +4386,7 @@ components: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. + x-rust-has-borrowed-data: true remote_embedding_timeout_ms: type: integer description: | @@ -4018,18 +4399,22 @@ components: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). + x-rust-has-borrowed-data: true stopwords: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. + x-rust-has-borrowed-data: true facet_return_parent: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. + x-rust-has-borrowed-data: true voice_query: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. + x-rust-has-borrowed-data: true conversation: type: boolean description: | @@ -4038,10 +4423,12 @@ components: type: string description: | The Id of Conversation Model to be used. + x-rust-has-borrowed-data: true conversation_id: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. + x-rust-has-borrowed-data: true x-rust-builder: true x-rust-has-borrowed-data: true MultiSearchParameters: @@ -4052,21 +4439,27 @@ components: q: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. + x-rust-has-borrowed-data: true query_by: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true query_by_weights: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. + x-rust-has-borrowed-data: true text_match_type: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. + x-rust-has-borrowed-data: true prefix: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. + x-rust-has-borrowed-data: true infix: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results + x-rust-has-borrowed-data: true max_extra_prefix: type: integer description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. @@ -4077,22 +4470,27 @@ components: type: string description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true sort_by: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` + x-rust-has-borrowed-data: true facet_by: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. + x-rust-has-borrowed-data: true max_facet_values: type: integer description: Maximum number of facet values to be returned. facet_query: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". + x-rust-has-borrowed-data: true num_typos: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 + x-rust-has-borrowed-data: true page: type: integer description: Results from this specific page number would be fetched. @@ -4109,6 +4507,7 @@ components: group_by: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. + x-rust-has-borrowed-data: true group_limit: type: integer description: | @@ -4120,12 +4519,15 @@ components: include_fields: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true highlight_full_fields: type: string description: List of fields which should be highlighted fully without snippeting + x-rust-has-borrowed-data: true highlight_affix_num_tokens: type: integer description: | @@ -4134,10 +4536,12 @@ components: type: string description: | The start tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true highlight_end_tag: type: string description: | The end tag used for the highlighted snippets. Default: `` + x-rust-has-borrowed-data: true snippet_threshold: type: integer description: | @@ -4182,18 +4586,22 @@ components: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true hidden_hits: type: string description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. + x-rust-has-borrowed-data: true override_tags: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. + x-rust-has-borrowed-data: true highlight_fields: type: string description: | A list of custom fields that must be highlighted even if you don't query for them + x-rust-has-borrowed-data: true pre_segmented_query: type: boolean default: false @@ -4204,6 +4612,7 @@ components: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. + x-rust-has-borrowed-data: true enable_overrides: type: boolean default: false @@ -4257,6 +4666,7 @@ components: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. + x-rust-has-borrowed-data: true remote_embedding_timeout_ms: type: integer description: | @@ -4269,18 +4679,22 @@ components: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). + x-rust-has-borrowed-data: true stopwords: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. + x-rust-has-borrowed-data: true facet_return_parent: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. + x-rust-has-borrowed-data: true voice_query: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. + x-rust-has-borrowed-data: true conversation: type: boolean description: | @@ -4289,10 +4703,12 @@ components: type: string description: | The Id of Conversation Model to be used. + x-rust-has-borrowed-data: true conversation_id: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. + x-rust-has-borrowed-data: true x-rust-builder: true x-rust-has-borrowed-data: true MultiSearchSearchesParameter: @@ -4308,6 +4724,8 @@ components: type: array items: $ref: '#/components/schemas/MultiSearchCollectionParameters' + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true MultiSearchCollectionParameters: allOf: @@ -4380,25 +4798,33 @@ components: name: type: string description: Name of the analytics rule this event corresponds to + x-rust-has-borrowed-data: true event_type: type: string description: Type of event (e.g., click, conversion, query, visit) + x-rust-has-borrowed-data: true data: type: object description: Event payload properties: user_id: type: string + x-rust-has-borrowed-data: true doc_id: type: string + x-rust-has-borrowed-data: true doc_ids: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true q: type: string + x-rust-has-borrowed-data: true analytics_tag: type: string + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true AnalyticsEventsResponse: @@ -4440,19 +4866,24 @@ components: properties: name: type: string + x-rust-has-borrowed-data: true type: $ref: '#/components/schemas/AnalyticsRuleType' collection: type: string + x-rust-has-borrowed-data: true event_type: type: string + x-rust-has-borrowed-data: true rule_tag: type: string + x-rust-has-borrowed-data: true params: type: object properties: destination_collection: type: string + x-rust-has-borrowed-data: true limit: type: integer capture_search_requests: @@ -4461,10 +4892,13 @@ components: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true expand_query: type: boolean counter_field: type: string + x-rust-has-borrowed-data: true weight: type: integer x-rust-has-borrowed-data: true @@ -4482,13 +4916,16 @@ components: properties: name: type: string + x-rust-has-borrowed-data: true rule_tag: type: string + x-rust-has-borrowed-data: true params: type: object properties: destination_collection: type: string + x-rust-has-borrowed-data: true limit: type: integer capture_search_requests: @@ -4497,10 +4934,13 @@ components: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true expand_query: type: boolean counter_field: type: string + x-rust-has-borrowed-data: true weight: type: integer x-rust-has-borrowed-data: true @@ -4579,8 +5019,11 @@ components: type: array items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true locale: type: string + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true StopwordsSetSchema: type: object @@ -4625,7 +5068,9 @@ components: value: oneOf: - $ref: '#/components/schemas/SearchParameters' + x-rust-has-borrowed-data: true - $ref: '#/components/schemas/MultiSearchSearchesParameter' + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true PresetSchema: @@ -4661,7 +5106,6 @@ components: - coerce_or_drop - drop - reject - x-rust-has-borrowed-data: true IndexAction: type: string enum: @@ -4669,7 +5113,6 @@ components: - update - upsert - emplace - x-rust-has-borrowed-data: true DropTokensMode: type: string description: | @@ -4678,7 +5121,6 @@ components: - right_to_left - left_to_right - both_sides:3 - x-rust-has-borrowed-data: true ConversationModelCreateSchema: required: - model_name @@ -4708,21 +5150,27 @@ components: id: type: string description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. + x-rust-has-borrowed-data: true model_name: type: string description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM + x-rust-has-borrowed-data: true api_key: type: string description: The LLM service's API Key + x-rust-has-borrowed-data: true history_collection: type: string description: Typesense collection that stores the historical conversations + x-rust-has-borrowed-data: true account_id: type: string description: LLM service's account ID (only applicable for Cloudflare) + x-rust-has-borrowed-data: true system_prompt: type: string description: The system prompt that contains special instructions to the LLM + x-rust-has-borrowed-data: true ttl: type: integer description: | @@ -4734,6 +5182,7 @@ components: vllm_url: type: string description: URL of vLLM service + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true ConversationModelSchema: allOf: @@ -4778,12 +5227,15 @@ components: model_name: type: string description: Name of the NL model to use + x-rust-has-borrowed-data: true api_key: type: string description: API key for the NL model service + x-rust-has-borrowed-data: true api_url: type: string description: Custom API URL for the NL model service + x-rust-has-borrowed-data: true max_bytes: type: integer description: Maximum number of bytes to process @@ -4793,6 +5245,7 @@ components: system_prompt: type: string description: System prompt for the NL model + x-rust-has-borrowed-data: true top_p: type: number description: Top-p parameter for the NL model (Google-specific) @@ -4804,33 +5257,44 @@ components: description: Stop sequences for the NL model (Google-specific) items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true api_version: type: string description: API version for the NL model service + x-rust-has-borrowed-data: true project_id: type: string description: Project ID for GCP Vertex AI + x-rust-has-borrowed-data: true access_token: type: string description: Access token for GCP Vertex AI + x-rust-has-borrowed-data: true refresh_token: type: string description: Refresh token for GCP Vertex AI + x-rust-has-borrowed-data: true client_id: type: string description: Client ID for GCP Vertex AI + x-rust-has-borrowed-data: true client_secret: type: string description: Client secret for GCP Vertex AI + x-rust-has-borrowed-data: true region: type: string description: Region for GCP Vertex AI + x-rust-has-borrowed-data: true max_output_tokens: type: integer description: Maximum output tokens for GCP Vertex AI account_id: type: string description: Account ID for Cloudflare-specific models + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true NLSearchModelCreateSchema: allOf: - $ref: '#/components/schemas/NLSearchModelBase' @@ -4871,17 +5335,23 @@ components: description: Array of words that should be considered as synonyms items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true root: type: string description: For 1-way synonyms, indicates the root word that words in the synonyms parameter map to + x-rust-has-borrowed-data: true locale: type: string description: Locale for the synonym, leave blank to use the standard tokenizer + x-rust-has-borrowed-data: true symbols_to_index: type: array description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is items: type: string + x-rust-has-borrowed-data: true + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true SynonymItemSchema: allOf: @@ -4903,7 +5373,6 @@ components: description: Array of synonym items items: $ref: '#/components/schemas/SynonymItemSchema' - x-rust-has-borrowed-data: true SynonymSetSchema: allOf: - $ref: '#/components/schemas/SynonymSetCreateSchema' @@ -4969,7 +5438,6 @@ components: type: object description: | Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered. - x-rust-has-borrowed-data: true sort_by: type: string description: | @@ -4997,7 +5465,6 @@ components: id: type: string description: ID of the curation item - x-rust-has-borrowed-data: true CurationItemSchema: allOf: - $ref: '#/components/schemas/CurationItemCreateSchema' @@ -5020,6 +5487,7 @@ components: description: type: string description: Optional description for the curation set + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true CurationSetSchema: allOf: @@ -5104,19 +5572,21 @@ components: $ref: '#/components/schemas/IndexAction' dirty_values: $ref: '#/components/schemas/DirtyValues' - x-rust-has-borrowed-data: true ExportDocumentsParameters: type: object properties: filter_by: type: string description: Filter conditions for refining your search results. Separate multiple conditions with &&. + x-rust-has-borrowed-data: true include_fields: type: string description: List of fields from the document to include in the search result + x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true UpdateDocumentsParameters: type: object @@ -5124,6 +5594,7 @@ components: filter_by: type: string example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true DeleteDocumentsParameters: type: object @@ -5133,6 +5604,7 @@ components: filter_by: type: string example: 'num_employees:>100 && country: [USA, UK]' + x-rust-has-borrowed-data: true batch_size: type: integer description: Batch size parameter controls the number of documents that should be deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server. @@ -5148,6 +5620,7 @@ components: exclude_fields: type: string description: Comma-separated list of fields from the collection to exclude from the response + x-rust-has-borrowed-data: true limit: type: integer description: | diff --git a/typesense/src/client/curation_set/items.rs b/typesense/src/client/curation_set/items.rs index decaa352..2bfcdfcb 100644 --- a/typesense/src/client/curation_set/items.rs +++ b/typesense/src/client/curation_set/items.rs @@ -51,7 +51,7 @@ impl<'a> CurationSetItems<'a> { pub async fn upsert( &self, item_id: impl Into>, - schema: models::CurationItemCreateSchema<'_>, + schema: models::CurationItemCreateSchema, ) -> Result> { let params = curation_sets_api::UpsertCurationSetItemParams { diff --git a/typesense_codegen/docs/AnalyticsRuleUpdateParams.md b/typesense_codegen/docs/AnalyticsRuleUpdateParams.md new file mode 100644 index 00000000..f2e45f6c --- /dev/null +++ b/typesense_codegen/docs/AnalyticsRuleUpdateParams.md @@ -0,0 +1,17 @@ +# AnalyticsRuleUpdateParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**destination_collection** | Option<**String**> | | [optional] +**limit** | Option<**i32**> | | [optional] +**capture_search_requests** | Option<**bool**> | | [optional] +**meta_fields** | Option<**Vec**> | | [optional] +**expand_query** | Option<**bool**> | | [optional] +**counter_field** | Option<**String**> | | [optional] +**weight** | Option<**i32**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/typesense_codegen/src/apis/curation_sets_api.rs b/typesense_codegen/src/apis/curation_sets_api.rs index 2e67cf71..1f3340c9 100644 --- a/typesense_codegen/src/apis/curation_sets_api.rs +++ b/typesense_codegen/src/apis/curation_sets_api.rs @@ -70,7 +70,7 @@ pub struct UpsertCurationSetItemParams<'p> { /// The id of the curation item to upsert pub item_id: Cow<'p, str>, /// The curation item to be created/updated - pub curation_item_create_schema: models::CurationItemCreateSchema<'p>, + pub curation_item_create_schema: models::CurationItemCreateSchema, } /// struct for typed errors of method [`delete_curation_set`] diff --git a/typesense_codegen/src/models/analytics_rule_update_params.rs b/typesense_codegen/src/models/analytics_rule_update_params.rs new file mode 100644 index 00000000..a616fada --- /dev/null +++ b/typesense_codegen/src/models/analytics_rule_update_params.rs @@ -0,0 +1,51 @@ +/* + * Typesense API + * + * An open source search engine for building delightful search experiences. + * + * The version of the OpenAPI document: 30.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use ::std::borrow::Cow; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AnalyticsRuleUpdateParams<'a> { + #[serde( + rename = "destination_collection", + skip_serializing_if = "Option::is_none" + )] + pub destination_collection: Option>, + #[serde(rename = "limit", skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde( + rename = "capture_search_requests", + skip_serializing_if = "Option::is_none" + )] + pub capture_search_requests: Option, + #[serde(rename = "meta_fields", skip_serializing_if = "Option::is_none")] + pub meta_fields: Option>, + #[serde(rename = "expand_query", skip_serializing_if = "Option::is_none")] + pub expand_query: Option, + #[serde(rename = "counter_field", skip_serializing_if = "Option::is_none")] + pub counter_field: Option>, + #[serde(rename = "weight", skip_serializing_if = "Option::is_none")] + pub weight: Option, +} + +impl<'a> AnalyticsRuleUpdateParams<'a> { + pub fn new() -> Self { + Self { + destination_collection: None, + limit: None, + capture_search_requests: None, + meta_fields: None, + expand_query: None, + counter_field: None, + weight: None, + } + } +} diff --git a/typesense_codegen/src/models/curation_item_create_schema.rs b/typesense_codegen/src/models/curation_item_create_schema.rs index 430d10f8..9036e12b 100644 --- a/typesense_codegen/src/models/curation_item_create_schema.rs +++ b/typesense_codegen/src/models/curation_item_create_schema.rs @@ -13,7 +13,7 @@ use ::std::borrow::Cow; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CurationItemCreateSchema<'a> { +pub struct CurationItemCreateSchema { #[serde(rename = "rule")] pub rule: Box, /// List of document `id`s that should be included in the search results with their corresponding `position`s. @@ -24,7 +24,7 @@ pub struct CurationItemCreateSchema<'a> { pub excludes: Option>, /// A filter by clause that is applied to any search query that matches the curation rule. #[serde(rename = "filter_by", skip_serializing_if = "Option::is_none")] - pub filter_by: Option>, + pub filter_by: Option, /// Indicates whether search query tokens that exist in the curation's rule should be removed from the search query. #[serde( rename = "remove_matched_tokens", @@ -36,10 +36,10 @@ pub struct CurationItemCreateSchema<'a> { pub metadata: Option, /// A sort by clause that is applied to any search query that matches the curation rule. #[serde(rename = "sort_by", skip_serializing_if = "Option::is_none")] - pub sort_by: Option>, + pub sort_by: Option, /// Replaces the current search query with this value, when the search query matches the curation rule. #[serde(rename = "replace_query", skip_serializing_if = "Option::is_none")] - pub replace_query: Option>, + pub replace_query: Option, /// When set to true, the filter conditions of the query is applied to the curated records as well. Default: false. #[serde( rename = "filter_curated_hits", @@ -57,10 +57,10 @@ pub struct CurationItemCreateSchema<'a> { pub stop_processing: Option, /// ID of the curation item #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, + pub id: Option, } -impl<'a> CurationItemCreateSchema<'a> { +impl CurationItemCreateSchema { pub fn new(rule: models::CurationRule) -> Self { Self { rule: Box::new(rule), diff --git a/typesense_codegen/src/models/curation_set_create_schema.rs b/typesense_codegen/src/models/curation_set_create_schema.rs index c8b336c7..8b4d3f56 100644 --- a/typesense_codegen/src/models/curation_set_create_schema.rs +++ b/typesense_codegen/src/models/curation_set_create_schema.rs @@ -16,14 +16,14 @@ use serde::{Deserialize, Serialize}; pub struct CurationSetCreateSchema<'a> { /// Array of curation items #[serde(rename = "items")] - pub items: Vec>, + pub items: Vec, /// Optional description for the curation set #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option>, } impl<'a> CurationSetCreateSchema<'a> { - pub fn new(items: Vec>) -> Self { + pub fn new(items: Vec) -> Self { Self { items, description: None, diff --git a/typesense_codegen/src/models/curation_set_schema.rs b/typesense_codegen/src/models/curation_set_schema.rs index 6f4d2c87..1f7f46bd 100644 --- a/typesense_codegen/src/models/curation_set_schema.rs +++ b/typesense_codegen/src/models/curation_set_schema.rs @@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct CurationSetSchema { /// Array of curation items #[serde(rename = "items")] - pub items: Vec>, + pub items: Vec, /// Optional description for the curation set #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, @@ -25,7 +25,7 @@ pub struct CurationSetSchema { } impl CurationSetSchema { - pub fn new(items: Vec>, name: String) -> Self { + pub fn new(items: Vec, name: String) -> Self { Self { items, description: None, diff --git a/typesense_codegen/src/models/nl_search_model_base.rs b/typesense_codegen/src/models/nl_search_model_base.rs index a9b4d931..07c0e859 100644 --- a/typesense_codegen/src/models/nl_search_model_base.rs +++ b/typesense_codegen/src/models/nl_search_model_base.rs @@ -13,16 +13,16 @@ use ::std::borrow::Cow; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct NlSearchModelBase { +pub struct NlSearchModelBase<'a> { /// Name of the NL model to use #[serde(rename = "model_name", skip_serializing_if = "Option::is_none")] - pub model_name: Option, + pub model_name: Option>, /// API key for the NL model service #[serde(rename = "api_key", skip_serializing_if = "Option::is_none")] - pub api_key: Option, + pub api_key: Option>, /// Custom API URL for the NL model service #[serde(rename = "api_url", skip_serializing_if = "Option::is_none")] - pub api_url: Option, + pub api_url: Option>, /// Maximum number of bytes to process #[serde(rename = "max_bytes", skip_serializing_if = "Option::is_none")] pub max_bytes: Option, @@ -31,7 +31,7 @@ pub struct NlSearchModelBase { pub temperature: Option, /// System prompt for the NL model #[serde(rename = "system_prompt", skip_serializing_if = "Option::is_none")] - pub system_prompt: Option, + pub system_prompt: Option>, /// Top-p parameter for the NL model (Google-specific) #[serde(rename = "top_p", skip_serializing_if = "Option::is_none")] pub top_p: Option, @@ -43,34 +43,34 @@ pub struct NlSearchModelBase { pub stop_sequences: Option>, /// API version for the NL model service #[serde(rename = "api_version", skip_serializing_if = "Option::is_none")] - pub api_version: Option, + pub api_version: Option>, /// Project ID for GCP Vertex AI #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] - pub project_id: Option, + pub project_id: Option>, /// Access token for GCP Vertex AI #[serde(rename = "access_token", skip_serializing_if = "Option::is_none")] - pub access_token: Option, + pub access_token: Option>, /// Refresh token for GCP Vertex AI #[serde(rename = "refresh_token", skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, + pub refresh_token: Option>, /// Client ID for GCP Vertex AI #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")] - pub client_id: Option, + pub client_id: Option>, /// Client secret for GCP Vertex AI #[serde(rename = "client_secret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, + pub client_secret: Option>, /// Region for GCP Vertex AI #[serde(rename = "region", skip_serializing_if = "Option::is_none")] - pub region: Option, + pub region: Option>, /// Maximum output tokens for GCP Vertex AI #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] pub max_output_tokens: Option, /// Account ID for Cloudflare-specific models #[serde(rename = "account_id", skip_serializing_if = "Option::is_none")] - pub account_id: Option, + pub account_id: Option>, } -impl NlSearchModelBase { +impl<'a> NlSearchModelBase<'a> { pub fn new() -> Self { Self { model_name: None, diff --git a/xtask/src/main.rs b/xtask/src/main.rs index bb60432c..b25aab4e 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -2,6 +2,7 @@ use anyhow::{Context, Result}; use clap::{Parser, ValueEnum}; use std::{env, fs, process::Command}; mod add_vendor_attributes; +mod mark_borrowed_data; mod preprocess_openapi; #[cfg(feature = "typesense")] mod test_clean; diff --git a/xtask/src/mark_borrowed_data.rs b/xtask/src/mark_borrowed_data.rs new file mode 100644 index 00000000..3f1c26e4 --- /dev/null +++ b/xtask/src/mark_borrowed_data.rs @@ -0,0 +1,235 @@ +use indexmap::IndexMap; + +use crate::preprocess_openapi::OpenAPIProperty; + +pub(crate) fn is_forced_borrow_model(name: &str) -> bool { + name.ends_with("Parameters") || name == "MultiSearchSearchesParameter" +} + +// Deeply traverse resolving $refs to ensure all nested request models are tracked. +pub(crate) fn collect_request_schemas( + property: &OpenAPIProperty, + schemas: &IndexMap, + collected: &mut std::collections::HashSet, +) { + if let Some(reference) = &property.r#ref { + let name = reference.trim_start_matches("#/components/schemas/"); + if collected.insert(name.to_owned()) { + if let Some(schema) = schemas.get(name) { + collect_request_schemas(schema, schemas, collected); + } + } + } + + if let Some(properties) = &property.properties { + for nested_property in properties.values() { + collect_request_schemas(nested_property, schemas, collected); + } + } + if let Some(items) = &property.items { + collect_request_schemas(items, schemas, collected); + } + if let Some(one_of) = &property.one_of { + for variant in one_of { + collect_request_schemas(variant, schemas, collected); + } + } + if let Some(any_of) = &property.any_of { + for variant in any_of { + collect_request_schemas(variant, schemas, collected); + } + } + + if let Some(all_of_value) = property.extra.get("allOf") { + if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { + for item in sequence { + collect_request_schemas(&item, schemas, collected); + } + } + } + if let Some(additional_properties_value) = property.extra.get("additionalProperties") { + if let Ok(additional_property) = + serde_yaml::from_value::(additional_properties_value.clone()) + { + collect_request_schemas(&additional_property, schemas, collected); + } + } +} + +// Deeply traverse resolving $refs to ensure all nested response models are tracked. +// IMPORTANT: treat `allOf` as a mixin and do NOT blocklist the mixin schema itself. +pub(crate) fn collect_response_schemas( + property: &OpenAPIProperty, + schemas: &IndexMap, + collected: &mut std::collections::HashSet, + is_mixin: bool, +) { + if let Some(reference) = &property.r#ref { + let name = reference.trim_start_matches("#/components/schemas/"); + + if !is_mixin { + // It's a direct type reference, blocklist it. + if collected.insert(name.to_owned()) { + if let Some(schema) = schemas.get(name) { + collect_response_schemas(schema, schemas, collected, false); + } + } + } else { + // It's an allOf mixin. Do NOT blocklist the schema itself. + if let Some(schema) = schemas.get(name) { + if let Some(properties) = &schema.properties { + for nested_property in properties.values() { + collect_response_schemas(nested_property, schemas, collected, false); + } + } + if let Some(items) = &schema.items { + collect_response_schemas(items, schemas, collected, false); + } + if let Some(one_of) = &schema.one_of { + for variant in one_of { + collect_response_schemas(variant, schemas, collected, false); + } + } + if let Some(any_of) = &schema.any_of { + for variant in any_of { + collect_response_schemas(variant, schemas, collected, false); + } + } + + if let Some(all_of_value) = schema.extra.get("allOf") { + if let Ok(sequence) = + serde_yaml::from_value::>(all_of_value.clone()) + { + for item in sequence { + collect_response_schemas(&item, schemas, collected, true); + } + } + } + if let Some(additional_properties_value) = schema.extra.get("additionalProperties") + { + if let Ok(additional_property) = serde_yaml::from_value::( + additional_properties_value.clone(), + ) { + collect_response_schemas(&additional_property, schemas, collected, false); + } + } + } + } + } + + if let Some(properties) = &property.properties { + for nested_property in properties.values() { + collect_response_schemas(nested_property, schemas, collected, false); + } + } + if let Some(items) = &property.items { + collect_response_schemas(items, schemas, collected, false); + } + if let Some(one_of) = &property.one_of { + for variant in one_of { + collect_response_schemas(variant, schemas, collected, false); + } + } + if let Some(any_of) = &property.any_of { + for variant in any_of { + collect_response_schemas(variant, schemas, collected, false); + } + } + + // If we hit `allOf` in a response, flag its targets as mixins (is_mixin = true) + if let Some(all_of_value) = property.extra.get("allOf") { + if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { + for item in sequence { + collect_response_schemas(&item, schemas, collected, true); + } + } + } + if let Some(additional_properties_value) = property.extra.get("additionalProperties") { + if let Ok(additional_property) = + serde_yaml::from_value::(additional_properties_value.clone()) + { + collect_response_schemas(&additional_property, schemas, collected, false); + } + } +} + +// Helper function to recursively check if a schema contains an actual string +pub(crate) fn property_contains_string( + property: &OpenAPIProperty, + schemas: &IndexMap, + visited: &mut std::collections::HashSet, + response_schemas: &std::collections::HashSet, +) -> bool { + let is_enum = property.extra.contains_key("enum"); + let is_uuid = property.extra.get("format").and_then(|v| v.as_str()) == Some("uuid"); + + if property.r#type.as_deref() == Some("string") && !is_enum && !is_uuid { + return true; + } + + if let Some(reference) = &property.r#ref { + let name = reference.trim_start_matches("#/components/schemas/"); + + // Uses the new override helper + if response_schemas.contains(name) && !is_forced_borrow_model(name) { + return false; + } + + if !visited.contains(name) { + visited.insert(name.to_owned()); + if let Some(schema) = schemas.get(name) { + if property_contains_string(schema, schemas, visited, response_schemas) { + return true; + } + } + } + } + + if let Some(properties) = &property.properties { + for nested_property in properties.values() { + if property_contains_string(nested_property, schemas, visited, response_schemas) { + return true; + } + } + } + if let Some(items) = &property.items { + if property_contains_string(items, schemas, visited, response_schemas) { + return true; + } + } + if let Some(one_of) = &property.one_of { + for variant in one_of { + if property_contains_string(variant, schemas, visited, response_schemas) { + return true; + } + } + } + if let Some(any_of) = &property.any_of { + for variant in any_of { + if property_contains_string(variant, schemas, visited, response_schemas) { + return true; + } + } + } + + if let Some(all_of_value) = property.extra.get("allOf") { + if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { + for item in sequence { + if property_contains_string(&item, schemas, visited, response_schemas) { + return true; + } + } + } + } + if let Some(additional_properties_value) = property.extra.get("additionalProperties") { + if let Ok(additional_property) = + serde_yaml::from_value::(additional_properties_value.clone()) + { + if property_contains_string(&additional_property, schemas, visited, response_schemas) { + return true; + } + } + } + + false +} diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index 38be8302..438d610b 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -1,9 +1,15 @@ -use ::std::{collections::HashSet, fs}; +use ::std::fs; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use serde_yaml::Value; -use crate::add_vendor_attributes::add_vendor_attributes; +use crate::{ + add_vendor_attributes::add_vendor_attributes, + mark_borrowed_data::{ + collect_request_schemas, collect_response_schemas, is_forced_borrow_model, + property_contains_string, + }, +}; #[derive(Clone, Debug, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -202,31 +208,34 @@ pub fn preprocess_openapi_file( } impl OpenAPIProperty { - fn collect_properties(&self) -> Vec { - let mut data = Vec::new(); - if let Some(schema) = &self.r#ref { - data.push( - schema - .trim_start_matches("#/components/schemas/") - .to_owned(), - ); + fn mark_borrowed_property_recursive( + &mut self, + schemas: &IndexMap, + response_schemas: &std::collections::HashSet, + ) { + let mut visited = std::collections::HashSet::new(); + if property_contains_string(self, schemas, &mut visited, response_schemas) { + self.extra + .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); } - if let Some(p) = &self.items { - data.extend(p.collect_properties()); + + if let Some(properties) = &mut self.properties { + for nested_property in properties.values_mut() { + nested_property.mark_borrowed_property_recursive(schemas, response_schemas); + } } - if let Some(v) = &self.any_of { - v.iter().for_each(|p| data.extend(p.collect_properties())); + if let Some(items) = &mut self.items { + items.mark_borrowed_property_recursive(schemas, response_schemas); } - if let Some(v) = &self.one_of { - v.iter().for_each(|p| data.extend(p.collect_properties())); + if let Some(one_of) = &mut self.one_of { + for variant in one_of.iter_mut() { + variant.mark_borrowed_property_recursive(schemas, response_schemas); + } } - data - } - - fn mark_borrowed_property(&mut self) { - if self.r#type.as_deref() == Some("object") || self.one_of.is_some() { - self.extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + if let Some(any_of) = &mut self.any_of { + for variant in any_of.iter_mut() { + variant.mark_borrowed_property_recursive(schemas, response_schemas); + } } } } @@ -235,41 +244,144 @@ impl OpenAPI { fn mark_borrowed_data(&mut self) { println!("Marking borrowed data..."); - let mut request_schemas = HashSet::new(); - self.paths.iter_mut().for_each(|(_, pms)| { - pms.iter_mut().for_each(|(_, pm)| { - if let Some(ps) = &mut pm.parameters { - ps.iter_mut().for_each(|p| { - if let Some(s) = &mut p.schema { - s.mark_borrowed_property(); - request_schemas.extend(s.collect_properties()); + let schemas_ref = self.components.schemas.clone(); + let mut request_schemas = std::collections::HashSet::new(); + let mut response_schemas = std::collections::HashSet::new(); + + // Gather all response schemas + self.paths.iter().for_each(|(_path, operations)| { + operations.iter().for_each(|(_method, operation)| { + if let Some(responses) = &operation.responses { + for response in responses.values() { + if let Some(media_types) = &response.content { + for media_type in media_types.values() { + if let Some(schema) = &media_type.schema { + collect_response_schemas( + schema, + &schemas_ref, + &mut response_schemas, + false, + ); + } + } } - }) + } } + }); + }); - if let Some(reqb) = &mut pm.request_body - && let Some(cs) = &mut reqb.content - { - cs.iter_mut().for_each(|(_, c)| { - if let Some(s) = &mut c.schema { - s.mark_borrowed_property(); - request_schemas.extend(s.collect_properties()); + // Process requests + self.paths.iter_mut().for_each(|(_path, operations)| { + operations.iter_mut().for_each(|(_method, operation)| { + let mut operation_has_borrowed_data = false; + + if let Some(parameters) = &mut operation.parameters { + parameters.iter_mut().for_each(|parameter| { + if let Some(schema) = &mut parameter.schema { + collect_request_schemas(schema, &schemas_ref, &mut request_schemas); + + let mut visited = std::collections::HashSet::new(); + if property_contains_string( + schema, + &schemas_ref, + &mut visited, + &response_schemas, + ) { + schema.mark_borrowed_property_recursive( + &schemas_ref, + &response_schemas, + ); + schema.extra.insert( + "x-rust-has-borrowed-data".to_owned(), + Value::Bool(true), + ); + parameter.extra.insert( + "x-rust-has-borrowed-data".to_owned(), + Value::Bool(true), + ); + operation_has_borrowed_data = true; + } } }) } + + if let Some(request_body) = &mut operation.request_body { + let mut request_body_has_borrowed_data = false; + if let Some(media_types) = &mut request_body.content { + media_types.iter_mut().for_each(|(_mime, media_type)| { + if let Some(schema) = &mut media_type.schema { + collect_request_schemas(schema, &schemas_ref, &mut request_schemas); + + let mut visited = std::collections::HashSet::new(); + if property_contains_string( + schema, + &schemas_ref, + &mut visited, + &response_schemas, + ) { + schema.mark_borrowed_property_recursive( + &schemas_ref, + &response_schemas, + ); + schema.extra.insert( + "x-rust-has-borrowed-data".to_owned(), + Value::Bool(true), + ); + request_body_has_borrowed_data = true; + } + } + }) + } + if request_body_has_borrowed_data { + request_body + .extra + .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + operation_has_borrowed_data = true; + } + } + + if operation_has_borrowed_data { + operation + .extra + .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + } }) }); - let schemas = self + // Filter request schemas to only those that are not also response schemas, unless they are forced borrow models + request_schemas.retain(|schema_name| { + !response_schemas.contains(schema_name) || is_forced_borrow_model(schema_name) + }); + + let schemas_to_check = self .components .schemas - .iter() - .filter(|(n, _)| n.ends_with("Parameters") || request_schemas.contains(n.as_str())) - .map(|(n, _)| n.to_owned()) + .keys() + .filter(|schema_name| { + is_forced_borrow_model(schema_name) + || request_schemas.contains(schema_name.as_str()) + }) + .cloned() .collect::>(); - drop(request_schemas); - for schema_name in schemas { + // Apply the Cow flag + for schema_name in schemas_to_check { + if response_schemas.contains(&schema_name) && !is_forced_borrow_model(&schema_name) { + continue; + } + + let contains_string = { + let Some(schema) = self.components.schemas.get(&schema_name) else { + continue; + }; + let mut visited = std::collections::HashSet::new(); + property_contains_string(schema, &schemas_ref, &mut visited, &response_schemas) + }; + + if !contains_string { + continue; + } + let Some(schema) = self.components.schemas.get_mut(&schema_name) else { continue; }; @@ -277,20 +389,7 @@ impl OpenAPI { schema .extra .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); - - for (_, prop) in schema.properties.iter_mut().flat_map(|v| v.iter_mut()) { - for inner in prop.one_of.iter_mut().flat_map(|v| v.iter_mut()) { - inner.mark_borrowed_property(); - } - for inner in prop.any_of.iter_mut().flat_map(|v| v.iter_mut()) { - inner.mark_borrowed_property(); - } - if let Some(inner) = &mut prop.items { - inner.mark_borrowed_property(); - } - - prop.mark_borrowed_property(); - } + schema.mark_borrowed_property_recursive(&schemas_ref, &response_schemas); } } From 06427cf48ee50afb41ec4e4cd3c8412f8520b849 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Tue, 17 Mar 2026 23:32:57 +0700 Subject: [PATCH 2/9] run clippy fix --- xtask/src/mark_borrowed_data.rs | 114 +++++++++++++++----------------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/xtask/src/mark_borrowed_data.rs b/xtask/src/mark_borrowed_data.rs index 3f1c26e4..9c9d873d 100644 --- a/xtask/src/mark_borrowed_data.rs +++ b/xtask/src/mark_borrowed_data.rs @@ -14,10 +14,10 @@ pub(crate) fn collect_request_schemas( ) { if let Some(reference) = &property.r#ref { let name = reference.trim_start_matches("#/components/schemas/"); - if collected.insert(name.to_owned()) { - if let Some(schema) = schemas.get(name) { - collect_request_schemas(schema, schemas, collected); - } + if collected.insert(name.to_owned()) + && let Some(schema) = schemas.get(name) + { + collect_request_schemas(schema, schemas, collected); } } @@ -40,19 +40,18 @@ pub(crate) fn collect_request_schemas( } } - if let Some(all_of_value) = property.extra.get("allOf") { - if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { - for item in sequence { - collect_request_schemas(&item, schemas, collected); - } + if let Some(all_of_value) = property.extra.get("allOf") + && let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) + { + for item in sequence { + collect_request_schemas(&item, schemas, collected); } } - if let Some(additional_properties_value) = property.extra.get("additionalProperties") { - if let Ok(additional_property) = + if let Some(additional_properties_value) = property.extra.get("additionalProperties") + && let Ok(additional_property) = serde_yaml::from_value::(additional_properties_value.clone()) - { - collect_request_schemas(&additional_property, schemas, collected); - } + { + collect_request_schemas(&additional_property, schemas, collected); } } @@ -69,10 +68,10 @@ pub(crate) fn collect_response_schemas( if !is_mixin { // It's a direct type reference, blocklist it. - if collected.insert(name.to_owned()) { - if let Some(schema) = schemas.get(name) { - collect_response_schemas(schema, schemas, collected, false); - } + if collected.insert(name.to_owned()) + && let Some(schema) = schemas.get(name) + { + collect_response_schemas(schema, schemas, collected, false); } } else { // It's an allOf mixin. Do NOT blocklist the schema itself. @@ -96,22 +95,20 @@ pub(crate) fn collect_response_schemas( } } - if let Some(all_of_value) = schema.extra.get("allOf") { - if let Ok(sequence) = + if let Some(all_of_value) = schema.extra.get("allOf") + && let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) - { - for item in sequence { - collect_response_schemas(&item, schemas, collected, true); - } + { + for item in sequence { + collect_response_schemas(&item, schemas, collected, true); } } if let Some(additional_properties_value) = schema.extra.get("additionalProperties") - { - if let Ok(additional_property) = serde_yaml::from_value::( + && let Ok(additional_property) = serde_yaml::from_value::( additional_properties_value.clone(), - ) { - collect_response_schemas(&additional_property, schemas, collected, false); - } + ) + { + collect_response_schemas(&additional_property, schemas, collected, false); } } } @@ -137,19 +134,18 @@ pub(crate) fn collect_response_schemas( } // If we hit `allOf` in a response, flag its targets as mixins (is_mixin = true) - if let Some(all_of_value) = property.extra.get("allOf") { - if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { - for item in sequence { - collect_response_schemas(&item, schemas, collected, true); - } + if let Some(all_of_value) = property.extra.get("allOf") + && let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) + { + for item in sequence { + collect_response_schemas(&item, schemas, collected, true); } } - if let Some(additional_properties_value) = property.extra.get("additionalProperties") { - if let Ok(additional_property) = + if let Some(additional_properties_value) = property.extra.get("additionalProperties") + && let Ok(additional_property) = serde_yaml::from_value::(additional_properties_value.clone()) - { - collect_response_schemas(&additional_property, schemas, collected, false); - } + { + collect_response_schemas(&additional_property, schemas, collected, false); } } @@ -177,10 +173,10 @@ pub(crate) fn property_contains_string( if !visited.contains(name) { visited.insert(name.to_owned()); - if let Some(schema) = schemas.get(name) { - if property_contains_string(schema, schemas, visited, response_schemas) { - return true; - } + if let Some(schema) = schemas.get(name) + && property_contains_string(schema, schemas, visited, response_schemas) + { + return true; } } } @@ -192,10 +188,10 @@ pub(crate) fn property_contains_string( } } } - if let Some(items) = &property.items { - if property_contains_string(items, schemas, visited, response_schemas) { - return true; - } + if let Some(items) = &property.items + && property_contains_string(items, schemas, visited, response_schemas) + { + return true; } if let Some(one_of) = &property.one_of { for variant in one_of { @@ -212,23 +208,21 @@ pub(crate) fn property_contains_string( } } - if let Some(all_of_value) = property.extra.get("allOf") { - if let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) { - for item in sequence { - if property_contains_string(&item, schemas, visited, response_schemas) { - return true; - } + if let Some(all_of_value) = property.extra.get("allOf") + && let Ok(sequence) = serde_yaml::from_value::>(all_of_value.clone()) + { + for item in sequence { + if property_contains_string(&item, schemas, visited, response_schemas) { + return true; } } } - if let Some(additional_properties_value) = property.extra.get("additionalProperties") { - if let Ok(additional_property) = + if let Some(additional_properties_value) = property.extra.get("additionalProperties") + && let Ok(additional_property) = serde_yaml::from_value::(additional_properties_value.clone()) - { - if property_contains_string(&additional_property, schemas, visited, response_schemas) { - return true; - } - } + && property_contains_string(&additional_property, schemas, visited, response_schemas) + { + return true; } false From acec54f5b2faef443268a500165a82343dc9d957 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Tue, 17 Mar 2026 23:59:02 +0700 Subject: [PATCH 3/9] force borrow model based on explicit names instead of name ending with "Parameters" --- xtask/src/mark_borrowed_data.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xtask/src/mark_borrowed_data.rs b/xtask/src/mark_borrowed_data.rs index 9c9d873d..06740a9e 100644 --- a/xtask/src/mark_borrowed_data.rs +++ b/xtask/src/mark_borrowed_data.rs @@ -3,9 +3,19 @@ use indexmap::IndexMap; use crate::preprocess_openapi::OpenAPIProperty; pub(crate) fn is_forced_borrow_model(name: &str) -> bool { - name.ends_with("Parameters") || name == "MultiSearchSearchesParameter" + matches!( + name, + "SearchParameters" + | "MultiSearchParameters" + | "MultiSearchSearchesParameter" + | "MultiSearchCollectionParameters" + | "ImportDocumentsParameters" + | "ExportDocumentsParameters" + | "UpdateDocumentsParameters" + | "DeleteDocumentsParameters" + | "GetCollectionsParameters" + ) } - // Deeply traverse resolving $refs to ensure all nested request models are tracked. pub(crate) fn collect_request_schemas( property: &OpenAPIProperty, From fdb2b647e7343766b3f441ffcd708067910cd0ba Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Wed, 18 Mar 2026 13:27:47 +0700 Subject: [PATCH 4/9] fix unnecessary x-rust borrow flags in preprocessed openapi yaml --- preprocessed_openapi.yml | 123 -------------------------------- xtask/src/preprocess_openapi.rs | 14 +++- 2 files changed, 12 insertions(+), 125 deletions(-) diff --git a/preprocessed_openapi.yml b/preprocessed_openapi.yml index de2a26ec..77b48505 100644 --- a/preprocessed_openapi.yml +++ b/preprocessed_openapi.yml @@ -3470,7 +3470,6 @@ components: type: string description: Name of the collection example: companies - x-rust-has-borrowed-data: true fields: type: array description: A list of fields for querying, filtering and faceting @@ -3491,7 +3490,6 @@ components: default: '' description: The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. example: num_employees - x-rust-has-borrowed-data: true token_separators: type: array default: [] @@ -3501,7 +3499,6 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true synonym_sets: type: array @@ -3509,7 +3506,6 @@ components: items: type: string example: synonym_set_1 - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true enable_nested_fields: type: boolean @@ -3525,7 +3521,6 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true voice_query_model: $ref: '#/components/schemas/VoiceQueryModelCollectionConfig' @@ -3715,7 +3710,6 @@ components: collection_name: type: string description: Name of the collection you wish to map the alias to - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true CollectionAlias: type: object @@ -4047,21 +4041,17 @@ components: properties: value: type: string - x-rust-has-borrowed-data: true description: type: string - x-rust-has-borrowed-data: true actions: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true collections: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true expires_at: type: integer @@ -4130,34 +4120,27 @@ components: q: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. - x-rust-has-borrowed-data: true query_by: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true nl_query: type: boolean description: Whether to use natural language processing to parse the query. nl_model_id: type: string description: The ID of the natural language model to use. - x-rust-has-borrowed-data: true query_by_weights: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true text_match_type: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. - x-rust-has-borrowed-data: true prefix: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. - x-rust-has-borrowed-data: true infix: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results - x-rust-has-borrowed-data: true max_extra_prefix: type: integer description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. @@ -4168,7 +4151,6 @@ components: type: string description: Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true max_filter_by_candidates: type: integer description: Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*. @@ -4176,23 +4158,19 @@ components: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` example: num_employees:desc - x-rust-has-borrowed-data: true facet_by: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. - x-rust-has-borrowed-data: true max_facet_values: type: integer description: Maximum number of facet values to be returned. facet_query: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". - x-rust-has-borrowed-data: true num_typos: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 - x-rust-has-borrowed-data: true page: type: integer description: Results from this specific page number would be fetched. @@ -4209,7 +4187,6 @@ components: group_by: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. - x-rust-has-borrowed-data: true group_limit: type: integer description: | @@ -4221,15 +4198,12 @@ components: include_fields: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true highlight_full_fields: type: string description: List of fields which should be highlighted fully without snippeting - x-rust-has-borrowed-data: true highlight_affix_num_tokens: type: integer description: | @@ -4238,12 +4212,10 @@ components: type: string description: | The start tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true highlight_end_tag: type: string description: | The end tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true enable_highlight_v1: type: boolean default: true @@ -4262,7 +4234,6 @@ components: type: string description: List of synonym set names to associate with this search query example: synonym_set_1,synonym_set_2 - x-rust-has-borrowed-data: true drop_tokens_threshold: type: integer description: | @@ -4298,27 +4269,22 @@ components: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true hidden_hits: type: string description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true override_tags: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. - x-rust-has-borrowed-data: true highlight_fields: type: string description: | A list of custom fields that must be highlighted even if you don't query for them - x-rust-has-borrowed-data: true split_join_tokens: type: string description: | Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. - x-rust-has-borrowed-data: true pre_segmented_query: type: boolean description: | @@ -4328,7 +4294,6 @@ components: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. - x-rust-has-borrowed-data: true enable_overrides: type: boolean default: false @@ -4386,7 +4351,6 @@ components: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. - x-rust-has-borrowed-data: true remote_embedding_timeout_ms: type: integer description: | @@ -4399,22 +4363,18 @@ components: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). - x-rust-has-borrowed-data: true stopwords: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. - x-rust-has-borrowed-data: true facet_return_parent: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. - x-rust-has-borrowed-data: true voice_query: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. - x-rust-has-borrowed-data: true conversation: type: boolean description: | @@ -4423,12 +4383,10 @@ components: type: string description: | The Id of Conversation Model to be used. - x-rust-has-borrowed-data: true conversation_id: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. - x-rust-has-borrowed-data: true x-rust-builder: true x-rust-has-borrowed-data: true MultiSearchParameters: @@ -4439,27 +4397,21 @@ components: q: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. - x-rust-has-borrowed-data: true query_by: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true query_by_weights: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true text_match_type: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. - x-rust-has-borrowed-data: true prefix: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. - x-rust-has-borrowed-data: true infix: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results - x-rust-has-borrowed-data: true max_extra_prefix: type: integer description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. @@ -4470,27 +4422,22 @@ components: type: string description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true sort_by: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` - x-rust-has-borrowed-data: true facet_by: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. - x-rust-has-borrowed-data: true max_facet_values: type: integer description: Maximum number of facet values to be returned. facet_query: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". - x-rust-has-borrowed-data: true num_typos: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 - x-rust-has-borrowed-data: true page: type: integer description: Results from this specific page number would be fetched. @@ -4507,7 +4454,6 @@ components: group_by: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. - x-rust-has-borrowed-data: true group_limit: type: integer description: | @@ -4519,15 +4465,12 @@ components: include_fields: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true highlight_full_fields: type: string description: List of fields which should be highlighted fully without snippeting - x-rust-has-borrowed-data: true highlight_affix_num_tokens: type: integer description: | @@ -4536,12 +4479,10 @@ components: type: string description: | The start tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true highlight_end_tag: type: string description: | The end tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true snippet_threshold: type: integer description: | @@ -4586,22 +4527,18 @@ components: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true hidden_hits: type: string description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true override_tags: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. - x-rust-has-borrowed-data: true highlight_fields: type: string description: | A list of custom fields that must be highlighted even if you don't query for them - x-rust-has-borrowed-data: true pre_segmented_query: type: boolean default: false @@ -4612,7 +4549,6 @@ components: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. - x-rust-has-borrowed-data: true enable_overrides: type: boolean default: false @@ -4666,7 +4602,6 @@ components: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. - x-rust-has-borrowed-data: true remote_embedding_timeout_ms: type: integer description: | @@ -4679,22 +4614,18 @@ components: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). - x-rust-has-borrowed-data: true stopwords: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. - x-rust-has-borrowed-data: true facet_return_parent: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. - x-rust-has-borrowed-data: true voice_query: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. - x-rust-has-borrowed-data: true conversation: type: boolean description: | @@ -4703,12 +4634,10 @@ components: type: string description: | The Id of Conversation Model to be used. - x-rust-has-borrowed-data: true conversation_id: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. - x-rust-has-borrowed-data: true x-rust-builder: true x-rust-has-borrowed-data: true MultiSearchSearchesParameter: @@ -4798,33 +4727,26 @@ components: name: type: string description: Name of the analytics rule this event corresponds to - x-rust-has-borrowed-data: true event_type: type: string description: Type of event (e.g., click, conversion, query, visit) - x-rust-has-borrowed-data: true data: type: object description: Event payload properties: user_id: type: string - x-rust-has-borrowed-data: true doc_id: type: string - x-rust-has-borrowed-data: true doc_ids: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true q: type: string - x-rust-has-borrowed-data: true analytics_tag: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true AnalyticsEventsResponse: @@ -4866,24 +4788,19 @@ components: properties: name: type: string - x-rust-has-borrowed-data: true type: $ref: '#/components/schemas/AnalyticsRuleType' collection: type: string - x-rust-has-borrowed-data: true event_type: type: string - x-rust-has-borrowed-data: true rule_tag: type: string - x-rust-has-borrowed-data: true params: type: object properties: destination_collection: type: string - x-rust-has-borrowed-data: true limit: type: integer capture_search_requests: @@ -4892,13 +4809,11 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true expand_query: type: boolean counter_field: type: string - x-rust-has-borrowed-data: true weight: type: integer x-rust-has-borrowed-data: true @@ -4916,16 +4831,13 @@ components: properties: name: type: string - x-rust-has-borrowed-data: true rule_tag: type: string - x-rust-has-borrowed-data: true params: type: object properties: destination_collection: type: string - x-rust-has-borrowed-data: true limit: type: integer capture_search_requests: @@ -4934,13 +4846,11 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true expand_query: type: boolean counter_field: type: string - x-rust-has-borrowed-data: true weight: type: integer x-rust-has-borrowed-data: true @@ -5019,11 +4929,9 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true locale: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true StopwordsSetSchema: type: object @@ -5150,27 +5058,21 @@ components: id: type: string description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. - x-rust-has-borrowed-data: true model_name: type: string description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM - x-rust-has-borrowed-data: true api_key: type: string description: The LLM service's API Key - x-rust-has-borrowed-data: true history_collection: type: string description: Typesense collection that stores the historical conversations - x-rust-has-borrowed-data: true account_id: type: string description: LLM service's account ID (only applicable for Cloudflare) - x-rust-has-borrowed-data: true system_prompt: type: string description: The system prompt that contains special instructions to the LLM - x-rust-has-borrowed-data: true ttl: type: integer description: | @@ -5182,7 +5084,6 @@ components: vllm_url: type: string description: URL of vLLM service - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true ConversationModelSchema: allOf: @@ -5227,15 +5128,12 @@ components: model_name: type: string description: Name of the NL model to use - x-rust-has-borrowed-data: true api_key: type: string description: API key for the NL model service - x-rust-has-borrowed-data: true api_url: type: string description: Custom API URL for the NL model service - x-rust-has-borrowed-data: true max_bytes: type: integer description: Maximum number of bytes to process @@ -5245,7 +5143,6 @@ components: system_prompt: type: string description: System prompt for the NL model - x-rust-has-borrowed-data: true top_p: type: number description: Top-p parameter for the NL model (Google-specific) @@ -5257,43 +5154,34 @@ components: description: Stop sequences for the NL model (Google-specific) items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true api_version: type: string description: API version for the NL model service - x-rust-has-borrowed-data: true project_id: type: string description: Project ID for GCP Vertex AI - x-rust-has-borrowed-data: true access_token: type: string description: Access token for GCP Vertex AI - x-rust-has-borrowed-data: true refresh_token: type: string description: Refresh token for GCP Vertex AI - x-rust-has-borrowed-data: true client_id: type: string description: Client ID for GCP Vertex AI - x-rust-has-borrowed-data: true client_secret: type: string description: Client secret for GCP Vertex AI - x-rust-has-borrowed-data: true region: type: string description: Region for GCP Vertex AI - x-rust-has-borrowed-data: true max_output_tokens: type: integer description: Maximum output tokens for GCP Vertex AI account_id: type: string description: Account ID for Cloudflare-specific models - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true NLSearchModelCreateSchema: allOf: @@ -5335,22 +5223,18 @@ components: description: Array of words that should be considered as synonyms items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true root: type: string description: For 1-way synonyms, indicates the root word that words in the synonyms parameter map to - x-rust-has-borrowed-data: true locale: type: string description: Locale for the synonym, leave blank to use the standard tokenizer - x-rust-has-borrowed-data: true symbols_to_index: type: array description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is items: type: string - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true SynonymItemSchema: @@ -5487,7 +5371,6 @@ components: description: type: string description: Optional description for the curation set - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true CurationSetSchema: allOf: @@ -5578,15 +5461,12 @@ components: filter_by: type: string description: Filter conditions for refining your search results. Separate multiple conditions with &&. - x-rust-has-borrowed-data: true include_fields: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true exclude_fields: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true UpdateDocumentsParameters: type: object @@ -5594,7 +5474,6 @@ components: filter_by: type: string example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true x-rust-has-borrowed-data: true DeleteDocumentsParameters: type: object @@ -5604,7 +5483,6 @@ components: filter_by: type: string example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true batch_size: type: integer description: Batch size parameter controls the number of documents that should be deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server. @@ -5620,7 +5498,6 @@ components: exclude_fields: type: string description: Comma-separated list of fields from the collection to exclude from the response - x-rust-has-borrowed-data: true limit: type: integer description: | diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index 438d610b..a676cb20 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -214,9 +214,19 @@ impl OpenAPIProperty { response_schemas: &std::collections::HashSet, ) { let mut visited = std::collections::HashSet::new(); + if property_contains_string(self, schemas, &mut visited, response_schemas) { - self.extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + // only flag structures that need a Rust <'a> lifetime e.g. objects, arrays,... + let is_structural = self.r#type.as_deref() == Some("object") + || self.r#type.as_deref() == Some("array") + || self.r#ref.is_some() + || self.one_of.is_some() + || self.any_of.is_some(); + + if is_structural { + self.extra + .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + } } if let Some(properties) = &mut self.properties { From 693c567711cb5bb988ae29b359e9a7b8dccc4d06 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Wed, 18 Mar 2026 21:37:29 +0700 Subject: [PATCH 5/9] feat: add orphaned_request_schemas to track unused request schemas created by the unwrap step --- xtask/src/mark_borrowed_data.rs | 5 ----- xtask/src/preprocess_openapi.rs | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/xtask/src/mark_borrowed_data.rs b/xtask/src/mark_borrowed_data.rs index 06740a9e..040ea583 100644 --- a/xtask/src/mark_borrowed_data.rs +++ b/xtask/src/mark_borrowed_data.rs @@ -9,11 +9,6 @@ pub(crate) fn is_forced_borrow_model(name: &str) -> bool { | "MultiSearchParameters" | "MultiSearchSearchesParameter" | "MultiSearchCollectionParameters" - | "ImportDocumentsParameters" - | "ExportDocumentsParameters" - | "UpdateDocumentsParameters" - | "DeleteDocumentsParameters" - | "GetCollectionsParameters" ) } // Deeply traverse resolving $refs to ensure all nested request models are tracked. diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index a676cb20..81e26167 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -32,6 +32,10 @@ pub(crate) struct OpenAPI { // Everything else not explicitly listed above #[serde(flatten)] pub(crate) extra: IndexMap, + + // Track schemas created by `unwrap_parameters_by_path` which are not used in any OpenAPI path methods + #[serde(skip)] + pub(crate) orphaned_request_schemas: std::collections::HashSet, } pub(crate) type OpenAPIPath = IndexMap; @@ -258,6 +262,17 @@ impl OpenAPI { let mut request_schemas = std::collections::HashSet::new(); let mut response_schemas = std::collections::HashSet::new(); + // This takes the schemas we remembered during the unwrap phase + // and treats them as if they were found in a live API request. + let forced_orphans = self.orphaned_request_schemas.clone(); + for schema_name in &forced_orphans { + request_schemas.insert(schema_name.clone()); + if let Some(schema) = schemas_ref.get(schema_name) { + // Tracing them ensures any sub-models they use also get Cow + collect_request_schemas(schema, &schemas_ref, &mut request_schemas); + } + } + // Gather all response schemas self.paths.iter().for_each(|(_path, operations)| { operations.iter().for_each(|(_method, operation)| { @@ -444,6 +459,9 @@ impl OpenAPI { self.components .schemas .insert(component_name.into(), inline_schema); + // Remember that this schema is an orphaned request schema for the next borrow data marking step + self.orphaned_request_schemas + .insert(component_name.to_owned()); } // --- Step 2: Unwrap the parameter object into individual parameters --- From 3ca3b0768fa94b6ee7af731bc986de5b11d86e9d Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Thu, 19 Mar 2026 21:58:54 +0700 Subject: [PATCH 6/9] remove unused model file from past code gen iteration --- .../models/analytics_rule_update_params.rs | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 typesense_codegen/src/models/analytics_rule_update_params.rs diff --git a/typesense_codegen/src/models/analytics_rule_update_params.rs b/typesense_codegen/src/models/analytics_rule_update_params.rs deleted file mode 100644 index a616fada..00000000 --- a/typesense_codegen/src/models/analytics_rule_update_params.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Typesense API - * - * An open source search engine for building delightful search experiences. - * - * The version of the OpenAPI document: 30.0 - * - * Generated by: https://openapi-generator.tech - */ - -use crate::models; -use ::std::borrow::Cow; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AnalyticsRuleUpdateParams<'a> { - #[serde( - rename = "destination_collection", - skip_serializing_if = "Option::is_none" - )] - pub destination_collection: Option>, - #[serde(rename = "limit", skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde( - rename = "capture_search_requests", - skip_serializing_if = "Option::is_none" - )] - pub capture_search_requests: Option, - #[serde(rename = "meta_fields", skip_serializing_if = "Option::is_none")] - pub meta_fields: Option>, - #[serde(rename = "expand_query", skip_serializing_if = "Option::is_none")] - pub expand_query: Option, - #[serde(rename = "counter_field", skip_serializing_if = "Option::is_none")] - pub counter_field: Option>, - #[serde(rename = "weight", skip_serializing_if = "Option::is_none")] - pub weight: Option, -} - -impl<'a> AnalyticsRuleUpdateParams<'a> { - pub fn new() -> Self { - Self { - destination_collection: None, - limit: None, - capture_search_requests: None, - meta_fields: None, - expand_query: None, - counter_field: None, - weight: None, - } - } -} From e50bffe22607b8d334c11900d26fdbe35e63db27 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Fri, 20 Mar 2026 00:05:45 +0700 Subject: [PATCH 7/9] rename `x-rust-has-borrowed-data` to `x-rust-has-lifetime`, remove unnecessary flag on string query param in processed oapi yml --- openapi-generator-template/model.mustache | 24 +- .../reqwest/api.mustache | 22 +- preprocessed_openapi.yml | 529 +++++------------- typesense_codegen/.openapi-generator/FILES | 2 + typesense_codegen/README.md | 1 + .../docs/NlSearchModelUpdateSchema.md | 29 + typesense_codegen/docs/NlSearchModelsApi.md | 4 +- .../src/apis/nl_search_models_api.rs | 4 +- typesense_codegen/src/models/mod.rs | 2 + .../models/nl_search_model_update_schema.rs | 100 ++++ xtask/src/preprocess_openapi.rs | 73 ++- 11 files changed, 345 insertions(+), 445 deletions(-) create mode 100644 typesense_codegen/docs/NlSearchModelUpdateSchema.md create mode 100644 typesense_codegen/src/models/nl_search_model_update_schema.rs diff --git a/openapi-generator-template/model.mustache b/openapi-generator-template/model.mustache index 41d178f3..e02e3b5a 100644 --- a/openapi-generator-template/model.mustache +++ b/openapi-generator-template/model.mustache @@ -129,7 +129,7 @@ impl Default for {{classname}} { {{/vendorExtensions.x-rust-builder}}{{! }}{{#vendorExtensions.x-rust-has-byte-array}}#[serde_as]{{/vendorExtensions.x-rust-has-byte-array}}{{! }}{{#oneOf.isEmpty}}#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct {{{classname}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-borrowed-data}} { +pub struct {{{classname}}}{{#vendorExtensions.x-rust-has-lifetime}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-lifetime}} { {{#vars}} {{#description}} /// {{{.}}} @@ -148,15 +148,15 @@ pub struct {{{classname}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#ve ### Enums }}{{#isEnum}}{{#isArray}}{{#uniqueItems}}std::collections::HashSet<{{/uniqueItems}}{{^uniqueItems}}Vec<{{/uniqueItems}}{{/isArray}}{{{enumName}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! ### Models - }}{{^isEnum}}{{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}{{! + }}{{^isEnum}}{{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{{dataType}}}{{#vendorExtensions.x-rust-has-lifetime}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/vendorExtensions.x-rust-has-lifetime}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}{{! ### ByteArray }}{{^isModel}}{{#isByteArray}}Vec{{/isByteArray}}{{! ### String - }}{{^isByteArray}}{{#isString}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}Cow<'a, str>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}String{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/isString}}{{! + }}{{^isByteArray}}{{#isString}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}Cow<'a, str>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}String{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/isString}}{{! ### Arrays }}{{^isString}}{{#isArray}}Vec<{{#items}}{{! ### Array Models - }}{{#isModel}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isModel}}{{! + }}{{#isModel}}{{{dataType}}}{{#vendorExtensions.x-rust-has-lifetime}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/vendorExtensions.x-rust-has-lifetime}}{{/isModel}}{{! ### Array other datatypes }}{{^isModel}}{{{dataType}}}{{/isModel}}{{/items}}>{{/isArray}}{{! ### Primitive datatypes @@ -171,8 +171,8 @@ pub struct {{{classname}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#ve {{/vars}} } -impl{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-borrowed-data}} {{! - }}{{{classname}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-borrowed-data}} { +impl{{#vendorExtensions.x-rust-has-lifetime}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-lifetime}} {{! + }}{{{classname}}}{{#vendorExtensions.x-rust-has-lifetime}}<'a{{#vendorExtensions.x-rust-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-generic-parameter}}>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}{{/vendorExtensions.x-rust-has-lifetime}} { {{#description}} /// {{{.}}} {{/description}} @@ -183,11 +183,11 @@ impl{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#vendorExtensions.x-rust- }}{{^vendorExtensions.x-rust-type}}{{#isNullable}}Option<{{/isNullable}}{{! }}{{#isEnum}}{{#isArray}}{{#uniqueItems}}std::collections::HashSet<{{/uniqueItems}}{{^uniqueItems}}Vec<{{/uniqueItems}}{{/isArray}}{{{enumName}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! }}{{^isEnum}}{{#isByteArray}}Vec{{/isByteArray}}{{! - }}{{^isByteArray}}{{#isString}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}Cow<'a, str>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}String{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/isString}}{{! + }}{{^isByteArray}}{{#isString}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}Cow<'a, str>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}String{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/isString}}{{! }}{{^isString}}{{#isArray}}Vec<{{#items}}{{! - }}{{#isModel}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isModel}}{{! + }}{{#isModel}}{{{dataType}}}{{#vendorExtensions.x-rust-has-lifetime}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/vendorExtensions.x-rust-has-lifetime}}{{/isModel}}{{! }}{{^isModel}}{{{dataType}}}{{/isModel}}{{/items}}>{{/isArray}}{{! - }}{{^isArray}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-borrowed-data}}{{#model}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/model}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isModel}}{{! + }}{{^isArray}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-lifetime}}{{#model}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/model}}{{/vendorExtensions.x-rust-has-lifetime}}{{/isModel}}{{! }}{{/isArray}}{{/isString}}{{/isByteArray}}{{/isEnum}}{{! }}{{#isNullable}}>{{/isNullable}}{{/vendorExtensions.x-rust-type}}{{! ### Comma for next arguement @@ -218,16 +218,16 @@ impl{{#vendorExtensions.x-rust-has-borrowed-data}}<'a{{#vendorExtensions.x-rust- {{/description}} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] -pub enum {{classname}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}} { +pub enum {{classname}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}} { {{#composedSchemas.oneOf}} {{#description}} /// {{{.}}} {{/description}} - {{{name}}}({{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{/isModel}}{{#isArray}}Vec<{{{items.dataType}}}{{#items.vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/items.vendorExtensions.x-rust-has-borrowed-data}}{{^items.vendorExtensions.x-rust-has-borrowed-data}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/items.vendorExtensions.x-rust-has-borrowed-data}}>{{/isArray}}{{^isArray}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'a>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isArray}}{{#isModel}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}), + {{{name}}}({{#isModel}}{{^avoidBoxedModels}}Box<{{/avoidBoxedModels}}{{/isModel}}{{#isArray}}Vec<{{{items.dataType}}}{{#items.vendorExtensions.x-rust-has-lifetime}}<'a>{{/items.vendorExtensions.x-rust-has-lifetime}}{{^items.vendorExtensions.x-rust-has-lifetime}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{/items.vendorExtensions.x-rust-has-lifetime}}>{{/isArray}}{{^isArray}}{{{dataType}}}{{#vendorExtensions.x-rust-has-lifetime}}<'a>{{/vendorExtensions.x-rust-has-lifetime}}{{/isArray}}{{#isModel}}{{^avoidBoxedModels}}>{{/avoidBoxedModels}}{{/isModel}}), {{/composedSchemas.oneOf}} } -impl Default for {{classname}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'_>{{/vendorExtensions.x-rust-has-borrowed-data}} { +impl Default for {{classname}}{{#vendorExtensions.x-rust-has-lifetime}}<'_>{{/vendorExtensions.x-rust-has-lifetime}} { fn default() -> Self { {{#composedSchemas.oneOf}}{{#-first}}Self::{{{name}}}(Default::default()){{/-first}}{{/composedSchemas.oneOf}} } diff --git a/openapi-generator-template/reqwest/api.mustache b/openapi-generator-template/reqwest/api.mustache index e1243b7e..e00ab73c 100644 --- a/openapi-generator-template/reqwest/api.mustache +++ b/openapi-generator-template/reqwest/api.mustache @@ -9,12 +9,11 @@ use serde::{Deserialize, Serialize, de::Error as _}; {{#operations}} {{#operation}} {{#vendorExtensions.x-group-parameters}} -{{#allParams}} -{{#-first}} +{{#hasParams}} /// struct for passing parameters to the method [`{{operationId}}`] #[derive(Clone, Debug)] -pub struct {{{operationIdCamelCase}}}Params{{#vendorExtensions.x-rust-has-borrowed-data}}<'p{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}>{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#allParams}}{{#-first}}{{#vendorExtensions.x-rust-params-generic-parameter}}<{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-first}}{{/allParams}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{#allParams}}{{#-last}}{{#vendorExtensions.x-rust-params-generic-parameter}}>{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}} { -{{/-first}} +pub struct {{{operationIdCamelCase}}}Params{{#vendorExtensions.x-rust-has-lifetime}}<'p{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}{{#allParams}}{{#-first}}{{#vendorExtensions.x-rust-params-generic-parameter}}<{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-first}}{{/allParams}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{#allParams}}{{#-last}}{{#vendorExtensions.x-rust-params-generic-parameter}}>{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-rust-has-lifetime}} { +{{#allParams}} {{#description}} /// {{{.}}} {{/description}} @@ -30,17 +29,16 @@ pub struct {{{operationIdCamelCase}}}Params{{#vendorExtensions.x-rust-has-borrow ### UUIDs }}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}String{{#isArray}}>{{/isArray}}{{/isUuid}}{{! ### Models and primitive types - }}{{^isString}}{{^isUuid}}{{#isArray}}Vec<{{#items}}{{^isPrimitiveType}}models::{{/isPrimitiveType}}{{{dataType}}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'p>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/items}}>{{/isArray}}{{^isArray}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{^isContainer}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'p>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isContainer}}{{/isArray}}{{/isUuid}}{{/isString}}{{! + }}{{^isString}}{{^isUuid}}{{#isArray}}Vec<{{#items}}{{^isPrimitiveType}}models::{{/isPrimitiveType}}{{{dataType}}}{{^isPrimitiveType}}{{^isEnum}}{{#vendorExtensions.x-rust-has-lifetime}}<'p>{{/vendorExtensions.x-rust-has-lifetime}}{{/isEnum}}{{/isPrimitiveType}}{{/items}}>{{/isArray}}{{^isArray}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{^isContainer}}{{^isPrimitiveType}}{{^isEnum}}{{#vendorExtensions.x-rust-has-lifetime}}<'p>{{/vendorExtensions.x-rust-has-lifetime}}{{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{/isArray}}{{/isUuid}}{{/isString}}{{! ### Option End }}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{! ### Comma for next arguement }}, {{/vendorExtensions.x-rust-type}} -{{#-last}} +{{/allParams}} } +{{/hasParams}} -{{/-last}} -{{/allParams}} {{/vendorExtensions.x-group-parameters}} {{/operation}} {{/operations}} @@ -98,16 +96,16 @@ pub enum {{{operationIdCamelCase}}}Error { /// {{{.}}} {{/notes}} {{#vendorExtensions.x-group-parameters}} -pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}(configuration: &configuration::Configuration{{#allParams}}{{#-first}}, {{! +pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}{{#vendorExtensions.x-rust-generic-parameter}}<{{{.}}}>{{/vendorExtensions.x-rust-generic-parameter}}(configuration: &configuration::Configuration{{#hasParams}}, {{! ### Params -}}params: &{{{operationIdCamelCase}}}Params<{{#vendorExtensions.x-rust-has-borrowed-data}}'_{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}}{{^vendorExtensions.x-rust-has-borrowed-data}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{/vendorExtensions.x-rust-has-borrowed-data}}>{{/-first}}{{/allParams}}{{! +}}params: &{{{operationIdCamelCase}}}Params{{#vendorExtensions.x-rust-has-lifetime}}<'_{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}, {{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}>{{/vendorExtensions.x-rust-has-lifetime}}{{^vendorExtensions.x-rust-has-lifetime}}{{#allParams}}{{#-first}}{{#vendorExtensions.x-rust-params-generic-parameter}}<{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-first}}{{/allParams}}{{#allParams}}{{#vendorExtensions.x-rust-params-generic-parameter}}{{{.}}}{{/vendorExtensions.x-rust-params-generic-parameter}}{{/allParams}}{{#allParams}}{{#-last}}{{#vendorExtensions.x-rust-params-generic-parameter}}>{{/vendorExtensions.x-rust-params-generic-parameter}}{{/-last}}{{/allParams}}{{/vendorExtensions.x-rust-has-lifetime}}{{/hasParams}}{{! ### Function return type }}) -> Result<{{#vendorExtensions.x-rust-return-type}}{{{.}}}{{/vendorExtensions.x-rust-return-type}}{{^vendorExtensions.x-rust-return-type}}{{! }}{{#isResponseFile}}{{#supportAsync}}reqwest::Response{{/supportAsync}}{{^supportAsync}}reqwest::blocking::Response{{/supportAsync}}{{/isResponseFile}}{{! }}{{^isResponseFile}}{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{! }}{{^returnType}}(){{/returnType}}{{! -}}{{#isArray}}Vec<{{#returnProperty.items}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isModel}}{{/returnProperty.items}}>{{/isArray}}{{! -}}{{^isArray}}{{#returnProperty}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-borrowed-data}}<'static>{{/vendorExtensions.x-rust-has-borrowed-data}}{{/isModel}}{{/returnProperty}}{{! +}}{{#isArray}}Vec<{{#returnProperty.items}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/isModel}}{{/returnProperty.items}}>{{/isArray}}{{! +}}{{^isArray}}{{#returnProperty}}{{{dataType}}}{{#isModel}}{{#vendorExtensions.x-rust-has-lifetime}}<'static>{{/vendorExtensions.x-rust-has-lifetime}}{{/isModel}}{{/returnProperty}}{{! }}{{/isArray}}{{/supportMultipleResponses}}{{/isResponseFile}}{{/vendorExtensions.x-rust-return-type}}, Error<{{{operationIdCamelCase}}}Error>> { {{/vendorExtensions.x-group-parameters}} let uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}crate::apis::urlencode(&{{/isString}}{{{vendorExtensions.x-rust-param-identifier}}}{{^required}}.unwrap(){{/required}}{{#required}}{{#isNullable}}.unwrap(){{/isNullable}}{{/required}}{{#isArray}}.join(",").as_ref(){{/isArray}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}.to_string(){{/isContainer}}{{/isPrimitiveType}}{{/isUuid}}{{/isString}}{{#isString}}){{/isString}}{{/pathParams}}); diff --git a/preprocessed_openapi.yml b/preprocessed_openapi.yml index 77b48505..b12ce6a3 100644 --- a/preprocessed_openapi.yml +++ b/preprocessed_openapi.yml @@ -98,8 +98,6 @@ paths: schema: type: string description: Comma-separated list of fields from the collection to exclude from the response - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: limit in: query schema: @@ -121,7 +119,7 @@ paths: items: $ref: '#/components/schemas/CollectionResponse' x-go-type: '[]*CollectionResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true post: tags: - collections @@ -135,8 +133,8 @@ paths: application/json: schema: $ref: '#/components/schemas/CollectionSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '201': description: Collection successfully created @@ -156,7 +154,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}: get: tags: @@ -171,8 +169,6 @@ paths: description: The name of the collection to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Collection fetched @@ -186,7 +182,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true patch: tags: - collections @@ -200,8 +196,6 @@ paths: description: The name of the collection to update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The document object with fields to be updated @@ -228,7 +222,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - collections @@ -242,8 +236,6 @@ paths: description: The name of the collection to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Collection deleted @@ -257,7 +249,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}/documents: post: tags: @@ -272,8 +264,6 @@ paths: description: The name of the collection to add the document to schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: action in: query description: Additional action to perform @@ -281,8 +271,8 @@ paths: type: string example: upsert $ref: '#/components/schemas/IndexAction' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true - name: dirty_values in: query description: Dealing with Dirty Data @@ -311,7 +301,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true patch: tags: - documents @@ -325,15 +315,11 @@ paths: description: The name of the collection to update documents in schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The document fields to be updated @@ -372,7 +358,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'B: Serialize' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - documents @@ -386,15 +372,11 @@ paths: description: The name of the collection to delete documents from schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: batch_size in: query schema: @@ -427,7 +409,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}/documents/search: get: tags: @@ -442,22 +424,16 @@ paths: description: The name of the collection to search for the document under schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: q in: query schema: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: query_by in: query schema: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: nl_query in: query schema: @@ -468,36 +444,26 @@ paths: schema: type: string description: The ID of the natural language model to use. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: query_by_weights in: query schema: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: text_match_type in: query schema: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: prefix in: query schema: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: infix in: query schema: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: max_extra_prefix in: query schema: @@ -514,8 +480,6 @@ paths: type: string description: Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: max_filter_by_candidates in: query schema: @@ -527,15 +491,11 @@ paths: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` example: num_employees:desc - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: facet_by in: query schema: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: max_facet_values in: query schema: @@ -546,16 +506,12 @@ paths: schema: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: num_typos in: query schema: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: page in: query schema: @@ -582,8 +538,6 @@ paths: schema: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: group_limit in: query schema: @@ -601,22 +555,16 @@ paths: schema: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_full_fields in: query schema: type: string description: List of fields which should be highlighted fully without snippeting - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_affix_num_tokens in: query schema: @@ -629,16 +577,12 @@ paths: type: string description: | The start tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_end_tag in: query schema: type: string description: | The end tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: enable_highlight_v1 in: query schema: @@ -665,8 +609,6 @@ paths: type: string description: List of synonym set names to associate with this search query example: synonym_set_1,synonym_set_2 - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: drop_tokens_threshold in: query schema: @@ -720,8 +662,6 @@ paths: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: hidden_hits in: query schema: @@ -729,31 +669,23 @@ paths: description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: override_tags in: query schema: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_fields in: query schema: type: string description: | A list of custom fields that must be highlighted even if you don't query for them - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: split_join_tokens in: query schema: type: string description: | Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: pre_segmented_query in: query schema: @@ -767,8 +699,6 @@ paths: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: enable_overrides in: query schema: @@ -852,8 +782,6 @@ paths: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: remote_embedding_timeout_ms in: query schema: @@ -872,32 +800,24 @@ paths: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: stopwords in: query schema: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: facet_return_parent in: query schema: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: voice_query in: query schema: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: conversation in: query schema: @@ -910,16 +830,12 @@ paths: type: string description: | The Id of Conversation Model to be used. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: conversation_id in: query schema: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Search results @@ -941,7 +857,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'D: for<''de> serde::Deserialize<''de> + Serialize' x-rust-return-type: models::SearchResult - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /synonym_sets: get: tags: @@ -972,8 +888,6 @@ paths: description: The name of the synonym set to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Synonym set fetched @@ -987,7 +901,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - synonyms @@ -1001,8 +915,6 @@ paths: description: The name of the synonym set to create/update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The synonym set to be created/updated @@ -1023,7 +935,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - synonyms @@ -1037,8 +949,6 @@ paths: description: The name of the synonym set to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Synonym set successfully deleted @@ -1052,7 +962,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /synonym_sets/{synonymSetName}/items: get: tags: @@ -1067,8 +977,6 @@ paths: description: The name of the synonym set to retrieve items for schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: List of synonym items @@ -1084,7 +992,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /synonym_sets/{synonymSetName}/items/{itemId}: get: tags: @@ -1099,16 +1007,12 @@ paths: description: The name of the synonym set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Synonym item fetched @@ -1122,7 +1026,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - synonyms @@ -1136,16 +1040,12 @@ paths: description: The name of the synonym set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to upsert schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The synonym item to be created/updated @@ -1153,8 +1053,8 @@ paths: application/json: schema: $ref: '#/components/schemas/SynonymItemUpsertSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Synonym item successfully created/updated @@ -1168,7 +1068,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - synonyms @@ -1182,16 +1082,12 @@ paths: description: The name of the synonym set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the synonym item to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Synonym item successfully deleted @@ -1205,7 +1101,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /curation_sets: get: tags: @@ -1236,8 +1132,6 @@ paths: description: The name of the curation set to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Curation set fetched @@ -1251,7 +1145,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - curation_sets @@ -1265,8 +1159,6 @@ paths: description: The name of the curation set to create/update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The curation set to be created/updated @@ -1274,8 +1166,8 @@ paths: application/json: schema: $ref: '#/components/schemas/CurationSetCreateSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Curation set successfully created/updated @@ -1289,7 +1181,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - curation_sets @@ -1303,8 +1195,6 @@ paths: description: The name of the curation set to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Curation set successfully deleted @@ -1318,7 +1208,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /curation_sets/{curationSetName}/items: get: tags: @@ -1333,8 +1223,6 @@ paths: description: The name of the curation set to retrieve items for schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: List of curation items @@ -1350,7 +1238,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /curation_sets/{curationSetName}/items/{itemId}: get: tags: @@ -1365,16 +1253,12 @@ paths: description: The name of the curation set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Curation item fetched @@ -1388,7 +1272,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - curation_sets @@ -1402,16 +1286,12 @@ paths: description: The name of the curation set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to upsert schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The curation item to be created/updated @@ -1432,7 +1312,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - curation_sets @@ -1446,16 +1326,12 @@ paths: description: The name of the curation set schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: itemId required: true in: path description: The id of the curation item to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Curation item successfully deleted @@ -1469,7 +1345,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}/documents/export: get: tags: @@ -1484,29 +1360,21 @@ paths: description: The name of the collection schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: filter_by in: query schema: type: string description: Filter conditions for refining your search results. Separate multiple conditions with &&. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: include_fields in: query schema: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Exports all the documents in a given collection. @@ -1525,7 +1393,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-supports-plain-text: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}/documents/import: post: tags: @@ -1540,8 +1408,6 @@ paths: description: The name of the collection schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: batch_size in: query schema: @@ -1575,8 +1441,6 @@ paths: schema: type: string description: The JSONL file to import - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Result of the import operation. Each line of the response indicates the result of each document present in the request body (in the same order). If the import of a single document fails, it does not affect the other documents. If there is a failure, the response line will include a corresponding error message and as well as the actual document content. @@ -1601,7 +1465,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-body-is-raw-text: true x-supports-plain-text: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /collections/{collectionName}/documents/{documentId}: get: tags: @@ -1616,16 +1480,12 @@ paths: description: The name of the collection to search for the document under schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: The document referenced by the ID @@ -1640,7 +1500,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true patch: tags: - documents @@ -1654,16 +1514,12 @@ paths: description: The name of the collection to search for the document under schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: dirty_values in: query description: Dealing with Dirty Data @@ -1695,7 +1551,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-generic-parameter: 'B: Serialize' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - documents @@ -1709,16 +1565,12 @@ paths: description: The name of the collection to search for the document under schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: documentId required: true in: path description: The Document ID schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: The document referenced by the ID was deleted @@ -1733,7 +1585,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /conversations/models: get: tags: @@ -1763,8 +1615,8 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelCreateSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '201': description: Created Conversation Model @@ -1778,7 +1630,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /conversations/models/{modelId}: get: tags: @@ -1793,8 +1645,6 @@ paths: description: The id of the conversation model to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: A conversation model @@ -1802,7 +1652,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - conversations @@ -1816,16 +1666,14 @@ paths: description: The id of the conversation model to update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ConversationModelUpdateSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: The conversation model was successfully updated @@ -1833,7 +1681,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - conversations @@ -1847,8 +1695,6 @@ paths: description: The id of the conversation model to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: The conversation model was successfully deleted @@ -1856,7 +1702,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ConversationModelSchema' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /keys: get: tags: @@ -1882,8 +1728,8 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiKeySchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '201': description: Created API key @@ -1903,7 +1749,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /keys/{keyId}: get: tags: @@ -1992,16 +1838,14 @@ paths: description: The name of the alias to create/update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: description: Collection alias to be created/updated content: application/json: schema: $ref: '#/components/schemas/CollectionAliasSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: The collection alias was created/updated @@ -2021,7 +1865,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true get: tags: - collections @@ -2035,8 +1879,6 @@ paths: description: The name of the alias to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Collection alias fetched @@ -2050,7 +1892,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - collections @@ -2063,8 +1905,6 @@ paths: description: The name of the alias to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Collection alias was deleted @@ -2078,7 +1918,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /debug: get: tags: @@ -2141,8 +1981,6 @@ paths: description: The directory on the server where the snapshot should be saved. schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '201': description: Snapshot is created. @@ -2150,7 +1988,7 @@ paths: application/json: schema: $ref: '#/components/schemas/SuccessStatus' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /operations/vote: post: tags: @@ -2232,43 +2070,31 @@ paths: schema: type: string description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: query_by in: query schema: type: string description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: query_by_weights in: query schema: type: string description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: text_match_type in: query schema: type: string description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: prefix in: query schema: type: string description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: infix in: query schema: type: string description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: max_extra_prefix in: query schema: @@ -2285,22 +2111,16 @@ paths: type: string description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: sort_by in: query schema: type: string description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: facet_by in: query schema: type: string description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: max_facet_values in: query schema: @@ -2311,16 +2131,12 @@ paths: schema: type: string description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: num_typos in: query schema: type: string description: | The number of typographical errors (1 or 2) that would be tolerated. Default: 2 - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: page in: query schema: @@ -2347,8 +2163,6 @@ paths: schema: type: string description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: group_limit in: query schema: @@ -2366,22 +2180,16 @@ paths: schema: type: string description: List of fields from the document to include in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: exclude_fields in: query schema: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_full_fields in: query schema: type: string description: List of fields which should be highlighted fully without snippeting - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_affix_num_tokens in: query schema: @@ -2394,16 +2202,12 @@ paths: type: string description: | The start tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_end_tag in: query schema: type: string description: | The end tag used for the highlighted snippets. Default: `` - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: snippet_threshold in: query schema: @@ -2470,8 +2274,6 @@ paths: description: | A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: hidden_hits in: query schema: @@ -2479,23 +2281,17 @@ paths: description: | A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: override_tags in: query schema: type: string description: Comma separated list of tags to trigger the curations rules that match the tags. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: highlight_fields in: query schema: type: string description: | A list of custom fields that must be highlighted even if you don't query for them - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: pre_segmented_query in: query schema: @@ -2510,8 +2306,6 @@ paths: type: string description: | Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: enable_overrides in: query schema: @@ -2589,8 +2383,6 @@ paths: type: string description: | Vector query expression for fetching documents "closest" to a given query/document vector. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: remote_embedding_timeout_ms in: query schema: @@ -2609,32 +2401,24 @@ paths: type: string description: | Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: stopwords in: query schema: type: string description: | Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: facet_return_parent in: query schema: type: string description: | Comma separated string of nested facet fields whose parent object should be returned in facet response. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: voice_query in: query schema: type: string description: | The base64 encoded audio file in 16 khz 16-bit WAV format. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: conversation in: query schema: @@ -2647,23 +2431,19 @@ paths: type: string description: | The Id of Conversation Model to be used. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: conversation_id in: query schema: type: string description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: content: application/json: schema: $ref: '#/components/schemas/MultiSearchSearchesParameter' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Search results @@ -2678,7 +2458,7 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' x-rust-return-type: serde_json::Value - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /analytics/events: post: tags: @@ -2693,8 +2473,8 @@ paths: application/json: schema: $ref: '#/components/schemas/AnalyticsEvent' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Analytics event successfully created @@ -2708,7 +2488,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true get: tags: - analytics @@ -2721,16 +2501,12 @@ paths: in: query schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: name required: true in: query description: Analytics rule name schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - name: n required: true in: query @@ -2750,7 +2526,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /analytics/flush: post: tags: @@ -2794,14 +2570,14 @@ paths: schema: oneOf: - $ref: '#/components/schemas/AnalyticsRuleCreate' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true - type: array items: $ref: '#/components/schemas/AnalyticsRuleCreate' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Analytics rule(s) successfully created @@ -2824,7 +2600,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true get: tags: - analytics @@ -2838,8 +2614,6 @@ paths: description: Filter rules by rule_tag schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Analytics rules fetched @@ -2849,7 +2623,7 @@ paths: type: array items: $ref: '#/components/schemas/AnalyticsRule' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /analytics/rules/{ruleName}: put: tags: @@ -2864,8 +2638,6 @@ paths: description: The name of the analytics rule to upsert schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The Analytics rule to be upserted @@ -2873,8 +2645,8 @@ paths: application/json: schema: $ref: '#/components/schemas/AnalyticsRuleUpdate' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Analytics rule successfully upserted @@ -2888,7 +2660,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true get: tags: - analytics @@ -2902,8 +2674,6 @@ paths: description: The name of the analytics rule to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Analytics rule fetched @@ -2917,7 +2687,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - analytics @@ -2931,8 +2701,6 @@ paths: description: The name of the analytics rule to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Analytics rule deleted @@ -2946,7 +2714,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /metrics.json: get: tags: @@ -3003,9 +2771,7 @@ paths: description: The ID of the stopwords set to upsert. schema: type: string - x-rust-has-borrowed-data: true example: countries - x-rust-has-borrowed-data: true requestBody: required: true description: The stopwords set to upsert. @@ -3013,8 +2779,8 @@ paths: application/json: schema: $ref: '#/components/schemas/StopwordsSetUpsertSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Stopwords set successfully upserted. @@ -3028,7 +2794,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true get: tags: - stopwords @@ -3042,9 +2808,7 @@ paths: description: The ID of the stopwords set to retrieve. schema: type: string - x-rust-has-borrowed-data: true example: countries - x-rust-has-borrowed-data: true responses: '200': description: Stopwords set fetched. @@ -3058,7 +2822,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - stopwords @@ -3072,9 +2836,7 @@ paths: description: The ID of the stopwords set to delete. schema: type: string - x-rust-has-borrowed-data: true example: countries - x-rust-has-borrowed-data: true responses: '200': description: Stopwords set rule deleted. @@ -3095,7 +2857,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /presets: get: tags: @@ -3124,9 +2886,7 @@ paths: description: The ID of the preset to retrieve. schema: type: string - x-rust-has-borrowed-data: true example: listing_view - x-rust-has-borrowed-data: true responses: '200': description: Preset fetched. @@ -3140,7 +2900,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - presets @@ -3154,9 +2914,7 @@ paths: description: The name of the preset set to upsert. schema: type: string - x-rust-has-borrowed-data: true example: listing_view - x-rust-has-borrowed-data: true requestBody: required: true description: The stopwords set to upsert. @@ -3164,8 +2922,8 @@ paths: application/json: schema: $ref: '#/components/schemas/PresetUpsertSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: Preset successfully upserted. @@ -3179,7 +2937,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - presets @@ -3193,9 +2951,7 @@ paths: description: The ID of the preset to delete. schema: type: string - x-rust-has-borrowed-data: true example: listing_view - x-rust-has-borrowed-data: true responses: '200': description: Preset deleted. @@ -3209,7 +2965,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /stemming/dictionaries: get: tags: @@ -3246,9 +3002,7 @@ paths: description: The ID of the dictionary to retrieve schema: type: string - x-rust-has-borrowed-data: true example: irregular-plurals - x-rust-has-borrowed-data: true responses: '200': description: Stemming dictionary details @@ -3262,7 +3016,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /stemming/dictionaries/import: post: tags: @@ -3277,9 +3031,7 @@ paths: description: The ID to assign to the dictionary schema: type: string - x-rust-has-borrowed-data: true example: irregular-plurals - x-rust-has-borrowed-data: true requestBody: required: true description: The JSONL file containing word mappings @@ -3290,8 +3042,6 @@ paths: example: | {"word": "people", "root": "person"} {"word": "children", "root": "child"} - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: Dictionary successfully imported @@ -3309,7 +3059,7 @@ paths: $ref: '#/components/schemas/ApiResponse' x-rust-body-is-raw-text: true x-supports-plain-text: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /nl_search_models: get: tags: @@ -3339,8 +3089,8 @@ paths: application/json: schema: $ref: '#/components/schemas/NLSearchModelCreateSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '201': description: NL search model successfully created @@ -3354,7 +3104,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true /nl_search_models/{modelId}: get: tags: @@ -3369,8 +3119,6 @@ paths: description: The ID of the NL search model to retrieve schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: NL search model fetched @@ -3384,7 +3132,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true put: tags: - nl_search_models @@ -3398,8 +3146,6 @@ paths: description: The ID of the NL search model to update schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true requestBody: required: true description: The NL search model fields to update @@ -3407,8 +3153,8 @@ paths: application/json: schema: $ref: '#/components/schemas/NLSearchModelUpdateSchema' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true responses: '200': description: NL search model successfully updated @@ -3428,7 +3174,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true delete: tags: - nl_search_models @@ -3442,8 +3188,6 @@ paths: description: The ID of the NL search model to delete schema: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true responses: '200': description: NL search model successfully deleted @@ -3457,7 +3201,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponse' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true components: schemas: CollectionSchema: @@ -3499,14 +3243,14 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true synonym_sets: type: array description: List of synonym set names to associate with this collection items: type: string example: synonym_set_1 - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true enable_nested_fields: type: boolean default: false @@ -3521,7 +3265,7 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true voice_query_model: $ref: '#/components/schemas/VoiceQueryModelCollectionConfig' metadata: @@ -3529,7 +3273,7 @@ components: description: | Optional details about the collection, e.g., when it was created, who created it etc. x-rust-builder: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true CollectionUpdateSchema: type: object required: @@ -3710,7 +3454,7 @@ components: collection_name: type: string description: Name of the collection you wish to map the alias to - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true CollectionAlias: type: object required: @@ -4047,16 +3791,16 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true collections: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true expires_at: type: integer format: int64 - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true ApiKey: allOf: - $ref: '#/components/schemas/ApiKeySchema' @@ -4388,7 +4132,7 @@ components: description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. x-rust-builder: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true MultiSearchParameters: type: object description: | @@ -4639,7 +4383,7 @@ components: description: | The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. x-rust-builder: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true MultiSearchSearchesParameter: type: object required: @@ -4653,9 +4397,9 @@ components: type: array items: $ref: '#/components/schemas/MultiSearchCollectionParameters' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true MultiSearchCollectionParameters: allOf: - $ref: '#/components/schemas/MultiSearchParameters' @@ -4674,7 +4418,7 @@ components: When true, computes both text match and vector distance scores for all matches in hybrid search. Documents found only through keyword search will get a vector distance score, and documents found only through vector search will get a text match score. default: false x-rust-builder: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true FacetCounts: type: object properties: @@ -4742,13 +4486,13 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true q: type: string analytics_tag: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true AnalyticsEventsResponse: type: object required: @@ -4809,15 +4553,15 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true expand_query: type: boolean counter_field: type: string weight: type: integer - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true AnalyticsRuleType: type: string enum: @@ -4846,15 +4590,15 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true expand_query: type: boolean counter_field: type: string weight: type: integer - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true AnalyticsRule: allOf: - $ref: '#/components/schemas/AnalyticsRuleCreate' @@ -4929,10 +4673,10 @@ components: type: array items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true locale: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true StopwordsSetSchema: type: object required: @@ -4976,11 +4720,11 @@ components: value: oneOf: - $ref: '#/components/schemas/SearchParameters' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true - $ref: '#/components/schemas/MultiSearchSearchesParameter' - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true PresetSchema: allOf: - $ref: '#/components/schemas/PresetUpsertSchema' @@ -5051,7 +4795,7 @@ components: history_collection: type: string description: Typesense collection that stores the historical conversations - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true ConversationModelUpdateSchema: type: object properties: @@ -5084,7 +4828,7 @@ components: vllm_url: type: string description: URL of vLLM service - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true ConversationModelSchema: allOf: - $ref: '#/components/schemas/ConversationModelCreateSchema' @@ -5154,7 +4898,7 @@ components: description: Stop sequences for the NL model (Google-specific) items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true api_version: type: string description: API version for the NL model service @@ -5182,7 +4926,7 @@ components: account_id: type: string description: Account ID for Cloudflare-specific models - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true NLSearchModelCreateSchema: allOf: - $ref: '#/components/schemas/NLSearchModelBase' @@ -5191,7 +4935,7 @@ components: id: type: string description: Optional ID for the NL search model - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true NLSearchModelSchema: allOf: - $ref: '#/components/schemas/NLSearchModelCreateSchema' @@ -5203,8 +4947,9 @@ components: type: string description: ID of the NL search model NLSearchModelUpdateSchema: - $ref: '#/components/schemas/NLSearchModelCreateSchema' - x-rust-has-borrowed-data: true + allOf: + - $ref: '#/components/schemas/NLSearchModelCreateSchema' + x-rust-has-lifetime: true NLSearchModelDeleteSchema: type: object required: @@ -5223,7 +4968,7 @@ components: description: Array of words that should be considered as synonyms items: type: string - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true root: type: string description: For 1-way synonyms, indicates the root word that words in the synonyms parameter map to @@ -5235,8 +4980,8 @@ components: description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is items: type: string - x-rust-has-borrowed-data: true - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true + x-rust-has-lifetime: true SynonymItemSchema: allOf: - type: object @@ -5371,7 +5116,7 @@ components: description: type: string description: Optional description for the curation set - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true CurationSetSchema: allOf: - $ref: '#/components/schemas/CurationSetCreateSchema' @@ -5467,14 +5212,14 @@ components: exclude_fields: type: string description: List of fields from the document to exclude in the search result - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true UpdateDocumentsParameters: type: object properties: filter_by: type: string example: 'num_employees:>100 && country: [USA, UK]' - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true DeleteDocumentsParameters: type: object required: @@ -5491,7 +5236,7 @@ components: truncate: type: boolean description: When true, removes all documents from the collection while preserving the collection and its schema. - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true GetCollectionsParameters: type: object properties: @@ -5505,7 +5250,7 @@ components: offset: type: integer description: Identifies the starting point to return collections when paginating. - x-rust-has-borrowed-data: true + x-rust-has-lifetime: true securitySchemes: api_key_header: type: apiKey diff --git a/typesense_codegen/.openapi-generator/FILES b/typesense_codegen/.openapi-generator/FILES index 3b12b38f..59ee81c0 100644 --- a/typesense_codegen/.openapi-generator/FILES +++ b/typesense_codegen/.openapi-generator/FILES @@ -73,6 +73,7 @@ docs/NlSearchModelBase.md docs/NlSearchModelCreateSchema.md docs/NlSearchModelDeleteSchema.md docs/NlSearchModelSchema.md +docs/NlSearchModelUpdateSchema.md docs/NlSearchModelsApi.md docs/OperationsApi.md docs/PresetDeleteSchema.md @@ -200,6 +201,7 @@ src/models/nl_search_model_base.rs src/models/nl_search_model_create_schema.rs src/models/nl_search_model_delete_schema.rs src/models/nl_search_model_schema.rs +src/models/nl_search_model_update_schema.rs src/models/preset_delete_schema.rs src/models/preset_schema.rs src/models/preset_upsert_schema.rs diff --git a/typesense_codegen/README.md b/typesense_codegen/README.md index dd7acf1f..a245a8d7 100644 --- a/typesense_codegen/README.md +++ b/typesense_codegen/README.md @@ -175,6 +175,7 @@ Class | Method | HTTP request | Description - [NlSearchModelCreateSchema](docs/NlSearchModelCreateSchema.md) - [NlSearchModelDeleteSchema](docs/NlSearchModelDeleteSchema.md) - [NlSearchModelSchema](docs/NlSearchModelSchema.md) + - [NlSearchModelUpdateSchema](docs/NlSearchModelUpdateSchema.md) - [PresetDeleteSchema](docs/PresetDeleteSchema.md) - [PresetSchema](docs/PresetSchema.md) - [PresetUpsertSchema](docs/PresetUpsertSchema.md) diff --git a/typesense_codegen/docs/NlSearchModelUpdateSchema.md b/typesense_codegen/docs/NlSearchModelUpdateSchema.md new file mode 100644 index 00000000..10a8894b --- /dev/null +++ b/typesense_codegen/docs/NlSearchModelUpdateSchema.md @@ -0,0 +1,29 @@ +# NlSearchModelUpdateSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**model_name** | Option<**String**> | Name of the NL model to use | [optional] +**api_key** | Option<**String**> | API key for the NL model service | [optional] +**api_url** | Option<**String**> | Custom API URL for the NL model service | [optional] +**max_bytes** | Option<**i32**> | Maximum number of bytes to process | [optional] +**temperature** | Option<**f64**> | Temperature parameter for the NL model | [optional] +**system_prompt** | Option<**String**> | System prompt for the NL model | [optional] +**top_p** | Option<**f64**> | Top-p parameter for the NL model (Google-specific) | [optional] +**top_k** | Option<**i32**> | Top-k parameter for the NL model (Google-specific) | [optional] +**stop_sequences** | Option<**Vec**> | Stop sequences for the NL model (Google-specific) | [optional] +**api_version** | Option<**String**> | API version for the NL model service | [optional] +**project_id** | Option<**String**> | Project ID for GCP Vertex AI | [optional] +**access_token** | Option<**String**> | Access token for GCP Vertex AI | [optional] +**refresh_token** | Option<**String**> | Refresh token for GCP Vertex AI | [optional] +**client_id** | Option<**String**> | Client ID for GCP Vertex AI | [optional] +**client_secret** | Option<**String**> | Client secret for GCP Vertex AI | [optional] +**region** | Option<**String**> | Region for GCP Vertex AI | [optional] +**max_output_tokens** | Option<**i32**> | Maximum output tokens for GCP Vertex AI | [optional] +**account_id** | Option<**String**> | Account ID for Cloudflare-specific models | [optional] +**id** | Option<**String**> | Optional ID for the NL search model | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/typesense_codegen/docs/NlSearchModelsApi.md b/typesense_codegen/docs/NlSearchModelsApi.md index 07d54480..49e922ee 100644 --- a/typesense_codegen/docs/NlSearchModelsApi.md +++ b/typesense_codegen/docs/NlSearchModelsApi.md @@ -131,7 +131,7 @@ Name | Type | Description | Required | Notes ## update_nl_search_model -> models::NlSearchModelSchema update_nl_search_model(model_id, body) +> models::NlSearchModelSchema update_nl_search_model(model_id, nl_search_model_update_schema) Update a NL search model Update an existing NL search model. @@ -142,7 +142,7 @@ Update an existing NL search model. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **model_id** | **String** | The ID of the NL search model to update | [required] | -**body** | **models::NlSearchModelCreateSchema** | The NL search model fields to update | [required] | +**nl_search_model_update_schema** | [**NlSearchModelUpdateSchema**](NlSearchModelUpdateSchema.md) | The NL search model fields to update | [required] | ### Return type diff --git a/typesense_codegen/src/apis/nl_search_models_api.rs b/typesense_codegen/src/apis/nl_search_models_api.rs index eef9fa05..317f0412 100644 --- a/typesense_codegen/src/apis/nl_search_models_api.rs +++ b/typesense_codegen/src/apis/nl_search_models_api.rs @@ -41,7 +41,7 @@ pub struct UpdateNlSearchModelParams<'p> { /// The ID of the NL search model to update pub model_id: Cow<'p, str>, /// The NL search model fields to update - pub body: models::NlSearchModelCreateSchema<'p>, + pub nl_search_model_update_schema: models::NlSearchModelUpdateSchema<'p>, } /// struct for typed errors of method [`create_nl_search_model`] @@ -347,7 +347,7 @@ pub async fn update_nl_search_model( }; req_builder = req_builder.header("X-TYPESENSE-API-KEY", value); }; - req_builder = req_builder.json(¶ms.body); + req_builder = req_builder.json(¶ms.nl_search_model_update_schema); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; diff --git a/typesense_codegen/src/models/mod.rs b/typesense_codegen/src/models/mod.rs index a02d0e0d..0b29576f 100644 --- a/typesense_codegen/src/models/mod.rs +++ b/typesense_codegen/src/models/mod.rs @@ -130,6 +130,8 @@ pub mod nl_search_model_delete_schema; pub use self::nl_search_model_delete_schema::NlSearchModelDeleteSchema; pub mod nl_search_model_schema; pub use self::nl_search_model_schema::NlSearchModelSchema; +pub mod nl_search_model_update_schema; +pub use self::nl_search_model_update_schema::NlSearchModelUpdateSchema; pub mod preset_delete_schema; pub use self::preset_delete_schema::PresetDeleteSchema; pub mod preset_schema; diff --git a/typesense_codegen/src/models/nl_search_model_update_schema.rs b/typesense_codegen/src/models/nl_search_model_update_schema.rs new file mode 100644 index 00000000..2a1d2dec --- /dev/null +++ b/typesense_codegen/src/models/nl_search_model_update_schema.rs @@ -0,0 +1,100 @@ +/* + * Typesense API + * + * An open source search engine for building delightful search experiences. + * + * The version of the OpenAPI document: 30.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use ::std::borrow::Cow; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct NlSearchModelUpdateSchema<'a> { + /// Name of the NL model to use + #[serde(rename = "model_name", skip_serializing_if = "Option::is_none")] + pub model_name: Option>, + /// API key for the NL model service + #[serde(rename = "api_key", skip_serializing_if = "Option::is_none")] + pub api_key: Option>, + /// Custom API URL for the NL model service + #[serde(rename = "api_url", skip_serializing_if = "Option::is_none")] + pub api_url: Option>, + /// Maximum number of bytes to process + #[serde(rename = "max_bytes", skip_serializing_if = "Option::is_none")] + pub max_bytes: Option, + /// Temperature parameter for the NL model + #[serde(rename = "temperature", skip_serializing_if = "Option::is_none")] + pub temperature: Option, + /// System prompt for the NL model + #[serde(rename = "system_prompt", skip_serializing_if = "Option::is_none")] + pub system_prompt: Option>, + /// Top-p parameter for the NL model (Google-specific) + #[serde(rename = "top_p", skip_serializing_if = "Option::is_none")] + pub top_p: Option, + /// Top-k parameter for the NL model (Google-specific) + #[serde(rename = "top_k", skip_serializing_if = "Option::is_none")] + pub top_k: Option, + /// Stop sequences for the NL model (Google-specific) + #[serde(rename = "stop_sequences", skip_serializing_if = "Option::is_none")] + pub stop_sequences: Option>, + /// API version for the NL model service + #[serde(rename = "api_version", skip_serializing_if = "Option::is_none")] + pub api_version: Option>, + /// Project ID for GCP Vertex AI + #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] + pub project_id: Option>, + /// Access token for GCP Vertex AI + #[serde(rename = "access_token", skip_serializing_if = "Option::is_none")] + pub access_token: Option>, + /// Refresh token for GCP Vertex AI + #[serde(rename = "refresh_token", skip_serializing_if = "Option::is_none")] + pub refresh_token: Option>, + /// Client ID for GCP Vertex AI + #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")] + pub client_id: Option>, + /// Client secret for GCP Vertex AI + #[serde(rename = "client_secret", skip_serializing_if = "Option::is_none")] + pub client_secret: Option>, + /// Region for GCP Vertex AI + #[serde(rename = "region", skip_serializing_if = "Option::is_none")] + pub region: Option>, + /// Maximum output tokens for GCP Vertex AI + #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] + pub max_output_tokens: Option, + /// Account ID for Cloudflare-specific models + #[serde(rename = "account_id", skip_serializing_if = "Option::is_none")] + pub account_id: Option>, + /// Optional ID for the NL search model + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option>, +} + +impl<'a> NlSearchModelUpdateSchema<'a> { + pub fn new() -> Self { + Self { + model_name: None, + api_key: None, + api_url: None, + max_bytes: None, + temperature: None, + system_prompt: None, + top_p: None, + top_k: None, + stop_sequences: None, + api_version: None, + project_id: None, + access_token: None, + refresh_token: None, + client_id: None, + client_secret: None, + region: None, + max_output_tokens: None, + account_id: None, + id: None, + } + } +} diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index 81e26167..1c604d05 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -212,24 +212,27 @@ pub fn preprocess_openapi_file( } impl OpenAPIProperty { + // Helper to determine if a schema is a structure that requires a <'a> or <'p> generic in Rust + fn is_structural(&self) -> bool { + self.r#type.as_deref() == Some("object") + || self.r#type.as_deref() == Some("array") + || self.r#ref.is_some() + || self.one_of.is_some() + || self.any_of.is_some() + || self.extra.contains_key("allOf") + } + fn mark_borrowed_property_recursive( &mut self, schemas: &IndexMap, response_schemas: &std::collections::HashSet, ) { let mut visited = std::collections::HashSet::new(); - if property_contains_string(self, schemas, &mut visited, response_schemas) { // only flag structures that need a Rust <'a> lifetime e.g. objects, arrays,... - let is_structural = self.r#type.as_deref() == Some("object") - || self.r#type.as_deref() == Some("array") - || self.r#ref.is_some() - || self.one_of.is_some() - || self.any_of.is_some(); - - if is_structural { + if self.is_structural() { self.extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + .insert("x-rust-has-lifetime".to_owned(), Value::Bool(true)); } } @@ -316,14 +319,18 @@ impl OpenAPI { &schemas_ref, &response_schemas, ); - schema.extra.insert( - "x-rust-has-borrowed-data".to_owned(), - Value::Bool(true), - ); - parameter.extra.insert( - "x-rust-has-borrowed-data".to_owned(), - Value::Bool(true), - ); + + // only flag the schema and parameter if it is structural (object/arrays) + if schema.is_structural() { + schema.extra.insert( + "x-rust-has-lifetime".to_owned(), + Value::Bool(true), + ); + parameter.extra.insert( + "x-rust-has-lifetime".to_owned(), + Value::Bool(true), + ); + } operation_has_borrowed_data = true; } } @@ -348,11 +355,14 @@ impl OpenAPI { &schemas_ref, &response_schemas, ); - schema.extra.insert( - "x-rust-has-borrowed-data".to_owned(), - Value::Bool(true), - ); - request_body_has_borrowed_data = true; + + if schema.is_structural() { + schema.extra.insert( + "x-rust-has-lifetime".to_owned(), + Value::Bool(true), + ); + request_body_has_borrowed_data = true; + } } } }) @@ -360,7 +370,7 @@ impl OpenAPI { if request_body_has_borrowed_data { request_body .extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + .insert("x-rust-has-lifetime".to_owned(), Value::Bool(true)); operation_has_borrowed_data = true; } } @@ -368,7 +378,7 @@ impl OpenAPI { if operation_has_borrowed_data { operation .extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + .insert("x-rust-has-lifetime".to_owned(), Value::Bool(true)); } }) }); @@ -411,9 +421,22 @@ impl OpenAPI { continue; }; + // prevent OpenAPI generator from dropping flags on pure $ref aliases + // We wrap pure $refs in an `allOf` so the generator keeps the vendor extensions. + if let Some(r) = schema.r#ref.take() { + let all_of_item = OpenAPIProperty { + r#ref: Some(r), + ..Default::default() + }; + schema.extra.insert( + "allOf".to_owned(), + serde_yaml::to_value(vec![all_of_item]).unwrap(), + ); + } + schema .extra - .insert("x-rust-has-borrowed-data".to_owned(), Value::Bool(true)); + .insert("x-rust-has-lifetime".to_owned(), Value::Bool(true)); schema.mark_borrowed_property_recursive(&schemas_ref, &response_schemas); } } From a898ce41f7954e6b9312d99c5fac70e5c1f525a0 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Fri, 20 Mar 2026 11:52:44 +0700 Subject: [PATCH 8/9] fix edge case array of string and string enum have unnecessary `x-rust-has-lifetime` --- preprocessed_openapi.yml | 14 -------------- xtask/src/mark_borrowed_data.rs | 6 +++++- xtask/src/preprocess_openapi.rs | 3 ++- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/preprocessed_openapi.yml b/preprocessed_openapi.yml index b12ce6a3..671dc61c 100644 --- a/preprocessed_openapi.yml +++ b/preprocessed_openapi.yml @@ -271,8 +271,6 @@ paths: type: string example: upsert $ref: '#/components/schemas/IndexAction' - x-rust-has-lifetime: true - x-rust-has-lifetime: true - name: dirty_values in: query description: Dealing with Dirty Data @@ -3243,14 +3241,12 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-lifetime: true synonym_sets: type: array description: List of synonym set names to associate with this collection items: type: string example: synonym_set_1 - x-rust-has-lifetime: true enable_nested_fields: type: boolean default: false @@ -3265,7 +3261,6 @@ components: type: string minLength: 1 maxLength: 1 - x-rust-has-lifetime: true voice_query_model: $ref: '#/components/schemas/VoiceQueryModelCollectionConfig' metadata: @@ -3791,12 +3786,10 @@ components: type: array items: type: string - x-rust-has-lifetime: true collections: type: array items: type: string - x-rust-has-lifetime: true expires_at: type: integer format: int64 @@ -4486,7 +4479,6 @@ components: type: array items: type: string - x-rust-has-lifetime: true q: type: string analytics_tag: @@ -4553,7 +4545,6 @@ components: type: array items: type: string - x-rust-has-lifetime: true expand_query: type: boolean counter_field: @@ -4590,7 +4581,6 @@ components: type: array items: type: string - x-rust-has-lifetime: true expand_query: type: boolean counter_field: @@ -4673,7 +4663,6 @@ components: type: array items: type: string - x-rust-has-lifetime: true locale: type: string x-rust-has-lifetime: true @@ -4898,7 +4887,6 @@ components: description: Stop sequences for the NL model (Google-specific) items: type: string - x-rust-has-lifetime: true api_version: type: string description: API version for the NL model service @@ -4968,7 +4956,6 @@ components: description: Array of words that should be considered as synonyms items: type: string - x-rust-has-lifetime: true root: type: string description: For 1-way synonyms, indicates the root word that words in the synonyms parameter map to @@ -4980,7 +4967,6 @@ components: description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is items: type: string - x-rust-has-lifetime: true x-rust-has-lifetime: true SynonymItemSchema: allOf: diff --git a/xtask/src/mark_borrowed_data.rs b/xtask/src/mark_borrowed_data.rs index 040ea583..2af22025 100644 --- a/xtask/src/mark_borrowed_data.rs +++ b/xtask/src/mark_borrowed_data.rs @@ -164,7 +164,11 @@ pub(crate) fn property_contains_string( let is_enum = property.extra.contains_key("enum"); let is_uuid = property.extra.get("format").and_then(|v| v.as_str()) == Some("uuid"); - if property.r#type.as_deref() == Some("string") && !is_enum && !is_uuid { + if property.r#type.as_deref() == Some("string") + && !is_enum + && !is_uuid + && property.r#ref.is_none() + { return true; } diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index 1c604d05..b4266449 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -215,11 +215,12 @@ impl OpenAPIProperty { // Helper to determine if a schema is a structure that requires a <'a> or <'p> generic in Rust fn is_structural(&self) -> bool { self.r#type.as_deref() == Some("object") - || self.r#type.as_deref() == Some("array") || self.r#ref.is_some() || self.one_of.is_some() || self.any_of.is_some() || self.extra.contains_key("allOf") + // Only flag arrays if their inner items are structural (ignores arrays of primitive strings) + || (self.r#type.as_deref() == Some("array") && self.items.as_deref().map_or(false, |i| i.is_structural())) } fn mark_borrowed_property_recursive( From 12acf916b0331f4342f314ba668c489af24be881 Mon Sep 17 00:00:00 2001 From: Hayden Hung Hoang Date: Fri, 20 Mar 2026 12:43:21 +0700 Subject: [PATCH 9/9] fix lint --- xtask/src/preprocess_openapi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/preprocess_openapi.rs b/xtask/src/preprocess_openapi.rs index b4266449..a44d710c 100644 --- a/xtask/src/preprocess_openapi.rs +++ b/xtask/src/preprocess_openapi.rs @@ -220,7 +220,7 @@ impl OpenAPIProperty { || self.any_of.is_some() || self.extra.contains_key("allOf") // Only flag arrays if their inner items are structural (ignores arrays of primitive strings) - || (self.r#type.as_deref() == Some("array") && self.items.as_deref().map_or(false, |i| i.is_structural())) + || (self.r#type.as_deref() == Some("array") && self.items.as_deref().is_some_and(|i| i.is_structural())) } fn mark_borrowed_property_recursive(