From 2f460affd85743253b4f6fbb81dc9262718ea5dc Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 7 Jul 2026 22:18:50 +0200 Subject: [PATCH] [ruby-idiomatic] Add new idiomatic Ruby client generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `ruby-idiomatic`, a new opt-in Ruby client generator that emits modern, DRY, multi-instance Ruby. It mirrors the Crystal idiomatic redesign as a SEPARATE generator: the existing `ruby` generator, its templates, and its samples are left byte-for-byte unchanged, so users opt in and migrate when they choose. Highlights: - Namespaced sub-clients (`client.dcim.cable_terminations.list`) via a path->route helper (RubyApiRouting) and a hybrid module nesting (moduleName + configurable `apiNamespace` wrapper, resource leaf compact). - A single `Connection#call` choke-point (Faraday) — keyword args everywhere, no `_with_http_info` twins; a delegating `Response` and one rich `ApiError` (all Faraday errors wrapped); per-request auth (header/query/cookie apiKey, basic, bearer) so token refresh/rotation works; a `Configuration#use` Faraday-middleware seam for request signing. - Native multi-instance: a `Client` facade owns a per-instance Configuration/Connection — no global singleton. - Models on a declarative `attribute` DSL + shared `Serializable`/`Validations` mixins; recursive `from_hash` deserializes nested models/arrays/maps/unions/ enums; `additionalProperties` preserved; anyOf/oneOf via a `Polymorphism` helper; array minItems/maxItems validated; numeric enums bare. - Names are always legal Ruby: enum constants and method names derived from digit-leading values/paths get an `N`/`call_` prefix, purely-symbolic enum values (telephony IVR keys `#`/`*`, ...) map to word names, and deeply-nested inline model names are shortened with a deterministic hash suffix to stay under tar's 100-byte path-component limit so `gem build` succeeds. - Class loading via Zeitwerk. A nested `moduleName` (e.g. `Ovh::Api`) is supported: the parent modules are predefined, the loader is driven explicitly, the gemspec reads VERSION by regex, and version.rb is required rather than autoloaded. Acronym names in both model and API resource classes (HTTPConfig, IPRestriction, DedicatedCloud::TwoFAWhitelist, ...) register explicit Zeitwerk inflections from the gem entrypoint so autoloading resolves the real constant instead of raising Zeitwerk::NameError. - Faraday only; form/multipart (incl. file upload); Ruby 3.0 floor; frozen_string_literal on every generated Ruby file; single-quoted strings; path params percent-encoded; FeatureSet declared honestly (JSON only, no XML, allOf/anyOf/oneOf/Union, apiKey/basic/bearer). - Generated gem passes RuboCop clean out of the box: a real `.rubocop.yml` (rubocop-performance/rake/rspec), a modern gemspec with configurable gem* options (author/homepage/summary/license, MIT-aware LICENSE), LICENSE, dev deps + binstubs, `.rspec`, spec_helper (SimpleCov), a commented `.gitignore`, a GitHub Actions CI workflow, and meaningful RSpec. Generated runtime is strict where a caller can err and lenient where the server can drift: model constructors reject unknown keyword args and validate required attributes, Configuration rejects unknown options, and required API params are nil-guarded, while from_hash deserialization bypasses that validation to tolerate server omissions/drift. Authentication is scoped per operation (only the schemes an operation declares are applied, so credentials never leak to `security: []` endpoints); oneOf/anyOf resolve strictly (ambiguous or unmatched payloads raise); JSON parse errors are wrapped in ApiError; deeply-nested request paths keep any base_url path prefix; and a multi-tagged operation yields a single method per path+verb instead of duplicates. Samples: petstore and a real-world Qdrant client, both green and rubocop-clean. Codegen unit tests (RubyIdiomaticClientCodegenTest, RubyApiRoutingTest) pass. A samples CI workflow and the generated generator docs are included. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/samples-ruby-idiomatic.yaml | 34 + bin/configs/ruby-idiomatic-qdrant.yaml | 13 + bin/configs/ruby-idiomatic.yaml | 13 + docs/generators.md | 1 + docs/generators/ruby-idiomatic.md | 230 ++++++ .../languages/RubyIdiomaticClientCodegen.java | 733 ++++++++++++++++++ .../rubyidiomatic/RubyApiRouting.java | 146 ++++ .../org.openapitools.codegen.CodegenConfig | 1 + .../resources/ruby-idiomatic/Gemfile.mustache | 17 + .../resources/ruby-idiomatic/LICENSE.mustache | 49 ++ .../resources/ruby-idiomatic/README.mustache | 137 ++++ .../ruby-idiomatic/Rakefile.mustache | 8 + .../resources/ruby-idiomatic/api.mustache | 23 + .../ruby-idiomatic/api_error.mustache | 19 + .../ruby-idiomatic/api_info.mustache | 11 + .../ruby-idiomatic/api_operations.mustache | 37 + .../ruby-idiomatic/api_test.mustache | 14 + .../ruby-idiomatic/bin_rspec.mustache | 16 + .../ruby-idiomatic/bin_rubocop.mustache | 16 + .../resources/ruby-idiomatic/client.mustache | 18 + .../ruby-idiomatic/configuration.mustache | 89 +++ .../ruby-idiomatic/connection.mustache | 118 +++ .../resources/ruby-idiomatic/gem.mustache | 62 ++ .../resources/ruby-idiomatic/gemspec.mustache | 33 + .../ruby-idiomatic/github-workflow.mustache | 74 ++ .../ruby-idiomatic/gitignore.mustache | 11 + .../resources/ruby-idiomatic/model.mustache | 32 + .../ruby-idiomatic/model_test.mustache | 63 ++ .../partial_model_anyof.mustache | 22 + .../partial_model_enum_class.mustache | 21 + .../partial_model_generic.mustache | 54 ++ .../partial_oneof_module.mustache | 34 + .../ruby-idiomatic/polymorphism.mustache | 168 ++++ .../ruby-idiomatic/response.mustache | 31 + .../resources/ruby-idiomatic/rspec.mustache | 1 + .../resources/ruby-idiomatic/rubocop.mustache | 123 +++ .../ruby-idiomatic/serializable.mustache | 50 ++ .../ruby-idiomatic/spec_helper.mustache | 27 + .../ruby-idiomatic/validations.mustache | 87 +++ .../resources/ruby-idiomatic/version.mustache | 5 + .../rubyidiomatic/RubyApiRoutingTest.java | 60 ++ .../RubyIdiomaticClientCodegenTest.java | 385 +++++++++ .../resources/3_0/ruby-idiomatic/acronym.yaml | 82 ++ .../.github/workflows/ci.yml | 74 ++ .../others/ruby-idiomatic-qdrant/.gitignore | 11 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 363 +++++++++ .../.openapi-generator/VERSION | 1 + .../others/ruby-idiomatic-qdrant/.rspec | 1 + .../others/ruby-idiomatic-qdrant/.rubocop.yml | 123 +++ .../others/ruby-idiomatic-qdrant/Gemfile | 17 + .../others/ruby-idiomatic-qdrant/LICENSE | 24 + .../others/ruby-idiomatic-qdrant/README.md | 127 +++ .../others/ruby-idiomatic-qdrant/Rakefile | 8 + .../others/ruby-idiomatic-qdrant/bin/rspec | 16 + .../others/ruby-idiomatic-qdrant/bin/rubocop | 16 + .../ruby-idiomatic-qdrant/lib/qdrant.rb | 34 + .../lib/qdrant/api/aliases.rb | 20 + .../lib/qdrant/api/cluster.rb | 29 + .../lib/qdrant/api/cluster/peer.rb | 24 + .../lib/qdrant/api/collections.rb | 148 ++++ .../lib/qdrant/api/collections/index.rb | 40 + .../lib/qdrant/api/collections/points.rb | 376 +++++++++ .../lib/qdrant/api/collections/shards.rb | 133 ++++ .../lib/qdrant/api/collections/snapshots.rb | 93 +++ .../lib/qdrant/api/healthz.rb | 20 + .../lib/qdrant/api/issues.rb | 29 + .../lib/qdrant/api/livez.rb | 20 + .../lib/qdrant/api/locks.rb | 30 + .../lib/qdrant/api/metrics.rb | 21 + .../lib/qdrant/api/readyz.rb | 20 + .../lib/qdrant/api/root.rb | 20 + .../lib/qdrant/api/snapshots.rb | 55 ++ .../lib/qdrant/api/telemetry.rb | 21 + .../lib/qdrant/api_error.rb | 19 + .../lib/qdrant/client.rb | 60 ++ .../lib/qdrant/configuration.rb | 68 ++ .../lib/qdrant/connection.rb | 118 +++ .../lib/qdrant/models/abort_shard_transfer.rb | 43 + .../qdrant/models/abort_transfer_operation.rb | 30 + .../lib/qdrant/models/alias_description.rb | 35 + .../lib/qdrant/models/alias_operations.rb | 34 + .../lib/qdrant/models/any_variants.rb | 33 + .../lib/qdrant/models/app_build_telemetry.rb | 60 ++ .../qdrant/models/app_features_telemetry.rb | 45 ++ .../lib/qdrant/models/batch.rb | 40 + .../lib/qdrant/models/batch_payloads_inner.rb | 32 + .../qdrant/models/batch_update200_response.rb | 40 + .../lib/qdrant/models/batch_vector_struct.rb | 35 + .../lib/qdrant/models/binary_quantization.rb | 30 + .../models/binary_quantization_config.rb | 30 + .../lib/qdrant/models/bool_index_params.rb | 30 + .../lib/qdrant/models/bool_index_type.rb | 25 + .../qdrant/models/change_aliases_operation.rb | 30 + .../qdrant/models/clear_payload_operation.rb | 30 + .../qdrant/models/cluster_config_telemetry.rb | 41 + .../lib/qdrant/models/cluster_operations.rb | 38 + .../lib/qdrant/models/cluster_status.rb | 39 + .../models/cluster_status200_response.rb | 40 + .../qdrant/models/cluster_status_one_of.rb | 31 + .../qdrant/models/cluster_status_one_of1.rb | 57 ++ .../qdrant/models/cluster_status_telemetry.rb | 70 ++ .../lib/qdrant/models/cluster_telemetry.rb | 50 ++ .../qdrant/models/collection_cluster_info.rb | 57 ++ .../collection_cluster_info200_response.rb | 40 + .../lib/qdrant/models/collection_config.rb | 50 ++ .../qdrant/models/collection_description.rb | 30 + .../lib/qdrant/models/collection_existence.rb | 30 + .../models/collection_exists200_response.rb | 40 + .../lib/qdrant/models/collection_info.rb | 69 ++ .../lib/qdrant/models/collection_params.rb | 73 ++ .../qdrant/models/collection_params_diff.rb | 48 ++ .../lib/qdrant/models/collection_status.rb | 31 + .../lib/qdrant/models/collection_telemetry.rb | 56 ++ .../models/collection_telemetry_enum.rb | 33 + .../collections_aggregated_telemetry.rb | 41 + .../models/collections_aliases_response.rb | 30 + .../lib/qdrant/models/collections_response.rb | 30 + .../qdrant/models/collections_telemetry.rb | 36 + .../lib/qdrant/models/compression_ratio.rb | 33 + .../lib/qdrant/models/condition.rb | 37 + .../models/consensus_config_telemetry.rb | 43 + .../qdrant/models/consensus_thread_status.rb | 40 + .../models/consensus_thread_status_one_of.rb | 36 + .../models/consensus_thread_status_one_of1.rb | 31 + .../models/consensus_thread_status_one_of2.rb | 36 + .../lib/qdrant/models/context_example_pair.rb | 35 + .../lib/qdrant/models/context_input.rb | 33 + .../lib/qdrant/models/context_pair.rb | 35 + .../lib/qdrant/models/context_query.rb | 30 + .../qdrant/models/count_points200_response.rb | 40 + .../lib/qdrant/models/count_request.rb | 41 + .../lib/qdrant/models/count_result.rb | 31 + .../lib/qdrant/models/create_alias.rb | 35 + .../qdrant/models/create_alias_operation.rb | 30 + .../lib/qdrant/models/create_collection.rb | 88 +++ .../lib/qdrant/models/create_field_index.rb | 35 + .../models/create_field_index200_response.rb | 40 + .../models/create_shard_key200_response.rb | 40 + .../lib/qdrant/models/create_sharding_key.rb | 47 ++ .../models/create_sharding_key_operation.rb | 30 + .../models/create_snapshot200_response.rb | 40 + .../lib/qdrant/models/datatype.rb | 29 + .../qdrant/models/datetime_index_params.rb | 40 + .../lib/qdrant/models/datetime_index_type.rb | 25 + .../lib/qdrant/models/datetime_range.rb | 45 ++ .../lib/qdrant/models/delete_alias.rb | 30 + .../qdrant/models/delete_alias_operation.rb | 30 + .../lib/qdrant/models/delete_operation.rb | 30 + .../lib/qdrant/models/delete_payload.rb | 45 ++ .../qdrant/models/delete_payload_operation.rb | 30 + .../lib/qdrant/models/delete_vectors.rb | 46 ++ .../qdrant/models/delete_vectors_operation.rb | 30 + .../lib/qdrant/models/direction.rb | 27 + .../lib/qdrant/models/disabled.rb | 25 + .../lib/qdrant/models/discover_input.rb | 35 + .../qdrant/models/discover_input_context.rb | 33 + .../lib/qdrant/models/discover_query.rb | 30 + .../lib/qdrant/models/discover_request.rb | 82 ++ .../qdrant/models/discover_request_batch.rb | 30 + .../lib/qdrant/models/distance.rb | 31 + .../lib/qdrant/models/document.rb | 35 + .../qdrant/models/drop_replica_operation.rb | 30 + .../lib/qdrant/models/drop_sharding_key.rb | 30 + .../models/drop_sharding_key_operation.rb | 30 + .../lib/qdrant/models/error_response.rb | 40 + .../qdrant/models/error_response_status.rb | 30 + .../lib/qdrant/models/extended_point_id.rb | 33 + .../lib/qdrant/models/facet200_response.rb | 40 + .../lib/qdrant/models/facet_request.rb | 51 ++ .../lib/qdrant/models/facet_response.rb | 30 + .../lib/qdrant/models/facet_value.rb | 34 + .../lib/qdrant/models/facet_value_hit.rb | 36 + .../lib/qdrant/models/field_condition.rb | 60 ++ .../lib/qdrant/models/filter.rb | 45 ++ .../lib/qdrant/models/filter_must.rb | 33 + .../lib/qdrant/models/filter_must_not.rb | 33 + .../lib/qdrant/models/filter_selector.rb | 35 + .../lib/qdrant/models/filter_should.rb | 33 + .../lib/qdrant/models/float_index_params.rb | 40 + .../lib/qdrant/models/float_index_type.rb | 25 + .../lib/qdrant/models/fusion.rb | 27 + .../lib/qdrant/models/fusion_query.rb | 30 + .../lib/qdrant/models/geo_bounding_box.rb | 35 + .../lib/qdrant/models/geo_index_params.rb | 35 + .../lib/qdrant/models/geo_index_type.rb | 25 + .../lib/qdrant/models/geo_line_string.rb | 30 + .../lib/qdrant/models/geo_point.rb | 35 + .../lib/qdrant/models/geo_polygon.rb | 35 + .../lib/qdrant/models/geo_radius.rb | 35 + .../models/get_collection200_response.rb | 40 + .../get_collection_aliases200_response.rb | 40 + .../models/get_collections200_response.rb | 40 + .../qdrant/models/get_locks200_response.rb | 40 + .../qdrant/models/get_point200_response.rb | 40 + .../qdrant/models/get_points200_response.rb | 40 + .../lib/qdrant/models/group_id.rb | 33 + .../lib/qdrant/models/groups_result.rb | 30 + .../lib/qdrant/models/grpc_telemetry.rb | 30 + .../lib/qdrant/models/has_id_condition.rb | 30 + .../lib/qdrant/models/hnsw_config.rb | 61 ++ .../lib/qdrant/models/hnsw_config_diff.rb | 60 ++ .../lib/qdrant/models/indexes.rb | 39 + .../lib/qdrant/models/indexes_one_of.rb | 36 + .../lib/qdrant/models/indexes_one_of1.rb | 36 + .../lib/qdrant/models/init_from.rb | 30 + .../lib/qdrant/models/integer_index_params.rb | 50 ++ .../lib/qdrant/models/integer_index_type.rb | 25 + .../lib/qdrant/models/is_empty_condition.rb | 30 + .../lib/qdrant/models/is_null_condition.rb | 30 + .../lib/qdrant/models/keyword_index_params.rb | 40 + .../lib/qdrant/models/keyword_index_type.rb | 25 + .../models/list_snapshots200_response.rb | 40 + .../lib/qdrant/models/local_shard_info.rb | 47 ++ .../qdrant/models/local_shard_telemetry.rb | 51 ++ .../lib/qdrant/models/locks_option.rb | 35 + .../lib/qdrant/models/lookup_location.rb | 40 + .../lib/qdrant/models/match.rb | 35 + .../lib/qdrant/models/match_any.rb | 30 + .../lib/qdrant/models/match_except.rb | 30 + .../lib/qdrant/models/match_text.rb | 30 + .../lib/qdrant/models/match_value.rb | 30 + .../lib/qdrant/models/message_send_errors.rb | 41 + .../lib/qdrant/models/min_should.rb | 36 + .../lib/qdrant/models/modifier.rb | 27 + .../lib/qdrant/models/move_shard.rb | 48 ++ .../lib/qdrant/models/move_shard_operation.rb | 30 + .../qdrant/models/multi_vector_comparator.rb | 25 + .../lib/qdrant/models/multi_vector_config.rb | 30 + .../lib/qdrant/models/named_sparse_vector.rb | 35 + .../lib/qdrant/models/named_vector.rb | 35 + .../lib/qdrant/models/named_vector_struct.rb | 34 + .../lib/qdrant/models/nearest_query.rb | 30 + .../lib/qdrant/models/nested.rb | 35 + .../lib/qdrant/models/nested_condition.rb | 30 + .../models/operation_duration_statistics.rb | 63 ++ .../lib/qdrant/models/optimizer_telemetry.rb | 40 + .../lib/qdrant/models/optimizers_config.rb | 74 ++ .../qdrant/models/optimizers_config_diff.rb | 72 ++ .../lib/qdrant/models/optimizers_status.rb | 39 + .../qdrant/models/optimizers_status_one_of.rb | 30 + .../lib/qdrant/models/order_by.rb | 40 + .../lib/qdrant/models/order_by_interface.rb | 33 + .../lib/qdrant/models/order_by_query.rb | 30 + .../lib/qdrant/models/order_value.rb | 33 + .../models/overwrite_payload_operation.rb | 30 + .../lib/qdrant/models/p2p_config_telemetry.rb | 31 + .../lib/qdrant/models/payload_field.rb | 30 + .../lib/qdrant/models/payload_field_schema.rb | 33 + .../lib/qdrant/models/payload_index_info.rb | 41 + .../qdrant/models/payload_index_telemetry.rb | 48 ++ .../qdrant/models/payload_schema_params.rb | 39 + .../lib/qdrant/models/payload_schema_type.rb | 39 + .../lib/qdrant/models/payload_selector.rb | 33 + .../qdrant/models/payload_selector_exclude.rb | 30 + .../qdrant/models/payload_selector_include.rb | 30 + .../lib/qdrant/models/payload_storage_type.rb | 39 + .../models/payload_storage_type_one_of.rb | 31 + .../models/payload_storage_type_one_of1.rb | 31 + .../lib/qdrant/models/peer_info.rb | 30 + .../lib/qdrant/models/point_group.rb | 40 + .../lib/qdrant/models/point_ids_list.rb | 35 + .../qdrant/models/point_insert_operations.rb | 33 + .../lib/qdrant/models/point_request.rb | 45 ++ .../lib/qdrant/models/point_struct.rb | 40 + .../lib/qdrant/models/point_vectors.rb | 35 + .../lib/qdrant/models/points_batch.rb | 35 + .../lib/qdrant/models/points_list.rb | 35 + .../lib/qdrant/models/points_selector.rb | 33 + .../lib/qdrant/models/prefetch.rb | 66 ++ .../lib/qdrant/models/prefetch_prefetch.rb | 33 + .../lib/qdrant/models/product_quantization.rb | 30 + .../models/product_quantization_config.rb | 35 + .../lib/qdrant/models/quantization_config.rb | 34 + .../qdrant/models/quantization_config_diff.rb | 35 + .../models/quantization_search_params.rb | 42 + .../lib/qdrant/models/query.rb | 38 + .../models/query_batch_points200_response.rb | 40 + .../lib/qdrant/models/query_groups_request.rb | 98 +++ .../lib/qdrant/models/query_interface.rb | 33 + .../qdrant/models/query_points200_response.rb | 40 + .../lib/qdrant/models/query_request.rb | 87 +++ .../lib/qdrant/models/query_request_batch.rb | 30 + .../qdrant/models/query_request_prefetch.rb | 33 + .../lib/qdrant/models/query_response.rb | 30 + .../lib/qdrant/models/raft_info.rb | 59 ++ .../lib/qdrant/models/range.rb | 45 ++ .../lib/qdrant/models/range_interface.rb | 33 + .../lib/qdrant/models/read_consistency.rb | 33 + .../qdrant/models/read_consistency_type.rb | 29 + .../lib/qdrant/models/recommend_example.rb | 34 + .../qdrant/models/recommend_groups_request.rb | 103 +++ .../lib/qdrant/models/recommend_input.rb | 40 + .../lib/qdrant/models/recommend_query.rb | 30 + .../lib/qdrant/models/recommend_request.rb | 92 +++ .../qdrant/models/recommend_request_batch.rb | 30 + .../lib/qdrant/models/recommend_strategy.rb | 27 + .../lib/qdrant/models/record.rb | 50 ++ ...over_from_uploaded_snapshot202_response.rb | 35 + .../lib/qdrant/models/remote_shard_info.rb | 47 ++ .../qdrant/models/remote_shard_telemetry.rb | 47 ++ .../lib/qdrant/models/rename_alias.rb | 35 + .../qdrant/models/rename_alias_operation.rb | 30 + .../lib/qdrant/models/replica.rb | 37 + .../qdrant/models/replica_set_telemetry.rb | 46 ++ .../lib/qdrant/models/replica_state.rb | 37 + .../lib/qdrant/models/replicate_shard.rb | 48 ++ .../models/replicate_shard_operation.rb | 30 + .../lib/qdrant/models/requests_telemetry.rb | 35 + .../lib/qdrant/models/resharding_direction.rb | 27 + .../lib/qdrant/models/resharding_info.rb | 52 ++ .../lib/qdrant/models/restart_transfer.rb | 48 ++ .../models/restart_transfer_operation.rb | 30 + .../models/running_environment_telemetry.rb | 63 ++ .../lib/qdrant/models/sample.rb | 25 + .../lib/qdrant/models/sample_query.rb | 30 + .../lib/qdrant/models/scalar_quantization.rb | 30 + .../models/scalar_quantization_config.rb | 42 + .../lib/qdrant/models/scalar_type.rb | 25 + .../lib/qdrant/models/scored_point.rb | 61 ++ .../models/scroll_points200_response.rb | 40 + .../lib/qdrant/models/scroll_request.rb | 61 ++ .../lib/qdrant/models/scroll_result.rb | 35 + .../models/search_batch_points200_response.rb | 40 + .../qdrant/models/search_groups_request.rb | 83 ++ .../search_matrix_offsets200_response.rb | 40 + .../models/search_matrix_offsets_response.rb | 45 ++ .../lib/qdrant/models/search_matrix_pair.rb | 40 + .../models/search_matrix_pairs200_response.rb | 40 + .../models/search_matrix_pairs_response.rb | 30 + .../qdrant/models/search_matrix_request.rb | 52 ++ .../lib/qdrant/models/search_params.rb | 48 ++ .../models/search_point_groups200_response.rb | 40 + .../models/search_points200_response.rb | 40 + .../lib/qdrant/models/search_request.rb | 72 ++ .../lib/qdrant/models/search_request_batch.rb | 30 + .../lib/qdrant/models/segment_config.rb | 40 + .../lib/qdrant/models/segment_info.rb | 81 ++ .../lib/qdrant/models/segment_telemetry.rb | 45 ++ .../lib/qdrant/models/segment_type.rb | 29 + .../lib/qdrant/models/set_payload.rb | 50 ++ .../qdrant/models/set_payload_operation.rb | 30 + .../lib/qdrant/models/shard_key.rb | 33 + .../lib/qdrant/models/shard_key_selector.rb | 33 + .../qdrant/models/shard_snapshot_location.rb | 32 + .../qdrant/models/shard_snapshot_recover.rb | 45 ++ .../lib/qdrant/models/shard_status.rb | 31 + .../lib/qdrant/models/shard_transfer_info.rb | 58 ++ .../qdrant/models/shard_transfer_method.rb | 29 + .../lib/qdrant/models/sharding_method.rb | 27 + .../lib/qdrant/models/snapshot_description.rb | 46 ++ .../lib/qdrant/models/snapshot_priority.rb | 29 + .../lib/qdrant/models/snapshot_recover.rb | 45 ++ .../lib/qdrant/models/sparse_index_config.rb | 41 + .../lib/qdrant/models/sparse_index_params.rb | 41 + .../lib/qdrant/models/sparse_index_type.rb | 29 + .../lib/qdrant/models/sparse_vector.rb | 35 + .../models/sparse_vector_data_config.rb | 30 + .../lib/qdrant/models/sparse_vector_params.rb | 35 + .../lib/qdrant/models/start_from.rb | 34 + .../lib/qdrant/models/state_role.rb | 31 + .../qdrant/models/telemetry200_response.rb | 40 + .../lib/qdrant/models/telemetry_data.rb | 50 ++ .../lib/qdrant/models/text_index_params.rb | 57 ++ .../lib/qdrant/models/text_index_type.rb | 25 + .../lib/qdrant/models/tokenizer_type.rb | 31 + .../lib/qdrant/models/tracker_status.rb | 40 + .../qdrant/models/tracker_status_one_of.rb | 30 + .../qdrant/models/tracker_status_one_of1.rb | 30 + .../lib/qdrant/models/tracker_telemetry.rb | 50 ++ .../lib/qdrant/models/update_collection.rb | 55 ++ .../lib/qdrant/models/update_operation.rb | 39 + .../lib/qdrant/models/update_operations.rb | 30 + .../lib/qdrant/models/update_result.rb | 36 + .../lib/qdrant/models/update_status.rb | 27 + .../lib/qdrant/models/update_vectors.rb | 36 + .../qdrant/models/update_vectors_operation.rb | 30 + .../lib/qdrant/models/upsert_operation.rb | 30 + .../lib/qdrant/models/uuid_index_params.rb | 40 + .../lib/qdrant/models/uuid_index_type.rb | 25 + .../lib/qdrant/models/value_variants.rb | 34 + .../lib/qdrant/models/values_count.rb | 49 ++ .../lib/qdrant/models/vector.rb | 35 + .../lib/qdrant/models/vector_data_config.rb | 61 ++ .../lib/qdrant/models/vector_data_info.rb | 43 + .../models/vector_index_searches_telemetry.rb | 75 ++ .../lib/qdrant/models/vector_input.rb | 36 + .../lib/qdrant/models/vector_params.rb | 61 ++ .../lib/qdrant/models/vector_params_diff.rb | 40 + .../qdrant/models/vector_storage_datatype.rb | 29 + .../lib/qdrant/models/vector_storage_type.rb | 31 + .../lib/qdrant/models/vector_struct.rb | 35 + .../lib/qdrant/models/vectors_config.rb | 33 + .../lib/qdrant/models/version_info.rb | 40 + .../lib/qdrant/models/wal_config.rb | 37 + .../lib/qdrant/models/wal_config_diff.rb | 37 + .../lib/qdrant/models/web_api_telemetry.rb | 30 + .../lib/qdrant/models/with_lookup.rb | 40 + .../qdrant/models/with_lookup_interface.rb | 33 + .../qdrant/models/with_payload_interface.rb | 34 + .../lib/qdrant/models/with_vector.rb | 33 + .../lib/qdrant/models/write_ordering.rb | 29 + .../lib/qdrant/polymorphism.rb | 168 ++++ .../lib/qdrant/response.rb | 31 + .../lib/qdrant/serializable.rb | 50 ++ .../lib/qdrant/validations.rb | 87 +++ .../lib/qdrant/version.rb | 5 + .../ruby-idiomatic-qdrant/qdrant.gemspec | 23 + .../spec/api/aliases_spec.rb | 12 + .../spec/api/cluster/peer_spec.rb | 12 + .../spec/api/cluster_spec.rb | 12 + .../spec/api/collections/index_spec.rb | 12 + .../spec/api/collections/points_spec.rb | 12 + .../spec/api/collections/shards_spec.rb | 12 + .../spec/api/collections/snapshots_spec.rb | 12 + .../spec/api/collections_spec.rb | 12 + .../spec/api/healthz_spec.rb | 12 + .../spec/api/issues_spec.rb | 12 + .../spec/api/livez_spec.rb | 12 + .../spec/api/locks_spec.rb | 12 + .../spec/api/metrics_spec.rb | 12 + .../spec/api/readyz_spec.rb | 12 + .../spec/api/root_spec.rb | 12 + .../spec/api/snapshots_spec.rb | 12 + .../spec/api/telemetry_spec.rb | 12 + .../spec/models/abort_shard_transfer_spec.rb | 26 + .../models/abort_transfer_operation_spec.rb | 26 + .../spec/models/alias_description_spec.rb | 26 + .../spec/models/alias_operations_spec.rb | 9 + .../spec/models/any_variants_spec.rb | 9 + .../spec/models/app_build_telemetry_spec.rb | 26 + .../models/app_features_telemetry_spec.rb | 26 + .../spec/models/batch_payloads_inner_spec.rb | 9 + .../spec/models/batch_spec.rb | 26 + .../models/batch_update200_response_spec.rb | 26 + .../spec/models/batch_vector_struct_spec.rb | 9 + .../models/binary_quantization_config_spec.rb | 26 + .../spec/models/binary_quantization_spec.rb | 26 + .../spec/models/bool_index_params_spec.rb | 26 + .../spec/models/bool_index_type_spec.rb | 9 + .../models/change_aliases_operation_spec.rb | 26 + .../models/clear_payload_operation_spec.rb | 26 + .../models/cluster_config_telemetry_spec.rb | 26 + .../spec/models/cluster_operations_spec.rb | 9 + .../models/cluster_status200_response_spec.rb | 26 + .../models/cluster_status_one_of1_spec.rb | 26 + .../spec/models/cluster_status_one_of_spec.rb | 26 + .../spec/models/cluster_status_spec.rb | 9 + .../models/cluster_status_telemetry_spec.rb | 26 + .../spec/models/cluster_telemetry_spec.rb | 26 + ...ollection_cluster_info200_response_spec.rb | 26 + .../models/collection_cluster_info_spec.rb | 26 + .../spec/models/collection_config_spec.rb | 26 + .../models/collection_description_spec.rb | 26 + .../spec/models/collection_existence_spec.rb | 26 + .../collection_exists200_response_spec.rb | 26 + .../spec/models/collection_info_spec.rb | 26 + .../models/collection_params_diff_spec.rb | 26 + .../spec/models/collection_params_spec.rb | 26 + .../spec/models/collection_status_spec.rb | 9 + .../models/collection_telemetry_enum_spec.rb | 9 + .../spec/models/collection_telemetry_spec.rb | 26 + .../collections_aggregated_telemetry_spec.rb | 26 + .../collections_aliases_response_spec.rb | 26 + .../spec/models/collections_response_spec.rb | 26 + .../spec/models/collections_telemetry_spec.rb | 26 + .../spec/models/compression_ratio_spec.rb | 9 + .../spec/models/condition_spec.rb | 9 + .../models/consensus_config_telemetry_spec.rb | 26 + .../consensus_thread_status_one_of1_spec.rb | 26 + .../consensus_thread_status_one_of2_spec.rb | 26 + .../consensus_thread_status_one_of_spec.rb | 26 + .../models/consensus_thread_status_spec.rb | 9 + .../spec/models/context_example_pair_spec.rb | 26 + .../spec/models/context_input_spec.rb | 9 + .../spec/models/context_pair_spec.rb | 26 + .../spec/models/context_query_spec.rb | 26 + .../models/count_points200_response_spec.rb | 26 + .../spec/models/count_request_spec.rb | 26 + .../spec/models/count_result_spec.rb | 26 + .../models/create_alias_operation_spec.rb | 26 + .../spec/models/create_alias_spec.rb | 26 + .../spec/models/create_collection_spec.rb | 26 + .../create_field_index200_response_spec.rb | 26 + .../spec/models/create_field_index_spec.rb | 26 + .../create_shard_key200_response_spec.rb | 26 + .../create_sharding_key_operation_spec.rb | 26 + .../spec/models/create_sharding_key_spec.rb | 26 + .../create_snapshot200_response_spec.rb | 26 + .../spec/models/datatype_spec.rb | 9 + .../spec/models/datetime_index_params_spec.rb | 26 + .../spec/models/datetime_index_type_spec.rb | 9 + .../spec/models/datetime_range_spec.rb | 26 + .../models/delete_alias_operation_spec.rb | 26 + .../spec/models/delete_alias_spec.rb | 26 + .../spec/models/delete_operation_spec.rb | 26 + .../models/delete_payload_operation_spec.rb | 26 + .../spec/models/delete_payload_spec.rb | 26 + .../models/delete_vectors_operation_spec.rb | 26 + .../spec/models/delete_vectors_spec.rb | 26 + .../spec/models/direction_spec.rb | 9 + .../spec/models/disabled_spec.rb | 9 + .../models/discover_input_context_spec.rb | 9 + .../spec/models/discover_input_spec.rb | 26 + .../spec/models/discover_query_spec.rb | 26 + .../models/discover_request_batch_spec.rb | 26 + .../spec/models/discover_request_spec.rb | 26 + .../spec/models/distance_spec.rb | 9 + .../spec/models/document_spec.rb | 26 + .../models/drop_replica_operation_spec.rb | 26 + .../drop_sharding_key_operation_spec.rb | 26 + .../spec/models/drop_sharding_key_spec.rb | 26 + .../spec/models/error_response_spec.rb | 26 + .../spec/models/error_response_status_spec.rb | 26 + .../spec/models/extended_point_id_spec.rb | 9 + .../spec/models/facet200_response_spec.rb | 26 + .../spec/models/facet_request_spec.rb | 26 + .../spec/models/facet_response_spec.rb | 26 + .../spec/models/facet_value_hit_spec.rb | 26 + .../spec/models/facet_value_spec.rb | 9 + .../spec/models/field_condition_spec.rb | 26 + .../spec/models/filter_must_not_spec.rb | 9 + .../spec/models/filter_must_spec.rb | 9 + .../spec/models/filter_selector_spec.rb | 26 + .../spec/models/filter_should_spec.rb | 9 + .../spec/models/filter_spec.rb | 26 + .../spec/models/float_index_params_spec.rb | 26 + .../spec/models/float_index_type_spec.rb | 9 + .../spec/models/fusion_query_spec.rb | 26 + .../spec/models/fusion_spec.rb | 9 + .../spec/models/geo_bounding_box_spec.rb | 26 + .../spec/models/geo_index_params_spec.rb | 26 + .../spec/models/geo_index_type_spec.rb | 9 + .../spec/models/geo_line_string_spec.rb | 26 + .../spec/models/geo_point_spec.rb | 26 + .../spec/models/geo_polygon_spec.rb | 26 + .../spec/models/geo_radius_spec.rb | 26 + .../models/get_collection200_response_spec.rb | 26 + ...get_collection_aliases200_response_spec.rb | 26 + .../get_collections200_response_spec.rb | 26 + .../spec/models/get_locks200_response_spec.rb | 26 + .../spec/models/get_point200_response_spec.rb | 26 + .../models/get_points200_response_spec.rb | 26 + .../spec/models/group_id_spec.rb | 9 + .../spec/models/groups_result_spec.rb | 26 + .../spec/models/grpc_telemetry_spec.rb | 26 + .../spec/models/has_id_condition_spec.rb | 26 + .../spec/models/hnsw_config_diff_spec.rb | 26 + .../spec/models/hnsw_config_spec.rb | 26 + .../spec/models/indexes_one_of1_spec.rb | 26 + .../spec/models/indexes_one_of_spec.rb | 26 + .../spec/models/indexes_spec.rb | 9 + .../spec/models/init_from_spec.rb | 26 + .../spec/models/integer_index_params_spec.rb | 26 + .../spec/models/integer_index_type_spec.rb | 9 + .../spec/models/is_empty_condition_spec.rb | 26 + .../spec/models/is_null_condition_spec.rb | 26 + .../spec/models/keyword_index_params_spec.rb | 26 + .../spec/models/keyword_index_type_spec.rb | 9 + .../models/list_snapshots200_response_spec.rb | 26 + .../spec/models/local_shard_info_spec.rb | 26 + .../spec/models/local_shard_telemetry_spec.rb | 26 + .../spec/models/locks_option_spec.rb | 26 + .../spec/models/lookup_location_spec.rb | 26 + .../spec/models/match_any_spec.rb | 26 + .../spec/models/match_except_spec.rb | 26 + .../spec/models/match_spec.rb | 9 + .../spec/models/match_text_spec.rb | 26 + .../spec/models/match_value_spec.rb | 26 + .../spec/models/message_send_errors_spec.rb | 26 + .../spec/models/min_should_spec.rb | 26 + .../spec/models/modifier_spec.rb | 9 + .../spec/models/move_shard_operation_spec.rb | 26 + .../spec/models/move_shard_spec.rb | 26 + .../models/multi_vector_comparator_spec.rb | 9 + .../spec/models/multi_vector_config_spec.rb | 26 + .../spec/models/named_sparse_vector_spec.rb | 26 + .../spec/models/named_vector_spec.rb | 26 + .../spec/models/named_vector_struct_spec.rb | 9 + .../spec/models/nearest_query_spec.rb | 26 + .../spec/models/nested_condition_spec.rb | 26 + .../spec/models/nested_spec.rb | 26 + .../operation_duration_statistics_spec.rb | 26 + .../spec/models/optimizer_telemetry_spec.rb | 26 + .../models/optimizers_config_diff_spec.rb | 26 + .../spec/models/optimizers_config_spec.rb | 26 + .../models/optimizers_status_one_of_spec.rb | 26 + .../spec/models/optimizers_status_spec.rb | 9 + .../spec/models/order_by_interface_spec.rb | 9 + .../spec/models/order_by_query_spec.rb | 26 + .../spec/models/order_by_spec.rb | 26 + .../spec/models/order_value_spec.rb | 9 + .../overwrite_payload_operation_spec.rb | 26 + .../spec/models/p2p_config_telemetry_spec.rb | 26 + .../spec/models/payload_field_schema_spec.rb | 9 + .../spec/models/payload_field_spec.rb | 26 + .../spec/models/payload_index_info_spec.rb | 26 + .../models/payload_index_telemetry_spec.rb | 26 + .../spec/models/payload_schema_params_spec.rb | 9 + .../spec/models/payload_schema_type_spec.rb | 9 + .../models/payload_selector_exclude_spec.rb | 26 + .../models/payload_selector_include_spec.rb | 26 + .../spec/models/payload_selector_spec.rb | 9 + .../payload_storage_type_one_of1_spec.rb | 26 + .../payload_storage_type_one_of_spec.rb | 26 + .../spec/models/payload_storage_type_spec.rb | 9 + .../spec/models/peer_info_spec.rb | 26 + .../spec/models/point_group_spec.rb | 26 + .../spec/models/point_ids_list_spec.rb | 26 + .../models/point_insert_operations_spec.rb | 9 + .../spec/models/point_request_spec.rb | 26 + .../spec/models/point_struct_spec.rb | 26 + .../spec/models/point_vectors_spec.rb | 26 + .../spec/models/points_batch_spec.rb | 26 + .../spec/models/points_list_spec.rb | 26 + .../spec/models/points_selector_spec.rb | 9 + .../spec/models/prefetch_prefetch_spec.rb | 9 + .../spec/models/prefetch_spec.rb | 26 + .../product_quantization_config_spec.rb | 26 + .../spec/models/product_quantization_spec.rb | 26 + .../models/quantization_config_diff_spec.rb | 9 + .../spec/models/quantization_config_spec.rb | 9 + .../models/quantization_search_params_spec.rb | 26 + .../query_batch_points200_response_spec.rb | 26 + .../spec/models/query_groups_request_spec.rb | 26 + .../spec/models/query_interface_spec.rb | 9 + .../models/query_points200_response_spec.rb | 26 + .../spec/models/query_request_batch_spec.rb | 26 + .../models/query_request_prefetch_spec.rb | 9 + .../spec/models/query_request_spec.rb | 26 + .../spec/models/query_response_spec.rb | 26 + .../spec/models/query_spec.rb | 9 + .../spec/models/raft_info_spec.rb | 26 + .../spec/models/range_interface_spec.rb | 9 + .../spec/models/range_spec.rb | 26 + .../spec/models/read_consistency_spec.rb | 9 + .../spec/models/read_consistency_type_spec.rb | 9 + .../spec/models/recommend_example_spec.rb | 9 + .../models/recommend_groups_request_spec.rb | 26 + .../spec/models/recommend_input_spec.rb | 26 + .../spec/models/recommend_query_spec.rb | 26 + .../models/recommend_request_batch_spec.rb | 26 + .../spec/models/recommend_request_spec.rb | 26 + .../spec/models/recommend_strategy_spec.rb | 9 + .../spec/models/record_spec.rb | 26 + ...from_uploaded_snapshot202_response_spec.rb | 26 + .../spec/models/remote_shard_info_spec.rb | 26 + .../models/remote_shard_telemetry_spec.rb | 26 + .../models/rename_alias_operation_spec.rb | 26 + .../spec/models/rename_alias_spec.rb | 26 + .../spec/models/replica_set_telemetry_spec.rb | 26 + .../spec/models/replica_spec.rb | 26 + .../spec/models/replica_state_spec.rb | 9 + .../models/replicate_shard_operation_spec.rb | 26 + .../spec/models/replicate_shard_spec.rb | 26 + .../spec/models/requests_telemetry_spec.rb | 26 + .../spec/models/resharding_direction_spec.rb | 9 + .../spec/models/resharding_info_spec.rb | 26 + .../models/restart_transfer_operation_spec.rb | 26 + .../spec/models/restart_transfer_spec.rb | 26 + .../running_environment_telemetry_spec.rb | 26 + .../spec/models/sample_query_spec.rb | 26 + .../spec/models/sample_spec.rb | 9 + .../models/scalar_quantization_config_spec.rb | 26 + .../spec/models/scalar_quantization_spec.rb | 26 + .../spec/models/scalar_type_spec.rb | 9 + .../spec/models/scored_point_spec.rb | 26 + .../models/scroll_points200_response_spec.rb | 26 + .../spec/models/scroll_request_spec.rb | 26 + .../spec/models/scroll_result_spec.rb | 26 + .../search_batch_points200_response_spec.rb | 26 + .../spec/models/search_groups_request_spec.rb | 26 + .../search_matrix_offsets200_response_spec.rb | 26 + .../search_matrix_offsets_response_spec.rb | 26 + .../spec/models/search_matrix_pair_spec.rb | 26 + .../search_matrix_pairs200_response_spec.rb | 26 + .../search_matrix_pairs_response_spec.rb | 26 + .../spec/models/search_matrix_request_spec.rb | 26 + .../spec/models/search_params_spec.rb | 26 + .../search_point_groups200_response_spec.rb | 26 + .../models/search_points200_response_spec.rb | 26 + .../spec/models/search_request_batch_spec.rb | 26 + .../spec/models/search_request_spec.rb | 26 + .../spec/models/segment_config_spec.rb | 26 + .../spec/models/segment_info_spec.rb | 26 + .../spec/models/segment_telemetry_spec.rb | 26 + .../spec/models/segment_type_spec.rb | 9 + .../spec/models/set_payload_operation_spec.rb | 26 + .../spec/models/set_payload_spec.rb | 26 + .../spec/models/shard_key_selector_spec.rb | 9 + .../spec/models/shard_key_spec.rb | 9 + .../models/shard_snapshot_location_spec.rb | 9 + .../models/shard_snapshot_recover_spec.rb | 26 + .../spec/models/shard_status_spec.rb | 9 + .../spec/models/shard_transfer_info_spec.rb | 26 + .../spec/models/shard_transfer_method_spec.rb | 9 + .../spec/models/sharding_method_spec.rb | 9 + .../spec/models/snapshot_description_spec.rb | 26 + .../spec/models/snapshot_priority_spec.rb | 9 + .../spec/models/snapshot_recover_spec.rb | 26 + .../spec/models/sparse_index_config_spec.rb | 26 + .../spec/models/sparse_index_params_spec.rb | 26 + .../spec/models/sparse_index_type_spec.rb | 9 + .../models/sparse_vector_data_config_spec.rb | 26 + .../spec/models/sparse_vector_params_spec.rb | 26 + .../spec/models/sparse_vector_spec.rb | 26 + .../spec/models/start_from_spec.rb | 9 + .../spec/models/state_role_spec.rb | 9 + .../spec/models/telemetry200_response_spec.rb | 26 + .../spec/models/telemetry_data_spec.rb | 26 + .../spec/models/text_index_params_spec.rb | 26 + .../spec/models/text_index_type_spec.rb | 9 + .../spec/models/tokenizer_type_spec.rb | 9 + .../models/tracker_status_one_of1_spec.rb | 26 + .../spec/models/tracker_status_one_of_spec.rb | 26 + .../spec/models/tracker_status_spec.rb | 9 + .../spec/models/tracker_telemetry_spec.rb | 26 + .../spec/models/update_collection_spec.rb | 26 + .../spec/models/update_operation_spec.rb | 9 + .../spec/models/update_operations_spec.rb | 26 + .../spec/models/update_result_spec.rb | 26 + .../spec/models/update_status_spec.rb | 9 + .../models/update_vectors_operation_spec.rb | 26 + .../spec/models/update_vectors_spec.rb | 26 + .../spec/models/upsert_operation_spec.rb | 26 + .../spec/models/uuid_index_params_spec.rb | 26 + .../spec/models/uuid_index_type_spec.rb | 9 + .../spec/models/value_variants_spec.rb | 9 + .../spec/models/values_count_spec.rb | 26 + .../spec/models/vector_data_config_spec.rb | 26 + .../spec/models/vector_data_info_spec.rb | 26 + .../vector_index_searches_telemetry_spec.rb | 26 + .../spec/models/vector_input_spec.rb | 9 + .../spec/models/vector_params_diff_spec.rb | 26 + .../spec/models/vector_params_spec.rb | 26 + .../spec/models/vector_spec.rb | 9 + .../models/vector_storage_datatype_spec.rb | 9 + .../spec/models/vector_storage_type_spec.rb | 9 + .../spec/models/vector_struct_spec.rb | 9 + .../spec/models/vectors_config_spec.rb | 9 + .../spec/models/version_info_spec.rb | 26 + .../spec/models/wal_config_diff_spec.rb | 26 + .../spec/models/wal_config_spec.rb | 26 + .../spec/models/web_api_telemetry_spec.rb | 26 + .../spec/models/with_lookup_interface_spec.rb | 9 + .../spec/models/with_lookup_spec.rb | 26 + .../models/with_payload_interface_spec.rb | 9 + .../spec/models/with_vector_spec.rb | 9 + .../spec/models/write_ordering_spec.rb | 9 + .../ruby-idiomatic-qdrant/spec/spec_helper.rb | 27 + .../ruby-idiomatic/.github/workflows/ci.yml | 74 ++ .../client/petstore/ruby-idiomatic/.gitignore | 11 + .../ruby-idiomatic/.openapi-generator-ignore | 23 + .../ruby-idiomatic/.openapi-generator/FILES | 32 + .../ruby-idiomatic/.openapi-generator/VERSION | 1 + samples/client/petstore/ruby-idiomatic/.rspec | 1 + .../petstore/ruby-idiomatic/.rubocop.yml | 123 +++ .../client/petstore/ruby-idiomatic/Gemfile | 17 + .../client/petstore/ruby-idiomatic/LICENSE | 24 + .../client/petstore/ruby-idiomatic/README.md | 126 +++ .../client/petstore/ruby-idiomatic/Rakefile | 8 + .../client/petstore/ruby-idiomatic/bin/rspec | 16 + .../petstore/ruby-idiomatic/bin/rubocop | 16 + .../petstore/ruby-idiomatic/lib/petstore.rb | 33 + .../ruby-idiomatic/lib/petstore/api/pet.rb | 110 +++ .../ruby-idiomatic/lib/petstore/api/store.rb | 20 + .../lib/petstore/api/store/order.rb | 47 ++ .../ruby-idiomatic/lib/petstore/api/user.rb | 107 +++ .../ruby-idiomatic/lib/petstore/api_error.rb | 19 + .../ruby-idiomatic/lib/petstore/client.rb | 24 + .../lib/petstore/configuration.rb | 67 ++ .../ruby-idiomatic/lib/petstore/connection.rb | 118 +++ .../lib/petstore/models/api_response.rb | 39 + .../lib/petstore/models/category.rb | 35 + .../lib/petstore/models/order.rb | 56 ++ .../ruby-idiomatic/lib/petstore/models/pet.rb | 55 ++ .../ruby-idiomatic/lib/petstore/models/tag.rb | 34 + .../lib/petstore/models/user.rb | 64 ++ .../lib/petstore/polymorphism.rb | 168 ++++ .../ruby-idiomatic/lib/petstore/response.rb | 31 + .../lib/petstore/serializable.rb | 50 ++ .../lib/petstore/validations.rb | 87 +++ .../ruby-idiomatic/lib/petstore/version.rb | 5 + .../petstore/ruby-idiomatic/petstore.gemspec | 23 + .../ruby-idiomatic/spec/api/pet_spec.rb | 12 + .../spec/api/store/order_spec.rb | 12 + .../ruby-idiomatic/spec/api/store_spec.rb | 12 + .../ruby-idiomatic/spec/api/user_spec.rb | 12 + .../spec/models/api_response_spec.rb | 26 + .../spec/models/category_spec.rb | 26 + .../ruby-idiomatic/spec/models/order_spec.rb | 26 + .../ruby-idiomatic/spec/models/pet_spec.rb | 26 + .../ruby-idiomatic/spec/models/tag_spec.rb | 26 + .../ruby-idiomatic/spec/models/user_spec.rb | 26 + .../ruby-idiomatic/spec/spec_helper.rb | 27 + 795 files changed, 27388 insertions(+) create mode 100644 .github/workflows/samples-ruby-idiomatic.yaml create mode 100644 bin/configs/ruby-idiomatic-qdrant.yaml create mode 100644 bin/configs/ruby-idiomatic.yaml create mode 100644 docs/generators/ruby-idiomatic.md create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyIdiomaticClientCodegen.java create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/rubyidiomatic/RubyApiRouting.java create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/Gemfile.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/LICENSE.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/Rakefile.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/api_error.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/api_info.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/api_operations.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rspec.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rubocop.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/client.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/configuration.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/connection.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/gem.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/gemspec.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/github-workflow.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/gitignore.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/model_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_anyof.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_enum_class.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_generic.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_oneof_module.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/polymorphism.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/response.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/rspec.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/rubocop.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/serializable.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/spec_helper.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/validations.mustache create mode 100644 modules/openapi-generator/src/main/resources/ruby-idiomatic/version.mustache create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyApiRoutingTest.java create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyIdiomaticClientCodegenTest.java create mode 100644 modules/openapi-generator/src/test/resources/3_0/ruby-idiomatic/acronym.yaml create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.github/workflows/ci.yml create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.gitignore create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.openapi-generator-ignore create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/FILES create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/VERSION create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.rspec create mode 100644 samples/client/others/ruby-idiomatic-qdrant/.rubocop.yml create mode 100644 samples/client/others/ruby-idiomatic-qdrant/Gemfile create mode 100644 samples/client/others/ruby-idiomatic-qdrant/LICENSE create mode 100644 samples/client/others/ruby-idiomatic-qdrant/README.md create mode 100644 samples/client/others/ruby-idiomatic-qdrant/Rakefile create mode 100644 samples/client/others/ruby-idiomatic-qdrant/bin/rspec create mode 100644 samples/client/others/ruby-idiomatic-qdrant/bin/rubocop create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/aliases.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster/peer.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/index.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/points.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/shards.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/snapshots.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/healthz.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/issues.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/livez.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/locks.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/metrics.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/readyz.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/root.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/snapshots.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api_error.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/client.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/configuration.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/connection.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_shard_transfer.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_transfer_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_description.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_operations.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/any_variants.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_build_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_features_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_payloads_inner.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_update200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_vector_struct.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/change_aliases_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/clear_payload_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_config_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_operations.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of1.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_description.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_existence.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_exists200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry_enum.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aggregated_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aliases_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/compression_ratio.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_config_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of1.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of2.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_example_pair.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_input.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_pair.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_result.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_collection.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_shard_key200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_snapshot200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datatype.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_range.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/direction.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/disabled.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input_context.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request_batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/distance.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/document.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_replica_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/extended_point_id.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value_hit.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/field_condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must_not.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_selector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_should.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_bounding_box.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_line_string.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_point.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_polygon.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_radius.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection_aliases200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collections200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_locks200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_point200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/group_id.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/groups_result.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/grpc_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/has_id_condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of1.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/init_from.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_empty_condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_null_condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/list_snapshots200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/locks_option.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/lookup_location.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_any.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_except.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_text.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_value.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/message_send_errors.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/min_should.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/modifier.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_comparator.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_sparse_vector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector_struct.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nearest_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested_condition.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/operation_duration_statistics.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizer_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_interface.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_value.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/overwrite_payload_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/p2p_config_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field_schema.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_exclude.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_include.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of1.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/peer_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_group.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_ids_list.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_insert_operations.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_struct.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_vectors.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_list.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_selector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch_prefetch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_search_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_batch_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_groups_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_interface.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_prefetch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/raft_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range_interface.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_example.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_groups_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_input.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request_batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_strategy.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/record.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recover_from_uploaded_snapshot202_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_set_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_state.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/requests_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_direction.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/running_environment_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample_query.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scored_point.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_result.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_batch_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_groups_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pair.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_point_groups200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_points200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request_batch.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key_selector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_location.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_recover.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_method.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sharding_method.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_description.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_priority.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_recover.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_data_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/start_from.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/state_role.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry200_response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry_data.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tokenizer_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of1.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_collection.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operations.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_result.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_status.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/upsert_operation.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/value_variants.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/values_count.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_index_searches_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_input.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_datatype.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_type.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_struct.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vectors_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/version_info.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config_diff.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/web_api_telemetry.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup_interface.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_payload_interface.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_vector.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/write_ordering.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/polymorphism.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/response.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/serializable.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/validations.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/version.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/qdrant.gemspec create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/aliases_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster/peer_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/index_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/points_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/shards_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/snapshots_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/collections_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/healthz_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/issues_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/livez_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/locks_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/metrics_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/readyz_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/root_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/snapshots_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/api/telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_shard_transfer_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_transfer_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_description_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_operations_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/any_variants_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/app_build_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/app_features_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_payloads_inner_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_update200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_vector_struct_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/change_aliases_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/clear_payload_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_config_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_operations_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of1_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_description_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_existence_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_exists200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_enum_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aggregated_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aliases_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/compression_ratio_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_config_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of1_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of2_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/context_example_pair_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/context_input_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/context_pair_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/context_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/count_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/count_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/count_result_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_collection_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_shard_key200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/create_snapshot200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/datatype_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_range_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/direction_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/disabled_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_context_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/distance_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/document_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_replica_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/extended_point_id_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/facet200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_hit_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/field_condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_not_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_selector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_should_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_bounding_box_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_line_string_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_point_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_polygon_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_radius_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection_aliases200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collections200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_locks200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_point200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/get_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/group_id_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/groups_result_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/grpc_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/has_id_condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of1_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/init_from_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/is_empty_condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/is_null_condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/list_snapshots200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/locks_option_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/lookup_location_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/match_any_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/match_except_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/match_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/match_text_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/match_value_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/message_send_errors_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/min_should_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/modifier_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_comparator_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/named_sparse_vector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_struct_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/nearest_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_condition_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/operation_duration_statistics_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizer_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_interface_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/order_value_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/overwrite_payload_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/p2p_config_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_schema_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_exclude_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_include_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of1_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/peer_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_group_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_ids_list_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_insert_operations_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_struct_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/point_vectors_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/points_batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/points_list_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/points_selector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_prefetch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_search_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_batch_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_groups_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_interface_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_prefetch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/raft_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/range_interface_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/range_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_example_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_groups_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_input_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_strategy_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/record_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_set_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_state_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/requests_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_direction_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/running_environment_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_query_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scored_point_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_result_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_batch_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_groups_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pair_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_point_groups200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_points200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_batch_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_selector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_location_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_recover_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_method_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sharding_method_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_description_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_priority_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_recover_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_data_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/start_from_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/state_role_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry200_response_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry_data_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/tokenizer_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of1_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_collection_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operations_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_result_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_status_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/upsert_operation_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/value_variants_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/values_count_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_index_searches_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_input_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_datatype_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_type_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_struct_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/vectors_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/version_info_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_diff_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/web_api_telemetry_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_interface_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/with_payload_interface_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/with_vector_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/models/write_ordering_spec.rb create mode 100644 samples/client/others/ruby-idiomatic-qdrant/spec/spec_helper.rb create mode 100644 samples/client/petstore/ruby-idiomatic/.github/workflows/ci.yml create mode 100644 samples/client/petstore/ruby-idiomatic/.gitignore create mode 100644 samples/client/petstore/ruby-idiomatic/.openapi-generator-ignore create mode 100644 samples/client/petstore/ruby-idiomatic/.openapi-generator/FILES create mode 100644 samples/client/petstore/ruby-idiomatic/.openapi-generator/VERSION create mode 100644 samples/client/petstore/ruby-idiomatic/.rspec create mode 100644 samples/client/petstore/ruby-idiomatic/.rubocop.yml create mode 100644 samples/client/petstore/ruby-idiomatic/Gemfile create mode 100644 samples/client/petstore/ruby-idiomatic/LICENSE create mode 100644 samples/client/petstore/ruby-idiomatic/README.md create mode 100644 samples/client/petstore/ruby-idiomatic/Rakefile create mode 100644 samples/client/petstore/ruby-idiomatic/bin/rspec create mode 100644 samples/client/petstore/ruby-idiomatic/bin/rubocop create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/api/pet.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/api/store.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/api/store/order.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/api/user.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/api_error.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/client.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/configuration.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/connection.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/api_response.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/category.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/order.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/pet.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/tag.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/models/user.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/polymorphism.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/response.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/serializable.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/validations.rb create mode 100644 samples/client/petstore/ruby-idiomatic/lib/petstore/version.rb create mode 100644 samples/client/petstore/ruby-idiomatic/petstore.gemspec create mode 100644 samples/client/petstore/ruby-idiomatic/spec/api/pet_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/api/store/order_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/api/store_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/api/user_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/api_response_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/category_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/order_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/pet_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/tag_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/models/user_spec.rb create mode 100644 samples/client/petstore/ruby-idiomatic/spec/spec_helper.rb diff --git a/.github/workflows/samples-ruby-idiomatic.yaml b/.github/workflows/samples-ruby-idiomatic.yaml new file mode 100644 index 000000000000..074824df14df --- /dev/null +++ b/.github/workflows/samples-ruby-idiomatic.yaml @@ -0,0 +1,34 @@ +name: Samples Ruby Idiomatic + +on: + push: + paths: + - 'samples/client/petstore/ruby-idiomatic/**' + - 'samples/client/others/ruby-idiomatic-qdrant/**' + pull_request: + paths: + - 'samples/client/petstore/ruby-idiomatic/**' + - 'samples/client/others/ruby-idiomatic-qdrant/**' + +jobs: + build: + name: Build Ruby Idiomatic client + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/client/petstore/ruby-idiomatic + ruby-version: + - '3.0' + - '3.3' + steps: + - uses: actions/checkout@v7 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - name: Install and test + working-directory: ${{ matrix.sample }} + run: | + bundle install + bundle exec rspec diff --git a/bin/configs/ruby-idiomatic-qdrant.yaml b/bin/configs/ruby-idiomatic-qdrant.yaml new file mode 100644 index 000000000000..c8f813d3dae9 --- /dev/null +++ b/bin/configs/ruby-idiomatic-qdrant.yaml @@ -0,0 +1,13 @@ +generatorName: ruby-idiomatic +outputDir: samples/client/others/ruby-idiomatic-qdrant +inputSpec: modules/openapi-generator/src/test/resources/3_0/crystal/qdrant.json +templateDir: modules/openapi-generator/src/main/resources/ruby-idiomatic +globalProperties: + apiTests: "true" + modelTests: "true" + apiDocs: "false" + modelDocs: "false" +additionalProperties: + gemName: qdrant + moduleName: Qdrant + gemVersion: 1.0.0 diff --git a/bin/configs/ruby-idiomatic.yaml b/bin/configs/ruby-idiomatic.yaml new file mode 100644 index 000000000000..57d6b6fae3e7 --- /dev/null +++ b/bin/configs/ruby-idiomatic.yaml @@ -0,0 +1,13 @@ +generatorName: ruby-idiomatic +outputDir: samples/client/petstore/ruby-idiomatic +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/ruby-idiomatic +globalProperties: + apiTests: "true" + modelTests: "true" + apiDocs: "false" + modelDocs: "false" +additionalProperties: + gemName: petstore + moduleName: Petstore + gemVersion: 1.0.0 diff --git a/docs/generators.md b/docs/generators.md index ed22c4b53e16..2729a40542aa 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -58,6 +58,7 @@ The following generators are available: * [python-pydantic-v1](generators/python-pydantic-v1.md) * [r](generators/r.md) * [ruby](generators/ruby.md) +* [ruby-idiomatic (beta)](generators/ruby-idiomatic.md) * [rust](generators/rust.md) * [scala-akka](generators/scala-akka.md) * [scala-gatling](generators/scala-gatling.md) diff --git a/docs/generators/ruby-idiomatic.md b/docs/generators/ruby-idiomatic.md new file mode 100644 index 000000000000..e8be3db0abe1 --- /dev/null +++ b/docs/generators/ruby-idiomatic.md @@ -0,0 +1,230 @@ +--- +title: Documentation for the ruby-idiomatic Generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | ruby-idiomatic | pass this to the generate command after -g | +| generator stability | BETA | | +| generator type | CLIENT | | +| generator language | Ruby | | +| generator default templating engine | mustache | | +| helpTxt | Generates an idiomatic Ruby client library (Faraday, Zeitwerk, namespaced sub-clients). | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|apiNamespace|Module wrapper nesting the API resource classes (default 'Api'); set empty to disable the wrapper.| |Api| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enums are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|gemAuthor|gem author (only one is supported).| |OpenAPI-Generator| +|gemAuthorEmail|gem author email (only one is supported).| |null| +|gemDescription|gem description.| |A Ruby client generated by openapi-generator| +|gemHomepage|gem homepage.| |https://openapitools.org| +|gemLicense|gem license.| |unlicense| +|gemName|gem name (convention: underscore_case).| |null| +|gemSummary|gem summary.| |A Ruby client generated by openapi-generator| +|gemVersion|gem version.| |null| +|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|moduleName|top module name (convention: CamelCase, usually corresponding to gem name).| |null| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|Array| +|map|Hash| +|set|Set| + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Uuid|✗| +|Array|✓|OAS2,OAS3 +|Null|✗|OAS3 +|AnyType|✗|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✗|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✓|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✗|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✓|OAS2,OAS3 +|Union|✓|OAS3 +|allOf|✓|OAS2,OAS3 +|anyOf|✓|OAS3 +|oneOf|✓|OAS3 +|not|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 +|SignatureAuth|✗|OAS3 +|AWSV4Signature|✗|ToolingExtension + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✗|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyIdiomaticClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyIdiomaticClientCodegen.java new file mode 100644 index 000000000000..932f1c5cfd90 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyIdiomaticClientCodegen.java @@ -0,0 +1,733 @@ +package org.openapitools.codegen.languages; + +import io.swagger.v3.oas.models.*; +import io.swagger.v3.oas.models.media.Schema; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.rubyidiomatic.RubyApiRouting; +import org.openapitools.codegen.model.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.ParameterFeature; +import org.openapitools.codegen.meta.features.SchemaSupportFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.openapitools.codegen.meta.features.WireFormatFeature; +import org.openapitools.codegen.templating.mustache.IndentedLambda; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.File; +import java.util.*; + +import static org.openapitools.codegen.utils.StringUtils.camelize; +import static org.openapitools.codegen.utils.StringUtils.underscore; + +public class RubyIdiomaticClientCodegen extends AbstractRubyCodegen { + private final Logger LOGGER = LoggerFactory.getLogger(RubyIdiomaticClientCodegen.class); + + private static final String GEM_VERSION = "gemVersion"; + private static final String GEM_VERSION_DESC = "gem version."; + + private static final String GEM_AUTHOR = "gemAuthor"; + private static final String GEM_AUTHOR_EMAIL = "gemAuthorEmail"; + private static final String GEM_HOMEPAGE = "gemHomepage"; + private static final String GEM_SUMMARY = "gemSummary"; + private static final String GEM_DESCRIPTION = "gemDescription"; + private static final String GEM_LICENSE = "gemLicense"; + + public static final String API_NAMESPACE = "apiNamespace"; + + // Names of infra classes generated at the moduleName root (client.rb, connection.rb, ...). + // Model names that clash with these are renamed (e.g. "Client" -> "ModelClient") to avoid + // Zeitwerk const collisions. + private static final Set RESERVED_MODEL_NAMES = new HashSet<>(Arrays.asList( + "Client", "Connection", "Configuration", "Response", "ApiError", "Serializable", "Validations", "Polymorphism")); + + // Methods already defined on the generated Client (Client#initialize plus the + // configuration/connection attr_readers). A namespace whose accessor would shadow one + // of these is suffixed so `client.connection` keeps returning the transport, not a + // sub-client. Mirrors the RESERVED_MODEL_NAMES guard, one level up. + private static final Set RESERVED_ACCESSOR_NAMES = new HashSet<>(Arrays.asList( + "initialize", "configuration", "connection", "client")); + + // Prefix for enum constants whose value begins with a digit. A bare "_" prefix would + // collide with Ruby 3.0+ numbered block parameters (_1.._9 are reserved and raise on + // assignment); a letter keeps the constant legal. Mirrors the stock ruby generator. + private static final String NUMERIC_ENUM_PREFIX = "N"; + + // Upper bound (in bytes/chars) for a model file's *base* name (before ".rb"/"_spec.rb"). + // The tar ustar format used by `gem build` caps every path component at 100 bytes, so + // deeply-nested inline body models (whose name concatenates the full request path) must + // be shortened. 72 leaves room for the "_spec.rb" test-file suffix (-> <= 80) with margin. + private static final int MODEL_FILE_MAX = 72; + + protected String gemName; + protected String moduleName; + protected String gemVersion = "1.0.0"; + protected String libFolder = "lib"; + protected String apiNamespace = "Api"; + protected String gemAuthor = "OpenAPI-Generator"; + protected String gemAuthorEmail = ""; + protected String gemHomepage = "https://openapitools.org"; + protected String gemSummary = "A Ruby client generated by openapi-generator"; + protected String gemDescription = "A Ruby client generated by openapi-generator"; + protected String gemLicense = "unlicense"; + + private Set resourceSegments = Collections.emptySet(); + private String apiBasePrefix = ""; + private int emptyMethodNameCounter = 0; + + // Accumulated across postProcessModels calls: file basename -> class name, for every + // autoloaded model. Consumed by postProcessSupportingFileData to emit Zeitwerk + // inflections for names whose acronym casing diverges from the default inflector. + private final java.util.LinkedHashMap modelFileToClass = new java.util.LinkedHashMap<>(); + + public RubyIdiomaticClientCodegen() { + super(); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.BETA) + .build(); + // Honest capability declaration (final whole-branch review FIX 4): the default + // FeatureSet inherited from DefaultCodegen claims XML wire format, Cookie params, + // OAuth2 security, and no Union/anyOf/oneOf/allOf schema support -- the exact + // inverse of what this generator actually does. Correct it here. + modifyFeatureSet(features -> features + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON)) + .includeSchemaSupportFeatures( + SchemaSupportFeature.Union, + SchemaSupportFeature.allOf, + SchemaSupportFeature.anyOf, + SchemaSupportFeature.oneOf + ) + .excludeParameterFeatures( + ParameterFeature.Cookie + ) + .securityFeatures(EnumSet.of( + SecurityFeature.ApiKey, + SecurityFeature.BasicAuth, + SecurityFeature.BearerToken + )) + ); + outputFolder = "generated-code" + File.separator + "ruby-idiomatic"; + modelTemplateFiles.put("model.mustache", ".rb"); + apiTemplateFiles.put("api.mustache", ".rb"); + modelTestTemplateFiles.put("model_test.mustache", ".rb"); + apiTestTemplateFiles.put("api_test.mustache", ".rb"); + embeddedTemplateDir = templateDir = "ruby-idiomatic"; + modelPackage = "models"; + apiPackage = "api"; + cliOptions.add(new CliOption(CodegenConstants.GEM_NAME, CodegenConstants.GEM_NAME_DESC)); + cliOptions.add(new CliOption(CodegenConstants.MODULE_NAME, CodegenConstants.MODULE_NAME_DESC)); + cliOptions.add(new CliOption(GEM_VERSION, GEM_VERSION_DESC)); + cliOptions.add(new CliOption(API_NAMESPACE, "Module wrapper nesting the API resource classes (default 'Api'); set empty to disable the wrapper.").defaultValue("Api")); + cliOptions.add(new CliOption(GEM_AUTHOR, "gem author (only one is supported).").defaultValue(gemAuthor)); + cliOptions.add(new CliOption(GEM_AUTHOR_EMAIL, "gem author email (only one is supported).")); + cliOptions.add(new CliOption(GEM_HOMEPAGE, "gem homepage.").defaultValue(gemHomepage)); + cliOptions.add(new CliOption(GEM_SUMMARY, "gem summary.").defaultValue(gemSummary)); + cliOptions.add(new CliOption(GEM_DESCRIPTION, "gem description.").defaultValue(gemDescription)); + cliOptions.add(new CliOption(GEM_LICENSE, "gem license.").defaultValue(gemLicense)); + } + + @Override + public void processOpts() { + super.processOpts(); + if (additionalProperties.containsKey(CodegenConstants.GEM_NAME)) { + setGemName((String) additionalProperties.get(CodegenConstants.GEM_NAME)); + } + if (additionalProperties.containsKey(CodegenConstants.MODULE_NAME)) { + setModuleName((String) additionalProperties.get(CodegenConstants.MODULE_NAME)); + } + if (gemName == null && moduleName == null) { + setGemName("openapi_client"); + setModuleName(generateModuleName(gemName)); + } else if (gemName == null) { + setGemName(generateGemName(moduleName)); + } else if (moduleName == null) { + setModuleName(generateModuleName(gemName)); + } + additionalProperties.put(CodegenConstants.GEM_NAME, gemName); + additionalProperties.put(CodegenConstants.MODULE_NAME, moduleName); + if (additionalProperties.containsKey(GEM_VERSION)) { + setGemVersion((String) additionalProperties.get(GEM_VERSION)); + } + additionalProperties.put(GEM_VERSION, gemVersion); + if (additionalProperties.containsKey(API_NAMESPACE)) { + setApiNamespace((String) additionalProperties.get(API_NAMESPACE)); + } + additionalProperties.put(API_NAMESPACE, apiNamespace); + if (additionalProperties.containsKey(GEM_AUTHOR)) { + setGemAuthor((String) additionalProperties.get(GEM_AUTHOR)); + } + additionalProperties.put(GEM_AUTHOR, gemAuthor); + if (additionalProperties.containsKey(GEM_AUTHOR_EMAIL)) { + setGemAuthorEmail((String) additionalProperties.get(GEM_AUTHOR_EMAIL)); + } + additionalProperties.put(GEM_AUTHOR_EMAIL, gemAuthorEmail); + if (additionalProperties.containsKey(GEM_HOMEPAGE)) { + setGemHomepage((String) additionalProperties.get(GEM_HOMEPAGE)); + } + additionalProperties.put(GEM_HOMEPAGE, gemHomepage); + if (additionalProperties.containsKey(GEM_SUMMARY)) { + setGemSummary((String) additionalProperties.get(GEM_SUMMARY)); + } + additionalProperties.put(GEM_SUMMARY, gemSummary); + if (additionalProperties.containsKey(GEM_DESCRIPTION)) { + setGemDescription((String) additionalProperties.get(GEM_DESCRIPTION)); + } + additionalProperties.put(GEM_DESCRIPTION, gemDescription); + if (additionalProperties.containsKey(GEM_LICENSE)) { + setGemLicense((String) additionalProperties.get(GEM_LICENSE)); + } + additionalProperties.put(GEM_LICENSE, gemLicense); + // explicit boolean: jmustache treats an empty string section as truthy, so guard the + // api namespace `module` wrapper on this instead of on {{#apiNamespace}}. + additionalProperties.put("apiNamespacePresent", apiNamespace != null && !apiNamespace.isEmpty()); + // api.mustache renders the class body from a single column-0 partial (api_operations) + // and re-indents it via these lambdas so the body sits at the right depth in BOTH module + // shapes: 4 spaces when the `module ` wrapper is present (moduleName + Api + + // class), 2 spaces when it is absent (single `module ` + class, the nested + // moduleName case). skipEmptyLines=true keeps blank separator lines free of the trailing + // whitespace RuboCop's Layout/TrailingWhitespace would otherwise flag. + additionalProperties.put("indent2", new IndentedLambda(2, " ", false, true)); + additionalProperties.put("indent4", new IndentedLambda(4, " ", false, true)); + // Nested moduleName support (e.g. "Dolibarr::Api"): the generated files open + // `module Dolibarr::Api` directly, which raises NameError unless the parent + // `Dolibarr` already exists. Expose the cumulative parent prefixes so gem.rb / + // the gemspec can pre-define them, and flag the nested case so those templates + // switch to `Zeitwerk::Loader.new` + `push_dir(namespace:)` (for_gem can't target + // a nested namespace). Single-level modules keep the exact prior output. + String[] moduleParts = moduleName.split("::"); + boolean moduleNameNested = moduleParts.length > 1; + additionalProperties.put("moduleNameNested", moduleNameNested); + if (moduleNameNested) { + List parents = new ArrayList<>(); + StringBuilder acc = new StringBuilder(); + for (int i = 0; i < moduleParts.length - 1; i++) { + if (i > 0) acc.append("::"); + acc.append(moduleParts[i]); + parents.add(acc.toString()); + } + additionalProperties.put("moduleNameParents", parents); + } + // LICENSE.mustache emits the Unlicense text by default; flag MIT so it can render + // the MIT license body (and keep s.license in the gemspec consistent with the file). + additionalProperties.put("isLicenseMIT", "MIT".equalsIgnoreCase(gemLicense)); + + String gemFolder = libFolder + File.separator + gemName; + supportingFiles.add(new SupportingFile("gem.mustache", libFolder, gemName + ".rb")); + supportingFiles.add(new SupportingFile("client.mustache", gemFolder, "client.rb")); + supportingFiles.add(new SupportingFile("connection.mustache", gemFolder, "connection.rb")); + supportingFiles.add(new SupportingFile("configuration.mustache", gemFolder, "configuration.rb")); + supportingFiles.add(new SupportingFile("response.mustache", gemFolder, "response.rb")); + supportingFiles.add(new SupportingFile("api_error.mustache", gemFolder, "api_error.rb")); + supportingFiles.add(new SupportingFile("serializable.mustache", gemFolder, "serializable.rb")); + supportingFiles.add(new SupportingFile("validations.mustache", gemFolder, "validations.rb")); + supportingFiles.add(new SupportingFile("polymorphism.mustache", gemFolder, "polymorphism.rb")); + supportingFiles.add(new SupportingFile("version.mustache", gemFolder, "version.rb")); + supportingFiles.add(new SupportingFile("gemspec.mustache", "", gemName + ".gemspec")); + supportingFiles.add(new SupportingFile("Gemfile.mustache", "", "Gemfile")); + supportingFiles.add(new SupportingFile("Rakefile.mustache", "", "Rakefile")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("LICENSE.mustache", "", "LICENSE")); + supportingFiles.add(new SupportingFile("rubocop.mustache", "", ".rubocop.yml")); + supportingFiles.add(new SupportingFile("rspec.mustache", "", ".rspec")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("spec_helper.mustache", "spec", "spec_helper.rb")); + supportingFiles.add(new SupportingFile("github-workflow.mustache", ".github/workflows", "ci.yml")); + supportingFiles.add(new SupportingFile("bin_rspec.mustache", "bin", "rspec")); + supportingFiles.add(new SupportingFile("bin_rubocop.mustache", "bin", "rubocop")); + } + + public void setGemName(String gemName) { this.gemName = gemName; } + public void setModuleName(String moduleName) { this.moduleName = moduleName; } + public void setGemVersion(String v) { this.gemVersion = v; } + public void setApiNamespace(String apiNamespace) { this.apiNamespace = apiNamespace; } + public void setGemAuthor(String gemAuthor) { this.gemAuthor = gemAuthor; } + public void setGemAuthorEmail(String gemAuthorEmail) { this.gemAuthorEmail = gemAuthorEmail; } + public void setGemHomepage(String gemHomepage) { this.gemHomepage = gemHomepage; } + public void setGemSummary(String gemSummary) { this.gemSummary = gemSummary; } + public void setGemDescription(String gemDescription) { this.gemDescription = gemDescription; } + public void setGemLicense(String gemLicense) { this.gemLicense = gemLicense; } + public String generateModuleName(String gemName) { return camelize(gemName.replaceAll("[^\\w]+", "_")); } + public String generateGemName(String moduleName) { return underscore(moduleName.replaceAll("[^\\w]+", "")); } + + @Override + public String apiFileFolder() { + return outputFolder + File.separator + libFolder + File.separator + gemName + File.separator + apiPackage.replace("/", File.separator); + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separator + libFolder + File.separator + gemName + File.separator + modelPackage.replace("/", File.separator); + } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separator + "spec" + File.separator + apiPackage.replace("/", File.separator); + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separator + "spec" + File.separator + modelPackage.replace("/", File.separator); + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + @Override + public String getName() { + return "ruby-idiomatic"; + } + + @Override + public String getHelp() { + return "Generates an idiomatic Ruby client library (Faraday, Zeitwerk, namespaced sub-clients)."; + } + + // Ruby method names cannot be empty or begin with a digit. Non-pathological names are + // delegated unchanged to the parent (reserved-word handling + underscore), so existing + // generated method names are untouched; only empty and digit-leading actions are renamed + // (e.g. OVH price-plan segments like "2013v1_bhs1a_filer_hourly" -> "call_2013v1_..."). + @Override + public String toOperationId(String operationId) { + if (operationId == null || operationId.isEmpty()) { + String renamed = "empty_method_name_" + emptyMethodNameCounter++; + LOGGER.warn("ruby-idiomatic: empty method name renamed to `{}`", renamed); + return renamed; + } + if (operationId.matches("^\\d.*")) { + String renamed = underscore("call_" + operationId); + LOGGER.warn("ruby-idiomatic: method name `{}` starts with a digit, renamed to `{}`", operationId, renamed); + return renamed; + } + return super.toOperationId(operationId); + } + + // AbstractRubyCodegen escapes a keyword-named identifier by PREPENDING "_" (module -> + // _module). But these params are *used* in the method body, so a leading underscore + // trips RuboCop's Lint/UnderscorePrefixedVariableName ("used variable with `_` prefix"). + // Append the underscore instead (module -> module_): the conventional keyword escape that + // no cop flags. reservedWordsMappings still win, matching the parent's contract. + @Override + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { + return this.reservedWordsMappings().get(name); + } + return name + "_"; + } + + @Override + public String toModelName(String name) { + String camelized = camelize(sanitizeName(name)); + if (RESERVED_MODEL_NAMES.contains(camelized) || isReservedWord(camelized.toLowerCase(Locale.ROOT))) { + camelized = "Model" + camelized; + } + return shortenModelName(camelized); + } + + // Shorten model names whose file form would overflow tar's per-component limit (see + // MODEL_FILE_MAX). The head is trimmed until underscore(head + suffix) fits, and a stable + // hash of the *full* name is appended so distinct long names never collide even when + // their truncated heads coincide. This is the single source of truth for model naming -- + // toModelFilename derives the file from underscore(this), keeping Zeitwerk consistent. + private String shortenModelName(String camelized) { + if (underscore(camelized).length() <= MODEL_FILE_MAX) { + return camelized; + } + // "H" keeps the suffix a clean camel segment (uppercase-led, underscores to one word). + String suffix = "H" + fnv1a32Hex(camelized); + String head = camelized; + while (!head.isEmpty() && underscore(head + suffix).length() > MODEL_FILE_MAX) { + head = head.substring(0, head.length() - 1); + } + String shortened = head + suffix; + LOGGER.warn("ruby-idiomatic: model name too long for tar, shortened `{}` -> `{}`", camelized, shortened); + return shortened; + } + + // Deterministic 32-bit FNV-1a hash rendered as 8 lowercase hex chars. Used only to + // disambiguate truncated model names; no cryptographic properties are required. + private static String fnv1a32Hex(String s) { + int h = 0x811c9dc5; + for (int i = 0; i < s.length(); i++) { + h ^= s.charAt(i); + h *= 0x01000193; + } + return String.format(Locale.ROOT, "%08x", h); + } + + // DefaultCodegen prefixes a leading-digit enum value with "_", producing illegal Ruby + // constants (_1.._9 are reserved numbered block parameters in Ruby 3.0+). Mirror the + // stock ruby generator instead: a letter prefix keeps every constant legal. + @Override + public String toEnumVarName(String name, String datatype) { + if (enumNameMapping.containsKey(name)) { + return enumNameMapping.get(name); + } + if (name.isEmpty()) { + return "EMPTY"; + } + if ("Integer".equals(datatype) || "Float".equals(datatype)) { + String varName = name + .replace("-", "MINUS_") + .replace("+", "PLUS_") + .replace(".", "_DOT_"); + return varName.matches("^\\d.*") ? NUMERIC_ENUM_PREFIX + varName : varName; + } + // Standard case (mirrors the stock ruby generator): upcase the underscored value. + // Keeps meaningful separators intact -- "average_vector" -> "AVERAGE_VECTOR", + // "best-score" -> "BEST_SCORE". + String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)) + .replaceFirst("^_+", "") + .replaceFirst("_+$", ""); + if (enumName.isEmpty()) { + // Purely-symbolic values (telephony IVR keys "#"/"*", comparison operators, ...) + // sanitize to nothing. Translate each symbol to its word name (e.g. "#" -> "Hash", + // "*" -> "Star") so the constant is legal AND meaningful. + String translated = org.openapitools.codegen.utils.StringUtils + .escape(name, specialCharReplacements, null, null); + enumName = sanitizeName(underscore(translated).toUpperCase(Locale.ROOT)) + .replaceFirst("^_+", "") + .replaceFirst("_+$", ""); + } + if (enumName.isEmpty()) { + // Nothing survived even word-translation -> deterministic, collision-free fallback. + enumName = "VALUE_" + fnv1a32Hex(name).toUpperCase(Locale.ROOT); + } + return enumName.matches("^\\d.*") ? NUMERIC_ENUM_PREFIX + enumName : enumName; + } + + @Override + public String toModelFilename(String name) { + return underscore(toModelName(name)); + } + + @Override + public String toModelTestFilename(String name) { + return toModelFilename(name) + "_spec"; + } + + @Override + public String toApiTestFilename(String name) { + return toApiFilename(name) + "_spec"; + } + + @Override + public String toApiFilename(String name) { + String[] parts = name.split("/"); + List out = new ArrayList<>(); + for (String p : parts) out.add(underscore(p.replace('-', '_'))); + // Join with '/' (not File.separator): the api sub-path must be identical on all + // platforms so generated output and the FILES manifest match on Windows too. + return String.join("/", out); + } + + @Override + public String toApiName(String name) { + // HYBRID NAMESPACING (design spec decision #13, mirrors CrystalClientCodegen): + // this produces the COMPACT resource leaf ("dcim/cable-terminations" -> + // "Dcim::CableTerminations"). The api.mustache template nests moduleName + the + // `Api` wrapper as `module` blocks, then declares `class ` compact. + // Unlike Crystal, we deliberately do NOT prefix the api-namespace wrapper here + // (Crystal prefixes then strips via x-cr-api-inner-class) -- keep this split. + // The `Api` wrapper itself is templated via the `apiNamespace` CliOption (default + // "Api", empty disables it) and applied purely in api.mustache; see API_NAMESPACE. + String[] parts = name.split("/"); + List out = new ArrayList<>(); + for (String p : parts) out.add(camelize(p.replace('-', '_'))); + return String.join("::", out); + } + + @Override + public String toEnumValue(String value, String datatype) { + if ("Integer".equals(datatype) || "Float".equals(datatype)) { + return value; + } + return "'" + escapeText(value).replace("'", "\\'") + "'"; + } + + // DefaultCodegen#getSchemaType returns the raw OAI type (e.g. "number", "integer") for + // top-level (model-level) enum schemas, whereas CodegenProperty#dataType goes through + // getTypeDeclaration/typeMapping and already yields "Integer"/"Float". Without this + // override, model-level numeric enums (e.g. a schema whose type is `number`/`integer` with + // an `enum:` list) would never match the toEnumValue check above and would stay quoted. + // Mirrors RubyClientCodegen.getSchemaType. + @Override + public String getSchemaType(Schema schema) { + String openAPIType = super.getSchemaType(schema); + String type; + if (typeMapping.containsKey(openAPIType)) { + type = typeMapping.get(openAPIType); + if (languageSpecificPrimitives.contains(type)) { + return type; + } + } else { + type = openAPIType; + } + if (type == null) { + return null; + } + return toModelName(type); + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + Set paths = openAPI.getPaths() == null + ? Collections.emptySet() : openAPI.getPaths().keySet(); + this.resourceSegments = RubyApiRouting.resourceSegments(paths); + this.apiBasePrefix = additionalProperties.containsKey("apiBasePath") + ? stripSlashes((String) additionalProperties.get("apiBasePath")) + : RubyApiRouting.commonBasePrefix(paths); + } + + private static String stripSlashes(String s) { + return s == null ? "" : s.replaceAll("^/+", "").replaceAll("/+$", ""); + } + + @Override + public void addOperationToGroup(String tag, String resourcePath, Operation operation, + CodegenOperation co, Map> operations) { + RubyApiRouting.Route r = RubyApiRouting.route( + co.path, co.httpMethod, co.operationId, resourceSegments, apiBasePrefix); + String groupKey = r.resource == null ? r.namespace : r.namespace + "/" + r.resource; + co.operationId = toOperationId(r.action); + co.vendorExtensions.put("x-rb-namespace", r.namespace); + if (r.resource != null) co.vendorExtensions.put("x-rb-resource", r.resource); + co.baseName = groupKey; + List opList = operations.computeIfAbsent(groupKey, k -> new ArrayList<>()); + // An operation carrying multiple tags is delivered once per tag; because we group by + // PATH (not by tag), those extra deliveries would emit duplicate methods (a single + // GET .../cluster becoming both `cluster` and `cluster_get`). A path+verb pair is + // unique in an OpenAPI document, so if it is already present this is a re-delivery -- + // skip it. + for (CodegenOperation existing : opList) { + if (existing.path.equals(co.path) && existing.httpMethod.equals(co.httpMethod)) { + return; + } + } + // operationId uniqueness within the group (verb suffix on collision); + // re-scan after each mutation so 2+ prior collisions are handled correctly. + String unique = co.operationId; + int counter = 0; + boolean clash = uniqueClash(opList, unique); + while (clash) { + unique = co.operationId + "_" + co.httpMethod.toLowerCase(Locale.ROOT) + + (counter == 0 ? "" : "_" + counter); + counter++; + clash = uniqueClash(opList, unique); + } + if (!unique.equals(co.operationId)) { + LOGGER.warn("ruby-idiomatic: action collision, renamed `{}` -> `{}`", co.operationId, unique); + co.operationId = unique; + } + opList.add(co); + } + + /** Returns true if any operation in {@code opList} already uses {@code candidate} as its operationId. */ + private static boolean uniqueClash(List opList, String candidate) { + for (CodegenOperation op : opList) { + if (op.operationId.equals(candidate)) return true; + } + return false; + } + + // Zeitwerk's default Inflector#camelize, reproduced to detect divergence: + // basename.split('_').map { seg -> Character.toUpperCase(seg[0]) + seg.substring(1) }.join + // Segments are already lowercase in file names, so acronyms lose their casing here. + private static String zeitwerkCamelize(String filename) { + StringBuilder b = new StringBuilder(); + for (String seg : filename.split("_")) { + if (seg.isEmpty()) continue; + b.append(Character.toUpperCase(seg.charAt(0))).append(seg.substring(1)); + } + return b.toString(); + } + + // Last "::"-separated component of a (possibly qualified) constant name -- the leaf that + // Zeitwerk resolves from a single file/dir basename. "DedicatedCloud::TwoFAWhitelist" -> + // "TwoFAWhitelist"; a bare "Config" is returned unchanged. + private static String lastConstantSegment(String className) { + int i = className.lastIndexOf("::"); + return i < 0 ? className : className.substring(i + 2); + } + + // A namespace accessor that would collide with the Client's own methods is suffixed + // (e.g. a namespace named "connection" -> `client.connection_api`) so the real + // configuration/connection accessors keep working. + private static String safeAccessorName(String name) { + return RESERVED_ACCESSOR_NAMES.contains(name) ? name + "_api" : name; + } + + @Override + @SuppressWarnings("unchecked") + public Map postProcessSupportingFileData(Map objs) { + Map> nsMap = new TreeMap<>(); + Map> resourcesByNs = new TreeMap<>(); + Map apiInfo = (Map) objs.get("apiInfo"); + if (apiInfo != null) { + List> apis = (List>) apiInfo.get("apis"); + if (apis != null) { + for (Map api : apis) { + Map ops = (Map) api.get("operations"); + if (ops == null) continue; + List opList = (List) ops.get("operation"); + if (opList == null) continue; + for (CodegenOperation co : opList) { + String ns = (String) co.vendorExtensions.get("x-rb-namespace"); + String res = (String) co.vendorExtensions.get("x-rb-resource"); + if (ns == null) continue; + nsMap.computeIfAbsent(ns, k -> { + Map m = new HashMap<>(); + String base = underscore(sanitizeName(ns.replace('-', '_'))); + m.put("name", base); + // `accessor` is the Client method name; `name` stays the on-disk + // dir basename (Zeitwerk inflection key), so guarding one never + // desyncs the other. + m.put("accessor", safeAccessorName(base)); + m.put("className", toApiName(ns)); + return m; + }); + if (res != null) resourcesByNs.computeIfAbsent(ns, k -> new TreeSet<>()).add(res); + } + } + } + } + List> nsList = new ArrayList<>(); + for (Map.Entry> e : nsMap.entrySet()) { + Map m = e.getValue(); + List> resources = new ArrayList<>(); + for (String res : resourcesByNs.getOrDefault(e.getKey(), Collections.emptySet())) { + Map rm = new HashMap<>(); + rm.put("accessor", underscore(sanitizeName(res.replace('-', '_')))); + rm.put("className", toApiName(e.getKey() + "/" + res)); + resources.add(rm); + } + m.put("resources", resources); + nsList.add(m); + } + additionalProperties.put("rbNamespaces", nsList); + objs.put("rbNamespaces", nsList); + + // Zeitwerk inflections: for every autoloaded file whose constant name does not match + // what the default inflector would camelize from the file name (acronyms like HTTP, + // IP, API, URL, FA, ...), register an explicit exception on the loader. This covers + // BOTH models (models/http_config.rb -> HTTPConfig) AND API resource/namespace classes + // (api/dedicated_cloud/two_fa_whitelist.rb -> DedicatedCloud::TwoFAWhitelist). Emitting + // an extra inflection is harmless (it just re-asserts the default); OMITTING one breaks + // autoloading -- so when in doubt, emit. Keyed by file basename and thus GLOBAL to the + // loader: if two files in different dirs shared a basename with divergent constants the + // last would win, but generated names are specific enough that this cannot occur. + Map fileToConstant = new LinkedHashMap<>(modelFileToClass); + // API namespace directories (dir basename -> namespace module) and their resource + // files (file basename -> leaf class). className is qualified (A::B); Zeitwerk keys on + // the single path segment, so only the last "::" component matters per basename. + for (Map ns : nsList) { + fileToConstant.putIfAbsent((String) ns.get("name"), lastConstantSegment((String) ns.get("className"))); + List> resources = (List>) ns.get("resources"); + for (Map res : resources) { + fileToConstant.putIfAbsent((String) res.get("accessor"), lastConstantSegment((String) res.get("className"))); + } + } + List> inflections = new ArrayList<>(); + for (Map.Entry e : fileToConstant.entrySet()) { + String file = e.getKey(); + String klass = e.getValue(); + if (!klass.equals(zeitwerkCamelize(file))) { + Map inflection = new LinkedHashMap<>(); + inflection.put("key", file); + inflection.put("value", klass); + inflections.add(inflection); + } + } + additionalProperties.put("zeitwerkInflections", inflections); + objs.put("zeitwerkInflections", inflections); + return objs; + } + + @Override + public ModelsMap postProcessModels(ModelsMap objs) { + objs = postProcessModelsEnum(objs); + for (ModelMap mo : objs.getModels()) { + CodegenModel cm = mo.getModel(); + // Record file basename -> class name so postProcessSupportingFileData can emit + // Zeitwerk inflections for acronym names (e.g. http_config.rb -> HTTPConfig). + modelFileToClass.put(cm.classFilename, cm.classname); + for (CodegenProperty prop : cm.vars) { + boolean validated = prop.isEnum || prop.hasValidation || prop.required; + prop.vendorExtensions.put("x-rb-validated", validated); + if (prop.defaultValue != null && !"null".equals(prop.defaultValue)) { + prop.vendorExtensions.put("x-rb-default", prop.defaultValue); + } + } + if (cm.discriminator != null) { + cm.vendorExtensions.put("x-rb-discriminator-prop", cm.discriminator.getPropertyBaseName()); + // Templates iterating `{{#discriminator}}` switch the mustache context to the + // CodegenDiscriminator instance, which carries its own (normally empty) + // vendorExtensions map; that shadows the model's map and breaks fallback + // lookups. Mirror the extension onto the discriminator itself so + // `{{vendorExtensions.x-rb-discriminator-prop}}` resolves inside that section too. + cm.discriminator.getVendorExtensions().put("x-rb-discriminator-prop", cm.discriminator.getPropertyBaseName()); + } + // Models that permit additionalProperties (either a typed map -- + // additionalPropertiesType set -- or a bare `additionalProperties: true`/free-form + // object -- isAdditionalPropertiesTrue) get an overflow store so unknown JSON keys + // round-trip through from_hash/to_hash instead of being silently dropped. Gated so + // models without additionalProperties are byte-for-byte unchanged. + if (cm.getAdditionalPropertiesType() != null || cm.isAdditionalPropertiesTrue) { + cm.vendorExtensions.put("x-rb-additional-properties", true); + } + } + return objs; + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + OperationMap ops = objs.getOperations(); + for (CodegenOperation co : ops.getOperation()) { + String rt; + if (co.returnBaseType == null) { + rt = "nil"; + } else { + // returnBaseType is the raw OAS type for primitives (e.g. "integer") but the + // already-mapped Ruby class name for models (e.g. "Pet"); run it through + // typeMapping so primitive returns render as `Integer`/`String`/etc. + String mapped = typeMapping().getOrDefault(co.returnBaseType, co.returnBaseType); + // Primitives are top-level Ruby core classes (Integer, String, ...) and must + // NOT be module-qualified; only generated model classes live under moduleName. + // languageSpecificPrimitives (Boolean, Integer, Float, String, ...) and Object are + // not Ruby constants Connection#deserialize can dispatch on -- Boolean in + // particular is not a real Ruby class/module and referencing it bare raises + // NameError before the HTTP call is even made. Connection#deserialize returns the + // parsed JSON unchanged when `type` is nil, which is the correct behavior for all + // of these, so emit `nil` instead of a bare/qualified primitive class reference. + boolean isPrimitive = languageSpecificPrimitives().contains(mapped) || "Object".equals(mapped); + // Generated models/enums/oneOf-anyOf wrappers live under `::Models::` + // (see model.mustache). The return type must include the Models:: segment, otherwise + // the bare `::` reference raises NameError the first time an + // operation is actually invoked (api specs only check reachability, so this stays + // latent until a real call). + String baseType = (moduleName == null || isPrimitive) ? mapped : moduleName + "::Models::" + mapped; + // Connection#deserialize only special-cases Array (`type.is_a?(Array)`); everything + // else (scalars, maps) is passed through as a bare class reference. + if (isPrimitive) { + // primitive (or array-of-primitive/map-of-primitive): pass the data through + // unchanged rather than referencing an undefined/non-dispatchable Ruby type. + rt = "nil"; + } else if (co.isMap) { + // typed map-of-model deserialization not yet supported; pass through as Hash + rt = "nil"; + } else { + rt = co.isArray ? "[" + baseType + "]" : baseType; + } + } + co.vendorExtensions.put("x-rb-return-type", rt); + // Whether any parameter is required, so api.mustache can emit the required-nil + // guard block followed by a single blank line (and omit both when there are none). + boolean hasRequired = co.allParams.stream().anyMatch(p -> p.required); + co.vendorExtensions.put("x-rb-has-required-params", hasRequired); + } + return objs; + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/rubyidiomatic/RubyApiRouting.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/rubyidiomatic/RubyApiRouting.java new file mode 100644 index 000000000000..85895dc912f2 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/rubyidiomatic/RubyApiRouting.java @@ -0,0 +1,146 @@ +// RubyApiRouting.java +package org.openapitools.codegen.languages.rubyidiomatic; + +import java.util.*; +import org.openapitools.codegen.utils.StringUtils; + +// NOTE: Intentional copy of CrystalApiRouting. The path->route logic is +// language-agnostic; it is duplicated (not shared) to keep each generator +// fully decoupled and avoid modifying the already-shipped Crystal generator. +/** Pure routing logic for the Ruby-idiomatic generator: path -> (namespace, resource, action). */ +public final class RubyApiRouting { + private RubyApiRouting() {} + + private static boolean isParam(String seg) { return seg.startsWith("{") && seg.endsWith("}"); } + + private static List segments(String path) { + List out = new ArrayList<>(); + for (String s : path.split("/")) { + if (!s.isEmpty()) out.add(s); + } + return out; + } + + /** Segments that appear immediately before a {param} in at least one path. */ + public static Set resourceSegments(Collection paths) { + Set r = new HashSet<>(); + for (String path : paths) { + List segs = segments(path); + for (int i = 0; i < segs.size(); i++) { + if (!isParam(segs.get(i)) && i + 1 < segs.size() && isParam(segs.get(i + 1))) { + r.add(segs.get(i)); + } + } + } + return r; + } + + /** Longest leading run of identical literal segments shared by all paths. */ + public static String commonBasePrefix(Collection paths) { + List> all = new ArrayList<>(); + for (String p : paths) all.add(segments(p)); + StringBuilder prefix = new StringBuilder(); + for (int i = 0; ; i++) { + String candidate = null; + for (List segs : all) { + if (i >= segs.size() || isParam(segs.get(i))) return prefix.toString(); + if (candidate == null) candidate = segs.get(i); + else if (!candidate.equals(segs.get(i))) return prefix.toString(); + } + if (candidate == null) return prefix.toString(); + // only treat as base prefix if every path has more segments after it + for (List segs : all) if (segs.size() <= i + 1) return prefix.toString(); + if (prefix.length() > 0) prefix.append("/"); + prefix.append(candidate); + } + } + + /** Literal segments after stripping the base prefix and dropping {param} segments. */ + public static List literals(String path, String basePrefix) { + List segs = segments(path); + List prefix = basePrefix.isEmpty() ? Collections.emptyList() : segments(basePrefix); + int start = 0; + if (!prefix.isEmpty() && segs.size() >= prefix.size() + && segs.subList(0, prefix.size()).equals(prefix)) { + start = prefix.size(); + } + List out = new ArrayList<>(); + for (int i = start; i < segs.size(); i++) { + if (!isParam(segs.get(i))) out.add(segs.get(i)); + } + return out; + } + + /** Route triple: (namespace, resource, action). Resource may be null. */ + public static final class Route { + public final String namespace; + public final String resource; // nullable + public final String action; + public Route(String namespace, String resource, String action) { + this.namespace = namespace; + this.resource = resource; + this.action = action; + } + } + + private static String underscore(String s) { + return StringUtils.underscore(s); + } + + public static Route route(String path, String httpMethod, String operationId, + Set rset, String basePrefix) { + List lits = literals(path, basePrefix); + if (lits.isEmpty()) { + return new Route("root", null, verbAction(httpMethod, endsWithParam(path))); + } + String namespace = lits.get(0); + String resource = null; + int actionStart = 1; + if (lits.size() >= 2 && rset.contains(lits.get(1))) { + resource = lits.get(1); + actionStart = 2; + } + String group = resource == null ? namespace : namespace + "_" + resource; + String action = deriveAction(lits, actionStart, group, httpMethod, operationId, endsWithParam(path)); + return new Route(namespace, resource, action); + } + + private static boolean endsWithParam(String path) { + List segs = segments(path); + return !segs.isEmpty() && isParam(segs.get(segs.size() - 1)); + } + + private static String deriveAction(List lits, int actionStart, String group, + String httpMethod, String operationId, boolean item) { + // (a) operationId minus the group prefix + if (operationId != null && !operationId.isEmpty()) { + String op = underscore(operationId); + String g = underscore(group) + "_"; + if (op.startsWith(g) && op.length() > g.length()) { + return op.substring(g.length()); + } + } + // (b) remaining literal action segments + if (actionStart < lits.size()) { + StringBuilder sb = new StringBuilder(); + for (int i = actionStart; i < lits.size(); i++) { + if (sb.length() > 0) sb.append("_"); + sb.append(underscore(lits.get(i))); + } + return sb.toString(); + } + // (c) collection-aware verb CRUD + return verbAction(httpMethod, item); + } + + private static String verbAction(String httpMethod, boolean item) { + switch (httpMethod.toUpperCase(java.util.Locale.ROOT)) { + case "GET": return item ? "get" : "list"; + case "POST": return "create"; + case "PUT": return item ? "update" : "bulk_update"; + case "PATCH": return item ? "partial_update" : "bulk_partial_update"; + case "DELETE": return item ? "delete" : "bulk_destroy"; + default: return httpMethod.toLowerCase(java.util.Locale.ROOT); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 57a8381c0c22..5bfff2c8e617 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -121,6 +121,7 @@ org.openapitools.codegen.languages.PythonAiohttpConnexionServerCodegen org.openapitools.codegen.languages.PythonBluePlanetServerCodegen org.openapitools.codegen.languages.RClientCodegen org.openapitools.codegen.languages.RubyClientCodegen +org.openapitools.codegen.languages.RubyIdiomaticClientCodegen org.openapitools.codegen.languages.RubyOnRailsServerCodegen org.openapitools.codegen.languages.RubySinatraServerCodegen org.openapitools.codegen.languages.RustAxumServerCodegen diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/Gemfile.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/Gemfile.mustache new file mode 100644 index 000000000000..13f7bcbba8ef --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/Gemfile.mustache @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake' + gem 'rspec', '~> 3.6' + gem 'simplecov', require: false + + # Linter / static analysis + gem 'rubocop', require: false + gem 'rubocop-performance', require: false + gem 'rubocop-rake', require: false + gem 'rubocop-rspec', require: false +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/LICENSE.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/LICENSE.mustache new file mode 100644 index 000000000000..e243ab75939f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/LICENSE.mustache @@ -0,0 +1,49 @@ +{{#isLicenseMIT}} +MIT License + +Copyright (c) {{gemAuthor}} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +{{/isLicenseMIT}} +{{^isLicenseMIT}} +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to +{{/isLicenseMIT}} diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/README.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/README.mustache new file mode 100644 index 000000000000..efdaf524082f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/README.mustache @@ -0,0 +1,137 @@ +# {{gemName}} + +{{#appName}}Ruby client for **{{appName}}**.{{/appName}}{{^appName}}Idiomatic Ruby API client.{{/appName}} Generated by [OpenAPI Generator](https://openapi-generator.tech) (`ruby-idiomatic`). + +- Requires Ruby >= 3.0 +- HTTP via [Faraday](https://github.com/lostisland/faraday) +- Lazy class loading via [Zeitwerk](https://github.com/fxn/zeitwerk) + +## Installation + +Add to your `Gemfile`: + +```ruby +gem "{{gemName}}" +``` + +then run `bundle install`. Or install it directly: + +```sh +gem install {{gemName}} +``` + +## Getting started + +```ruby +require "{{gemName}}" + +client = {{moduleName}}::Client.new(base_url: "{{{basePath}}}") + +# Operations are grouped into namespaced sub-clients that mirror the API's +# resources, so a call reads as `client..`: +# +# response = client..(some_param: "value") +# response.data # => the deserialized model (or Array of models) +# response.status # => the HTTP status code +# response.headers # => the response headers +# +# The response delegates to `data`, so you can iterate/index it directly: +# +# response.each { |item| ... } +``` + +## Configuration + +`Client.new` takes a base URL plus options, or a configuration block. Each client +owns its own `Configuration` and `Connection`, so several independent clients can +coexist in the same process — there is no global state. + +```ruby +client = {{moduleName}}::Client.new(base_url: "{{{basePath}}}") do |config| + config.timeout = 10 +{{#authMethods}} +{{#isApiKey}} + config.api_key = "YOUR_API_KEY" +{{/isApiKey}} +{{#isBasicBearer}} + config.access_token = "YOUR_ACCESS_TOKEN" +{{/isBasicBearer}} +{{#isBasicBasic}} + config.username = "YOUR_USERNAME" + config.password = "YOUR_PASSWORD" +{{/isBasicBasic}} +{{/authMethods}} +end +``` + +## Error handling + +Every non-2xx response and every transport/network error is raised as a single +`{{moduleName}}::ApiError`: + +```ruby +begin + client.. +rescue {{moduleName}}::ApiError => e + e.status # => HTTP status code (nil for a transport error) + e.body # => the raw response body + e.headers # => the response headers +end +``` + +## Custom middleware / request signing + +Static credentials (`apiKey`, `bearer`, `basic`) are handled from the OpenAPI spec. +A **request signature** — a hash computed per request over the method, full URL, body +and a timestamp (OVH, AWS SigV4, RFC 9421, ...) — cannot be modeled as an OpenAPI +security scheme, so it is registered as a Faraday middleware via `config.use`. Your +middleware runs after the built-in request middleware (it sees the serialized body and +final URL) and just before the adapter: + +```ruby +require "digest/sha1" + +class OvhSignature < Faraday::Middleware + def initialize(app, app_key:, app_secret:, consumer_key:) + super(app) + @app_key = app_key + @app_secret = app_secret + @consumer_key = consumer_key + end + + def on_request(env) + ts = Time.now.to_i.to_s + url = env.url.to_s + sig = "$1$" + Digest::SHA1.hexdigest( + [@app_secret, @consumer_key, env.method.to_s.upcase, url, env.body.to_s, ts].join("+") + ) + env.request_headers.merge!( + "X-Ovh-Application" => @app_key, + "X-Ovh-Consumer" => @consumer_key, + "X-Ovh-Timestamp" => ts, + "X-Ovh-Signature" => sig + ) + end +end + +client = {{moduleName}}::Client.new(base_url: "{{{basePath}}}") do |config| + config.use(OvhSignature, app_key: "...", app_secret: "...", consumer_key: "...") +end +``` + +`config.use` returns `self`, so calls can be chained. Middlewares run in registration +order; computing the full URL (with query string) from `env.url` / `env.params` is the +middleware's responsibility. + +## Threaded servers + +Class loading is lazy. Under a threaded server (Puma, etc.), eager-load once at +boot so autoloading never happens across threads: + +```ruby +{{moduleName}}.eager_load! +``` + +## License + +{{#gemLicense}}`{{gemLicense}}`{{/gemLicense}}{{^gemLicense}}See the gem specification.{{/gemLicense}} diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/Rakefile.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/Rakefile.mustache new file mode 100644 index 000000000000..82bb534a7463 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/Rakefile.mustache @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/api.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api.mustache new file mode 100644 index 000000000000..5de22bcd6588 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api.mustache @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +{{! The class body lives in the api_operations partial at column 0 and is re-indented by the + indent2/indent4 lambdas so it sits correctly in BOTH module shapes: `module ` + + `module ` + class (4 spaces) when the wrapper is present, or a single + `module ` + class (2 spaces) when apiNamespace is empty (the nested-moduleName + case, e.g. `Dolibarr::Api`). Keeping one partial avoids duplicating the body per shape. }} +module {{moduleName}} +{{#apiNamespacePresent}} + module {{apiNamespace}} +{{/apiNamespacePresent}} +{{#operations}} +{{#apiNamespacePresent}} + {{#indent4}}{{> api_operations}}{{/indent4}} +{{/apiNamespacePresent}} +{{^apiNamespacePresent}} + {{#indent2}}{{> api_operations}}{{/indent2}} +{{/apiNamespacePresent}} +{{/operations}} +{{#apiNamespacePresent}} + end +{{/apiNamespacePresent}} +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_error.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_error.mustache new file mode 100644 index 000000000000..4fcdb60f4267 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_error.mustache @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module {{moduleName}} + class ApiError < StandardError + attr_reader :status, :headers, :body, :response + + def initialize(message = nil, status: nil, headers: nil, body: nil, response: nil) + @status = status + @headers = headers + @body = body + @response = response + super(message || "HTTP #{status}") + end + + def self.from(response) + new(status: response.status, headers: response.headers, body: response.body, response: response) + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_info.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_info.mustache new file mode 100644 index 000000000000..f50beb178096 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_info.mustache @@ -0,0 +1,11 @@ +{{#appName}} +# {{{.}}} +# +{{/appName}} +{{#version}} +# The version of the OpenAPI document: {{.}} +{{/version}} +{{#infoEmail}} +# Contact: {{{.}}} +{{/infoEmail}} +# Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_operations.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_operations.mustache new file mode 100644 index 000000000000..dbbd89a88460 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_operations.mustache @@ -0,0 +1,37 @@ +class {{classname}} + def initialize(connection) + @connection = connection + end +{{#operation}} + + def {{operationId}}{{#hasParams}}({{#allParams}}{{paramName}}:{{^required}} nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}){{/hasParams}} +{{#allParams}} +{{#required}} + raise ArgumentError, '{{paramName}} is required' if {{paramName}}.nil? +{{/required}} +{{/allParams}} +{{#vendorExtensions.x-rb-has-required-params}} + +{{/vendorExtensions.x-rb-has-required-params}} + @connection.call( + :{{httpMethod}}, + '{{{path}}}'{{#pathParams}} + .gsub('{{=<% %>=}}{<%baseName%>}<%={{ }}=%>', ERB::Util.url_encode({{paramName}}.to_s)){{/pathParams}}, + type: {{{vendorExtensions.x-rb-return-type}}}, + auth: [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}]{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#bodyParam}},{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}},{{/hasFormParams}}{{/bodyParam}}{{/hasHeaderParams}}{{/hasQueryParams}} +{{#hasQueryParams}} + query: { {{#queryParams}}'{{baseName}}' => {{paramName}}{{^-last}}, {{/-last}}{{/queryParams}} }{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#bodyParam}},{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}},{{/hasFormParams}}{{/bodyParam}}{{/hasHeaderParams}} +{{/hasQueryParams}} +{{#hasHeaderParams}} + headers: { {{#headerParams}}'{{baseName}}' => {{paramName}}{{^-last}}, {{/-last}}{{/headerParams}} }{{#bodyParam}},{{/bodyParam}}{{#hasFormParams}},{{/hasFormParams}} +{{/hasHeaderParams}} +{{#bodyParam}} + body: {{paramName}} +{{/bodyParam}} +{{#hasFormParams}} + form: { {{#formParams}}'{{baseName}}' => {{paramName}}{{^-last}}, {{/-last}}{{/formParams}} } +{{/hasFormParams}} + ) + end +{{/operation}} +end \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_test.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_test.mustache new file mode 100644 index 000000000000..fb2b5f507aa2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/api_test.mustache @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'spec_helper' + +{{#operations}} +RSpec.describe {{moduleName}}::{{#apiNamespacePresent}}{{apiNamespace}}::{{/apiNamespacePresent}}{{classname}} do + let(:client) { {{moduleName}}::Client.new(base_url: '{{{basePath}}}') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rspec.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rspec.mustache new file mode 100644 index 000000000000..93e191c2ff7e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rspec.mustache @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rubocop.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rubocop.mustache new file mode 100644 index 000000000000..d73598dc2283 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/bin_rubocop.mustache @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/client.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/client.mustache new file mode 100644 index 000000000000..1c80df07f87d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/client.mustache @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module {{moduleName}} + class Client + attr_reader :configuration, :connection + + def initialize(base_url: nil, **options, &block) + @configuration = Configuration.new(base_url: base_url, **options, &block) + @connection = Connection.new(@configuration) + end +{{#rbNamespaces}} + + def {{accessor}} + @{{accessor}} ||= {{moduleName}}::{{#apiNamespacePresent}}{{apiNamespace}}::{{/apiNamespacePresent}}{{className}}.new(@connection) + end +{{/rbNamespaces}} + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/configuration.mustache new file mode 100644 index 000000000000..bb0242bceb8e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/configuration.mustache @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +module {{moduleName}} + class Configuration + attr_accessor :base_url, :timeout, :logger, :debugging, :query_array_encoding{{#authMethods}}{{#isApiKey}}, :api_key{{/isApiKey}}{{#isBasicBearer}}, :access_token{{/isBasicBearer}}{{#isBasicBasic}}, :username, :password{{/isBasicBasic}}{{/authMethods}} + + def initialize(base_url: nil, **options) + @base_url = base_url || '{{{basePath}}}' + @timeout = 60 + @query_array_encoding = :repeat + @debugging = false + @middlewares = [] + options.each do |k, v| + raise ArgumentError, "unknown configuration option: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + yield self if block_given? + end + + def configure_faraday(conn) + # Order matters: :multipart / :url_encoded must run before :json so form calls + # (Connection#call `form:`) get encoded first -- Connection#call pins the + # Content-Type to "application/json" up front on non-form calls, so these two + # middlewares' own (weaker) content-type guards correctly no-op on JSON bodies. + conn.request :multipart + conn.request :url_encoded + conn.request :json + conn.response :json, content_type: /\bjson$/ + conn.options.timeout = timeout + conn.response :logger, logger if logger && debugging + @middlewares.each { |mw, mw_args, mw_block| conn.use(mw, *mw_args, &mw_block) } + conn.adapter Faraday.default_adapter + end + + # Applies authentication credentials to a single request's headers and query + # params. Called by Connection#call on EVERY request (not baked into the + # persistent Faraday connection at build time) so credential rotation -- + # token refresh, a new api_key -- takes effect on the very next call. + # `auth_names` are the security schemes the current operation actually declares (empty + # for `security: []` public endpoints); only those are applied, so credentials never + # leak to public endpoints nor stack conflicting Authorization headers. + # rubocop:disable Lint/UnusedMethodArgument -- headers/query/auth_names form the fixed + # per-request auth interface (Connection#call); a given generated client may exercise + # only some of them (e.g. no query-based key, or no auth method at all). + def apply_auth(headers, query, auth_names) +{{#authMethods}} +{{#isApiKey}} +{{#isKeyInHeader}} + headers['{{keyParamName}}'] = api_key if api_key && auth_names.include?('{{name}}') +{{/isKeyInHeader}} +{{#isKeyInQuery}} + query['{{keyParamName}}'] = api_key if api_key && auth_names.include?('{{name}}') +{{/isKeyInQuery}} +{{#isKeyInCookie}} + if api_key && auth_names.include?('{{name}}') + headers['Cookie'] = [headers['Cookie'], "{{keyParamName}}=#{api_key}"].compact.join('; ') + end +{{/isKeyInCookie}} +{{/isApiKey}} +{{#isBasicBearer}} + headers['Authorization'] = "Bearer #{access_token}" if access_token && auth_names.include?('{{name}}') +{{/isBasicBearer}} +{{#isBasicBasic}} + if username && auth_names.include?('{{name}}') + headers['Authorization'] = Faraday::Utils.basic_header_from(username, password) + end +{{/isBasicBasic}} +{{/authMethods}} + nil + end + # rubocop:enable Lint/UnusedMethodArgument + + # Register a Faraday middleware to run on every request, after the built-in + # request middleware (so it sees the serialized body and final URL) and just + # before the adapter. Use for request signing (OVH, AWS SigV4, ...). + def use(middleware, *args, &block) + @middlewares << [middleware, args, block] + self + end + + def encode_array(values) + case query_array_encoding + when :csv then values.join(',') + else values + end + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/connection.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/connection.mustache new file mode 100644 index 000000000000..74c86fbff0c2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/connection.mustache @@ -0,0 +1,118 @@ +# frozen_string_literal: true + +module {{moduleName}} + # The single HTTP choke-point. Every operation goes through `call`. + class Connection + def initialize(configuration) + @configuration = configuration + # Force a trailing slash so a base_url that itself carries a path prefix + # (e.g. "https://api.ovh.com/1.0") is preserved: request paths are made + # relative (their leading slash is stripped in #call) and resolved against it. + base = configuration.base_url + base += '/' unless base.end_with?('/') + @faraday = Faraday.new(url: base) do |conn| + configuration.configure_faraday(conn) + end + end + + # `body` (JSON) and `form` (urlencoded/multipart) are mutually exclusive -- an + # operation has either a request body or form params, never both. + def call(method, path, type: nil, auth: [], query: {}, headers: {}, body: nil, form: nil) + # Faraday's `run_request` only accepts lowercase method symbols; api.mustache + # emits the readable uppercase form (e.g. `:GET`), so normalize it here. + method = method.to_s.downcase.to_sym + # Make the path relative so Faraday resolves it against the (slash-terminated) + # base_url without discarding any base path prefix. + path = path.sub(%r{\A/+}, '') + request_headers = merge_headers(headers) + request_query = query.compact.transform_keys(&:to_s) + # Only the auth schemes the operation actually declares are applied, so credentials + # never leak to endpoints with `security: []` nor stack conflicting Authorization + # headers on operations that accept only one of several schemes. + @configuration.apply_auth(request_headers, request_query, auth) + request_body = + if form + wrap_form(form) + else + # Pin the content type ourselves so the `:multipart`/`:url_encoded` request + # middlewares (registered ahead of `:json` in Configuration#configure_faraday + # so form calls can be encoded before `:json` sees them) do not mistake a + # plain JSON Hash/Array body for a form payload -- both only skip a request + # once its Content-Type is set to something other than what they handle. + request_headers['Content-Type'] ||= 'application/json' unless body.nil? + serialize_body(body) + end + + response = @faraday.run_request(method, path, request_body, request_headers) do |req| + req.params.update(encode_query(request_query)) + end + raise ApiError.from(response) unless response.success? + + Response.new(data: deserialize(response.body, type), status: response.status, headers: response.headers) + rescue Faraday::Error => e + # Ruby sets #cause automatically to `e` when raising inside a rescue block. + raise ApiError, e.message + end + + private + + def serialize_body(body) + return nil if body.nil? + + body.respond_to?(:to_body) ? body.to_body : body + end + + def merge_headers(headers) + headers.compact.transform_keys(&:to_s) + end + + def encode_query(query) + query.compact.each_with_object({}) do |(k, v), out| + out[k.to_s] = v.is_a?(Array) ? @configuration.encode_array(v) : v + end + end + + # Drops nil form values and wraps bare IO-like values (e.g. a plain `File.open(...)`) + # in a `Faraday::Multipart::FilePart` so the `:multipart` middleware's file + # detection (which looks for `:content_type`, not `:read`) can see them. Values + # that are already a FilePart/UploadIO (they respond to `:content_type`) or plain + # scalars pass through untouched; the `:multipart`/`:url_encoded` middlewares + # decide for themselves (based on whether any part looks like a file) which + # encoding to apply. + def wrap_form(form) + form.compact.transform_values do |v| + next v if !v.respond_to?(:read) || v.respond_to?(:content_type) + + Faraday::Multipart::FilePart.new(v, 'application/octet-stream') + end + end + + def deserialize(body, type) + return nil if body.nil? || body == '' + + # A successful response with a non-JSON body (plain text, HTML from a + # misbehaving proxy, ...) must not escape the single ApiError contract. + data = + if body.is_a?(String) + begin + JSON.parse(body) + rescue JSON::ParserError => e + raise ApiError, "invalid JSON in response body: #{e.message}" + end + else + body + end + return data if type.nil? + + if type.respond_to?(:from_hash) + type.from_hash(data) + elsif type.respond_to?(:build) + type.build(data) + elsif type.is_a?(Array) && type.first.respond_to?(:from_hash) + data.map { |el| type.first.from_hash(el) } + else + data + end + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/gem.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gem.mustache new file mode 100644 index 000000000000..e411a4277681 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gem.mustache @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +{{> api_info}} + +require 'erb' +require 'forwardable' +require 'json' +require 'time' + +require 'faraday' +require 'faraday/multipart' +require 'zeitwerk' + +{{#moduleNameNested}} +{{#moduleNameParents}} +module {{.}}; end +{{/moduleNameParents}} +{{/moduleNameNested}} +module {{moduleName}} + class << self + attr_reader :loader + end + +{{#moduleNameNested}} + # Nested moduleName: for_gem can't target a nested namespace, so drive Zeitwerk + # explicitly. The parent module(s) above are pre-defined so `module {{moduleName}}` + # (here and in every generated file) reopens rather than raising NameError. + @loader = Zeitwerk::Loader.new + @loader.push_dir("#{__dir__}/{{gemName}}", namespace: self) + # version.rb defines VERSION (not a `Version` class). for_gem's GemInflector special-cases + # this; a plain Loader doesn't, so ignore it for autoloading and require it directly to keep + # {{moduleName}}::VERSION available. + @loader.ignore("#{__dir__}/{{gemName}}/version.rb") + require_relative "{{gemName}}/version" +{{/moduleNameNested}} +{{^moduleNameNested}} + @loader = Zeitwerk::Loader.for_gem +{{/moduleNameNested}} +{{#zeitwerkInflections.0}} + # Model names keep their acronym casing (e.g. HTTPConfig), but Zeitwerk's default + # inflector would expect HttpConfig from the file name. Register the exceptions so + # autoloading resolves the real constant. + @loader.inflector.inflect( +{{#zeitwerkInflections}} + "{{key}}" => "{{{value}}}", +{{/zeitwerkInflections}} + ) +{{/zeitwerkInflections.0}} + # The `api/` directory on disk is fixed regardless of the `apiNamespace` CliOption, + # but api.mustache only nests classes under an `Api` module when the wrapper is + # enabled ({{apiNamespacePresent}}). When it's disabled, tell Zeitwerk to collapse + # that directory so it doesn't expect a `{{moduleName}}::Api` namespace that the + # generated classes never actually define. +{{^apiNamespacePresent}} + @loader.collapse("#{__dir__}/{{gemName}}/api") +{{/apiNamespacePresent}} + @loader.setup + + def self.eager_load! + @loader.eager_load + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/gemspec.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gemspec.mustache new file mode 100644 index 000000000000..c0f5585cd281 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gemspec.mustache @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +{{^moduleNameNested}} +require_relative 'lib/{{gemName}}/version' + +{{/moduleNameNested}} +Gem::Specification.new do |s| + s.name = '{{gemName}}' +{{#moduleNameNested}} + # version.rb opens `module {{moduleName}}` whose parent isn't defined during gemspec + # evaluation (RubyGems evals this file in its own lexical scope), so `require`-ing it + # would raise NameError. Read the literal VERSION string instead. + s.version = File.read(File.expand_path('lib/{{gemName}}/version.rb', __dir__))[/VERSION\s*=\s*['"]([^'"]+)['"]/, 1] +{{/moduleNameNested}} +{{^moduleNameNested}} + s.version = {{moduleName}}::VERSION +{{/moduleNameNested}} + s.platform = Gem::Platform::RUBY + s.authors = ['{{gemAuthor}}'] + s.email = ['{{gemAuthorEmail}}'] + s.homepage = '{{gemHomepage}}' + s.summary = '{{gemSummary}}' + s.description = '{{gemDescription}}' + s.license = '{{gemLicense}}' + + s.required_ruby_version = '>= 3.0.0' + + s.files = Dir['LICENSE', 'README.md', 'lib/**/*.rb'] + + s.add_dependency 'faraday' + s.add_dependency 'faraday-multipart' + s.add_dependency 'zeitwerk' +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/github-workflow.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/github-workflow.mustache new file mode 100644 index 000000000000..17b3a5fadebe --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/github-workflow.mustache @@ -0,0 +1,74 @@ +--- +name: CI + +# Minimal token permissions: only source checkout is needed (works on private repos too). +permissions: + contents: read + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + # Run workflow manually + workflow_dispatch: + +jobs: + rubocop: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Rubocop + run: bundle exec rubocop + + rspec: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + ruby: + - '4.0' + - '3.4' + - '3.3' + - '3.2' + - '3.1' + - '3.0' + - 'jruby' + - 'truffleruby' + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + # JRuby 10.x is built for Java 21; the runner ships an older default JDK. + - name: Setup Java + if: startsWith(matrix.ruby, 'jruby') + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{=<% %>=}}{{ matrix.ruby }}<%={{ }}=%> + bundler-cache: true + + - name: Run RSpec + run: bundle exec rspec diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/gitignore.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gitignore.mustache new file mode 100644 index 000000000000..e6682f5f9248 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/gitignore.mustache @@ -0,0 +1,11 @@ +# Bundler +/.bundle/ +Gemfile.lock + +# Built gem packages +/pkg/ +*.gem + +# Temporary and generated files +/tmp/ +/coverage/ diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/model.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/model.mustache new file mode 100644 index 000000000000..c9ceadb5d415 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/model.mustache @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +{{> api_info}} + +module {{moduleName}} + module Models +{{#models}} +{{#model}} +{{#isEnum}} +{{> partial_model_enum_class}} +{{/isEnum}} +{{^isEnum}} +{{#oneOf}} +{{#-first}} +{{> partial_oneof_module}} +{{/-first}} +{{/oneOf}} +{{#anyOf}} +{{#-first}} +{{> partial_model_anyof}} +{{/-first}} +{{/anyOf}} +{{^oneOf}} +{{^anyOf}} +{{> partial_model_generic}} +{{/anyOf}} +{{/oneOf}} +{{/isEnum}} +{{/model}} +{{/models}} + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/model_test.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/model_test.mustache new file mode 100644 index 000000000000..c115513e5a9a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/model_test.mustache @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require 'spec_helper' + +{{#models}} +{{#model}} +{{#isEnum}} +RSpec.describe {{moduleName}}::Models::{{classname}} do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end +{{/isEnum}} +{{^isEnum}} +{{#oneOf}} +{{#-first}} +RSpec.describe {{moduleName}}::Models::{{classname}} do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end +{{/-first}} +{{/oneOf}} +{{#anyOf}} +{{#-first}} +RSpec.describe {{moduleName}}::Models::{{classname}} do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end +{{/-first}} +{{/anyOf}} +{{^oneOf}} +{{^anyOf}} +RSpec.describe {{moduleName}}::Models::{{classname}} do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end +{{^vendorExtensions.x-rb-additional-properties}} + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +{{/vendorExtensions.x-rb-additional-properties}} +end +{{/anyOf}} +{{/oneOf}} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_anyof.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_anyof.mustache new file mode 100644 index 000000000000..380b9694276b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_anyof.mustache @@ -0,0 +1,22 @@ + # anyOf wrapper. Returns the first candidate that validates. + module {{classname}} + CANDIDATES = [ +{{#anyOf}} + '{{{.}}}', +{{/anyOf}} + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = {{moduleName}}::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_enum_class.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_enum_class.mustache new file mode 100644 index 000000000000..39ef644f7b24 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_enum_class.mustache @@ -0,0 +1,21 @@ + module {{classname}} +{{#allowableValues}} +{{#enumVars}} + {{name}} = {{{value}}} +{{/enumVars}} +{{/allowableValues}} + + def self.all + @all ||= [ +{{#allowableValues}} +{{#enumVars}} + {{name}}, +{{/enumVars}} +{{/allowableValues}} + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_generic.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_generic.mustache new file mode 100644 index 000000000000..c3eb621929ee --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_model_generic.mustache @@ -0,0 +1,54 @@ + class {{classname}}{{#parent}} < {{{.}}}{{/parent}} + include {{moduleName}}::Serializable + include {{moduleName}}::Validations + +{{#vendorExtensions.x-rb-additional-properties}} + # Unknown JSON keys (permitted by additionalProperties) are stashed here so they + # round-trip through from_hash/to_hash instead of being silently dropped. + attr_accessor :additional_properties + +{{/vendorExtensions.x-rb-additional-properties}} +{{#vars}} + attribute :{{name}}, + type: '{{{dataType}}}', + json_key: '{{{baseName}}}', + required: {{#required}}true{{/required}}{{^required}}false{{/required}}{{#vendorExtensions.x-rb-validated}}{{#isEnum}}, + enum: [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]{{/isEnum}}{{#maxLength}}, + max_length: {{maxLength}}{{/maxLength}}{{#minLength}}, + min_length: {{minLength}}{{/minLength}}{{#maximum}}, + maximum: {{maximum}}{{/maximum}}{{#minimum}}, + minimum: {{minimum}}{{/minimum}}{{#maxItems}}, + max_items: {{maxItems}}{{/maxItems}}{{#minItems}}, + min_items: {{minItems}}{{/minItems}}{{#pattern}}, + pattern: {{{pattern}}}{{/pattern}}{{/vendorExtensions.x-rb-validated}} + +{{/vars}} + def initialize(**attrs) +{{#vendorExtensions.x-rb-additional-properties}} + attrs.each do |k, v| + if respond_to?("#{k}=") + public_send("#{k}=", v) + else + # additionalProperties is permitted: stash unknown keys rather than raise. + (@additional_properties ||= {})[k.to_s] = v + end + end +{{/vendorExtensions.x-rb-additional-properties}} +{{^vendorExtensions.x-rb-additional-properties}} + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end +{{/vendorExtensions.x-rb-additional-properties}} +{{#vars}} +{{#vendorExtensions.x-rb-default}} + @{{name}} = {{{vendorExtensions.x-rb-default}}} if @{{name}}.nil? +{{/vendorExtensions.x-rb-default}} +{{/vars}} +{{#vendorExtensions.x-rb-additional-properties}} + @additional_properties ||= {} +{{/vendorExtensions.x-rb-additional-properties}} + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_oneof_module.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_oneof_module.mustache new file mode 100644 index 000000000000..d195cb20db52 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/partial_oneof_module.mustache @@ -0,0 +1,34 @@ + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module {{classname}} + CANDIDATES = [ +{{#oneOf}} + '{{{.}}}', +{{/oneOf}} + ].freeze + + def self.build(data) +{{#discriminator}} + key = data['{{vendorExtensions.x-rb-discriminator-prop}}'] + mapping = { {{#mappedModels}}'{{mappingName}}' => {{moduleName}}::Models::{{modelName}}{{^-last}}, {{/-last}}{{/mappedModels}} } + klass = mapping[key] + return klass.from_hash(data) if klass +{{/discriminator}} + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = {{moduleName}}::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/polymorphism.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/polymorphism.mustache new file mode 100644 index 000000000000..cda9a2866e55 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/polymorphism.mustache @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +module {{moduleName}} + # Runtime support for anyOf/oneOf candidate resolution. Casts raw + # deserialized data (Hash/Array/primitive) against a declared candidate + # type name and returns the matching value, or nil when it does not match. + # + # Candidate type names are plain OpenAPI-Generator Ruby type declarations + # (e.g. 'Integer', "Array", "Hash", or a bare model + # name resolved under {{moduleName}}::Models). This mirrors the type-name + # dispatch used by the stock `ruby` generator's `find_and_cast_into_type`, + # adapted to the idiomatic Models:: namespace and attribute DSL. + module Polymorphism + ARRAY_TYPE = /\AArray<(?.+)>\z/ + HASH_TYPE = /\AHash.+)>\z/ + + # Internal sentinel distinguishing "no candidate matched" from a + # genuinely null value that legitimately matched a nullable candidate + # (e.g. a nullable array/hash element, or a nullable model reference). + # `nil` alone is ambiguous for that purpose, so it cannot be reused here. + NO_MATCH = Object.new.freeze + private_constant :NO_MATCH + + # Public entry point used by generated anyOf/oneOf wrappers. Returns the + # matching value, or nil when no candidate matched. + def self.cast(type_name, data) + result = cast_raw(type_name, data) + result.equal?(NO_MATCH) ? nil : result + end + + def self.cast_raw(type_name, data) + case type_name + when 'Boolean' + [true, false].include?(data) ? data : NO_MATCH + when 'Integer' + data.is_a?(Integer) ? data : NO_MATCH + when 'Float' + data.is_a?(Numeric) ? data.to_f : NO_MATCH + when 'String' + data.is_a?(String) ? data : NO_MATCH + when 'Time' + cast_time(data) + when 'Object', 'Hash' + data.is_a?(Hash) ? data : NO_MATCH + when ARRAY_TYPE + cast_array(Regexp.last_match[:sub_type], data) + when HASH_TYPE + cast_hash(Regexp.last_match[:sub_type], data) + else + data.nil? ? nil : cast_model(type_name, data) + end + end + private_class_method :cast_raw + + def self.cast_time(data) + return NO_MATCH unless data.is_a?(String) + + Time.parse(data) + rescue ArgumentError, TypeError + NO_MATCH + end + private_class_method :cast_time + + def self.cast_array(sub_type, data) + return NO_MATCH unless data.is_a?(Array) + + cast_items = data.map { |item| cast_raw(sub_type, item) } + cast_items.any? { |item| item.equal?(NO_MATCH) } ? NO_MATCH : cast_items + end + private_class_method :cast_array + + def self.cast_hash(sub_type, data) + return NO_MATCH unless data.is_a?(Hash) + + cast_pairs = data.transform_values { |value| cast_raw(sub_type, value) } + cast_pairs.any? { |_k, v| v.equal?(NO_MATCH) } ? NO_MATCH : cast_pairs + end + private_class_method :cast_hash + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is: + # - a real model class (Serializable/Validations): responds to `from_hash` + # - an enum module: responds to class-level `valid?(value)` + # - a nested oneOf/anyOf wrapper module: responds to `build(data)` only + def self.cast_model(type_name, data) + return NO_MATCH unless Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + obj = const.from_hash(data) + obj.valid? ? obj : NO_MATCH + elsif const.respond_to?(:valid?) + const.valid?(data) ? data : NO_MATCH + elsif const.respond_to?(:build) + const.build(data) + else + NO_MATCH + end + # A non-matching candidate must not abort the whole anyOf/oneOf resolution: a wrong + # shape (Array where a Hash is expected, a nested build that raises, ...) simply means + # "this candidate does not match", so treat any resolution failure as NO_MATCH. + rescue NameError, TypeError, ArgumentError + # NameError already covers its subclass NoMethodError. + NO_MATCH + end + private_class_method :cast_model + + # Non-validating structural coercion used by `from_hash` deserialization. + # Unlike `cast`/`cast_raw` (which gate on `valid?` to pick the right + # anyOf/oneOf candidate), `coerce` never rejects data: it builds the best + # typed representation it can and falls back to returning the data + # unchanged when it cannot resolve a type. This ensures deserialization + # never silently drops a valid-but-incomplete nested object. + def self.coerce(type_name, data) + return nil if data.nil? + + case type_name + when 'Boolean', 'Integer', 'String', 'Object', 'Hash', nil + data + when 'Float' + data.is_a?(Numeric) ? data.to_f : data + when 'Time' + coerce_time(data) + when ARRAY_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Array) ? data.map { |item| coerce(sub_type, item) } : data + when HASH_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Hash) ? data.transform_values { |value| coerce(sub_type, value) } : data + else + coerce_model(type_name, data) + end + end + + def self.coerce_time(data) + return data unless data.is_a?(String) + + begin + Time.parse(data) + rescue ArgumentError, TypeError + data + end + end + private_class_method :coerce_time + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is, without any `valid?` gating: + # - a real model class (Serializable/Validations): `from_hash` (recurses) + # - a nested oneOf/anyOf wrapper module: `build(data)` + # - an enum module: returns the raw value unchanged + # - anything unresolvable: returns the data unchanged + def self.coerce_model(type_name, data) + return data unless type_name.is_a?(String) && Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + const.from_hash(data) + elsif const.respond_to?(:build) + const.build(data) + else + data + end + rescue NameError + data + end + private_class_method :coerce_model + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/response.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/response.mustache new file mode 100644 index 000000000000..af2f97f4c9bb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/response.mustache @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module {{moduleName}} + # Result of an operation. Delegates to `data` for ergonomic access while keeping + # status/headers available. Replaces the `_with_http_info` twin methods. + class Response + extend Forwardable + + attr_reader :data, :status, :headers + + def initialize(data:, status:, headers:) + @data = data + @status = status + @headers = headers + end + + def_delegators :data, :[], :each, :map, :to_a, :to_hash, :dig + + def to_h + data.respond_to?(:to_hash) ? data.to_hash : data + end + + def deconstruct_keys(_keys) + { data: data, status: status, headers: headers } + end + + def deconstruct + [data, status, headers] + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/rspec.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/rspec.mustache new file mode 100644 index 000000000000..372b5acf8cf1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/rspec.mustache @@ -0,0 +1 @@ +--warnings diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/rubocop.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/rubocop.mustache new file mode 100644 index 000000000000..52c19aac7f7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/rubocop.mustache @@ -0,0 +1,123 @@ +--- +plugins: + - rubocop-performance + - rubocop-rake + - rubocop-rspec + +AllCops: + NewCops: enable + TargetRubyVersion: 3.0 + SuggestExtensions: false + # Merge our exclusions with RuboCop's defaults (vendor/**/*, etc.) instead of + # replacing them. + inherit_mode: + merge: + - Exclude + Exclude: + # Zeitwerk entry point: intentionally thin and can't be reorganized further. + - lib/{{gemName}}.rb + # Bundler binstubs (if generated) are not our code to lint. + - bin/* + +Gemspec/RequireMFA: + Enabled: false + +######### +# STYLE # +######### + +Style/Documentation: + Enabled: false + +# The generated code uses `module {{moduleName}}` + nested class, a valid idiom RuboCop's +# nested/compact binary does not model, and which is required for sibling-constant lexical scope. +Style/ClassAndModuleChildren: + Enabled: false + +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma + +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma + +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Generated `pattern:` regexes are copied verbatim from the OpenAPI document's +# `pattern` keyword; escapes that look redundant inside a character class may +# be exactly what the spec author intended, so this gem does not rewrite them. +Style/RedundantRegexpEscape: + Enabled: false + +# Generated `enum:` arrays hold arbitrary spec-supplied string values (which +# may contain whitespace or other characters unsafe for a bare %w literal), +# so plain string arrays are kept instead of switching per-array based on +# content. +Style/WordArray: + Enabled: false + +# Operations whose operationId collides with a sibling (once camelized) get a +# numeric suffix (`_1`, `_2`, ...) from OpenAPI Generator's own operationId +# de-duplication, driven by the source document rather than this gem. +Naming/VariableNumber: + Enabled: false + +########## +# LAYOUT # +########## + +# Method-call/attribute continuation lines use a fixed extra indent rather +# than aligning to the first argument's column, since the column position +# would otherwise vary with every generated method/attribute name. +Layout/ArgumentAlignment: + EnforcedStyle: with_fixed_indentation + +Layout/HashAlignment: + EnforcedColonStyle: key + EnforcedHashRocketStyle: key + +# Generated hashes (query params, attribute maps) are mechanically emitted and legitimately long. +Layout/LineLength: + Enabled: false + +########### +# METRICS # +########### + +# Generated models/APIs mirror the shape of the OpenAPI document they were +# generated from -- a schema with many properties or an API with many +# operations legitimately produces a large class/method. Rather than chase +# generated-code-only offenses forever, the Metrics department is tuned very +# generously (effectively off) for this generated gem; genuine style cops +# above stay on. +Metrics: + Enabled: false + +######### +# RSPEC # +######### + +# Generated specs are intentionally repetitive/thin smoke tests over +# generated models and APIs; relax the cops that assume hand-written, +# example-per-behavior specs. +RSpec/ExampleLength: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/MultipleMemoizedHelpers: + Enabled: false + +RSpec/NestedGroups: + Enabled: false + +RSpec/DescribeClass: + Enabled: false + +# The generated spec tree intentionally omits an extra top-level directory +# named after the gem (spec/api/..., not spec//api/...) since the +# whole spec/ directory is already gem-scoped; that layout choice is a +# permanent mismatch with this cop's naming convention. +RSpec/SpecFilePathFormat: + Enabled: false diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/serializable.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/serializable.mustache new file mode 100644 index 000000000000..805f529f373e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/serializable.mustache @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module {{moduleName}} + # Shared serialization for all models. Models declare their attributes via the + # `attribute` DSL (see Validations); this reads the resulting attribute table. + module Serializable + def to_hash + result = self.class.openapi_attributes.each_with_object({}) do |(name, attr), hash| + value = public_send(name) + next if value.nil? && !attr[:required] + + hash[attr[:json_key]] = Serializable.serialize(value) + end + if respond_to?(:additional_properties) && additional_properties && !additional_properties.empty? + # A declared attribute always wins over an overflow key of the same name. + result.merge!(Serializable.serialize(additional_properties)) { |_key, declared, _extra| declared } + end + result + end + + def to_body + to_hash + end + + def to_json(*args) + to_hash.to_json(*args) + end + + def to_s + to_hash.to_s + end + + def ==(other) + other.is_a?(self.class) && to_hash == other.to_hash + end + alias eql? == + + def hash + to_hash.hash + end + + def self.serialize(value) + case value + when Array then value.map { |v| serialize(v) } + when Hash then value.transform_values { |v| serialize(v) } + else value.respond_to?(:to_hash) ? value.to_hash : value + end + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/spec_helper.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/spec_helper.mustache new file mode 100644 index 000000000000..87b2a9f0880f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/spec_helper.mustache @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'simplecov' + +SimpleCov.start do + add_filter '/spec/' +end + +RSpec.configure do |config| + config.color = true + config.fail_fast = false + + config.order = :random + Kernel.srand config.seed + + config.expect_with :rspec do |c| + c.syntax = :expect + end + + # disable monkey patching + # see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode + config.disable_monkey_patching! + + config.raise_errors_for_deprecations! +end + +require '{{gemName}}' diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/validations.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/validations.mustache new file mode 100644 index 000000000000..5e563ea2793a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/validations.mustache @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module {{moduleName}} + # Declarative attribute DSL. `attribute :name, type:, required:, enum:, ...` + # generates the accessor, registers the attribute in `openapi_attributes`, + # and stores the validation rules. Replaces the per-model EnumAttributeValidator. + module Validations + def self.included(base) + base.extend(ClassMethods) + end + + module ClassMethods + def openapi_attributes + @openapi_attributes ||= superclass.respond_to?(:openapi_attributes) ? superclass.openapi_attributes.dup : {} + end + + def attribute(name, type:, json_key: name.to_s, required: false, **rules) + openapi_attributes[name] = { type: type, json_key: json_key, required: required, rules: rules } + attr_accessor name + end + + # Deserialization/builder paths use `allocate` (not `new`) on purpose: they must + # stay resilient (a server response may legitimately omit fields the schema marks + # required, or drift from the spec), whereas the caller-facing `initialize` is + # strict and validating. Bypassing `initialize` keeps those two contracts separate. + def build(**attrs) + obj = allocate + attrs.each { |k, v| obj.public_send("#{k}=", v) } + obj + end + + def from_hash(hash) + obj = allocate + openapi_attributes.each do |name, attr| + next unless hash.key?(attr[:json_key]) + + obj.public_send("#{name}=", {{moduleName}}::Polymorphism.coerce(attr[:type], hash[attr[:json_key]])) + end + if obj.respond_to?(:additional_properties=) + known = openapi_attributes.values.map { |a| a[:json_key] } + obj.additional_properties = hash.except(*known) + end + obj + end + + def from_json(json) + from_hash(JSON.parse(json)) + end + end + + def list_invalid_properties + errors = [] + self.class.openapi_attributes.each do |name, attr| + errors.concat(validate_attribute(name, attr, public_send(name))) + end + errors + end + + def valid? + list_invalid_properties.empty? + end + + private + + def validate_attribute(name, attr, value) + out = [] + if attr[:required] && value.nil? + out << "invalid value for \"#{name}\", must be provided" + return out + end + return out if value.nil? + + rules = attr[:rules] + out << "invalid value for \"#{name}\", must be one of #{rules[:enum].inspect}" if rules[:enum] && !rules[:enum].include?(value) + out << "\"#{name}\" too long (max #{rules[:max_length]})" if rules[:max_length] && value.to_s.length > rules[:max_length] + out << "\"#{name}\" too short (min #{rules[:min_length]})" if rules[:min_length] && value.to_s.length < rules[:min_length] + # Guard the comparisons: `valid?` must stay a safe, exception-free query even when a + # caller assigns the wrong type (a String to a numeric field, a scalar to an array). + out << "\"#{name}\" must be <= #{rules[:maximum]}" if rules[:maximum] && value.is_a?(Numeric) && value > rules[:maximum] + out << "\"#{name}\" must be >= #{rules[:minimum]}" if rules[:minimum] && value.is_a?(Numeric) && value < rules[:minimum] + out << "\"#{name}\" too many items (max #{rules[:max_items]})" if rules[:max_items] && value.respond_to?(:length) && value.length > rules[:max_items] + out << "\"#{name}\" too few items (min #{rules[:min_items]})" if rules[:min_items] && value.respond_to?(:length) && value.length < rules[:min_items] + out << "\"#{name}\" does not match #{rules[:pattern]}" if rules[:pattern] && value !~ rules[:pattern] + out + end + end +end diff --git a/modules/openapi-generator/src/main/resources/ruby-idiomatic/version.mustache b/modules/openapi-generator/src/main/resources/ruby-idiomatic/version.mustache new file mode 100644 index 000000000000..292e62d5c850 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-idiomatic/version.mustache @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module {{moduleName}} + VERSION = '{{gemVersion}}' +end diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyApiRoutingTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyApiRoutingTest.java new file mode 100644 index 000000000000..b463f6671c27 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyApiRoutingTest.java @@ -0,0 +1,60 @@ +package org.openapitools.codegen.rubyidiomatic; + +import org.openapitools.codegen.languages.rubyidiomatic.RubyApiRouting; +import org.testng.annotations.Test; +import java.util.*; +import static org.testng.Assert.assertEquals; + +public class RubyApiRoutingTest { + private static final List NETBOX = Arrays.asList( + "/api/dcim/cable-terminations/", "/api/dcim/cable-terminations/{id}/", + "/api/dcim/cable-terminations/{id}/paths/", "/api/ipam/vlans/{id}/"); + private static final List QDRANT = Arrays.asList( + "/collections", "/collections/{collection_name}", + "/collections/{collection_name}/points/query", + "/collections/{collection_name}/points/{id}", + "/collections/{collection_name}/exists", + "/cluster/recover", "/cluster/peer/{peer_id}", "/"); + + @Test public void testResourceSegments() { + assertEquals(RubyApiRouting.resourceSegments(NETBOX), + new HashSet<>(Arrays.asList("cable-terminations", "vlans"))); + assertEquals(RubyApiRouting.resourceSegments(QDRANT), + new HashSet<>(Arrays.asList("collections", "points", "peer"))); + } + + @Test public void testCommonBasePrefix() { + assertEquals(RubyApiRouting.commonBasePrefix(NETBOX), "api"); + assertEquals(RubyApiRouting.commonBasePrefix(QDRANT), ""); + } + + @Test public void testLiterals() { + assertEquals(RubyApiRouting.literals("/api/dcim/cable-terminations/{id}/paths/", "api"), + Arrays.asList("dcim", "cable-terminations", "paths")); + assertEquals(RubyApiRouting.literals("/", ""), Collections.emptyList()); + } + + @Test public void testRouteItemUsesOperationIdAction() { + Set r = RubyApiRouting.resourceSegments(NETBOX); + RubyApiRouting.Route route = RubyApiRouting.route( + "/api/dcim/cable-terminations/{id}/", "PATCH", + "dcim_cable_terminations_partial_update", r, "api"); + assertEquals(route.namespace, "dcim"); + assertEquals(route.resource, "cable-terminations"); + assertEquals(route.action, "partial_update"); + } + + @Test public void testRouteVerbFallbackCollectionVsItem() { + Set r = RubyApiRouting.resourceSegments(QDRANT); + assertEquals(RubyApiRouting.route("/collections", "GET", "", r, "").action, "list"); + assertEquals(RubyApiRouting.route("/collections/{collection_name}", "GET", "", r, "").action, "get"); + } + + @Test public void testRouteRootPath() { + Set r = RubyApiRouting.resourceSegments(QDRANT); + RubyApiRouting.Route route = RubyApiRouting.route("/", "GET", "", r, ""); + assertEquals(route.namespace, "root"); + assertEquals(route.resource, null); + assertEquals(route.action, "list"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyIdiomaticClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyIdiomaticClientCodegenTest.java new file mode 100644 index 000000000000..d75dd623a75c --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubyidiomatic/RubyIdiomaticClientCodegenTest.java @@ -0,0 +1,385 @@ +package org.openapitools.codegen.rubyidiomatic; + +import org.openapitools.codegen.languages.RubyIdiomaticClientCodegen; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class RubyIdiomaticClientCodegenTest { + @Test + public void testGeneratorName() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + assertEquals(gen.getName(), "ruby-idiomatic"); + assertEquals(gen.getTag().toString(), "CLIENT"); + } + + @Test + public void testModelNameAvoidsInfraCollision() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + assertEquals(gen.toModelName("Client"), "ModelClient"); + assertEquals(gen.toModelName("Pet"), "Pet"); + assertEquals(gen.toModelFilename("ApiResponse"), "api_response"); + } + + @Test + public void testApiNamespacedNames() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + assertEquals(gen.toApiFilename("dcim/cable-terminations"), "dcim/cable_terminations"); + assertEquals(gen.toApiName("dcim/cable-terminations"), "Dcim::CableTerminations"); + } + + @Test + public void testNumericEnumValueNotQuoted() { + RubyIdiomaticClientCodegen g = new RubyIdiomaticClientCodegen(); + org.testng.Assert.assertEquals(g.toEnumValue("1", "Integer"), "1"); + org.testng.Assert.assertEquals(g.toEnumValue("1.5", "Float"), "1.5"); + org.testng.Assert.assertEquals(g.toEnumValue("available", "String"), "'available'"); + } + + @Test + public void testNumericEnumVarNameIsValidConstant() { + RubyIdiomaticClientCodegen g = new RubyIdiomaticClientCodegen(); + // Ruby 3.0+ reserves _1.._9 as numbered block parameters, so a bare "_" + digit + // prefix (DefaultCodegen's behavior) emits an illegal constant: `_1 = '1'` raises + // "_1 is reserved for numbered parameters". Numeric enum values must instead get a + // letter prefix so the constant is legal (mirrors the stock ruby generator's `N`). + assertEquals(g.toEnumVarName("1", "String"), "N1"); + assertEquals(g.toEnumVarName("9", "String"), "N9"); + assertEquals(g.toEnumVarName("10", "String"), "N10"); + assertEquals(g.toEnumVarName("100", "String"), "N100"); + assertEquals(g.toEnumVarName("1", "Integer"), "N1"); + assertEquals(g.toEnumVarName("1.5", "Float"), "N1_DOT_5"); + // non-numeric values are unaffected + assertEquals(g.toEnumVarName("available", "String"), "AVAILABLE"); + assertEquals(g.toEnumVarName("", "String"), "EMPTY"); + // purely symbolic values (telephony IVR keys) sanitize to empty/illegal constants + // with the naive rule; translate them to their word names instead. + assertEquals(g.toEnumVarName("#", "String"), "HASH"); + assertEquals(g.toEnumVarName("*", "String"), "STAR"); + // the reserved forms must never leak out + for (int i = 1; i <= 9; i++) { + org.testng.Assert.assertNotEquals(g.toEnumVarName(String.valueOf(i), "String"), "_" + i); + } + } + + @Test + public void testLongModelNameIsTruncatedForTar() { + RubyIdiomaticClientCodegen g = new RubyIdiomaticClientCodegen(); + // Real OVH inline body models concatenate the whole deep path, producing 120+ char + // file names. The tar ustar format caps each path component at 100 bytes, so + // `gem build` raises Gem::Package::TooLongFileName. The model file name -- including + // the "_spec.rb" test variant -- must stay comfortably under that limit. + String longName = "TelephonyBillingAccountOvhPabxServiceNameDialplanDialplanIdExtension" + + "ExtensionIdConditionScreenListPostRequest"; + String file = g.toModelFilename(longName); + org.testng.Assert.assertTrue((file + "_spec.rb").length() < 100, + "file name too long for tar: " + file + " (" + file.length() + " chars)"); + + // deterministic: identical input yields identical output on every call + assertEquals(g.toModelName(longName), g.toModelName(longName)); + + // collision-free: two distinct long names sharing a truncated head must differ + String sibling = "TelephonyBillingAccountOvhPabxServiceNameDialplanDialplanIdExtension" + + "ExtensionIdConditionTimePostRequest"; + org.testng.Assert.assertNotEquals(g.toModelName(longName), g.toModelName(sibling)); + + // Zeitwerk consistency: the file name is exactly underscore(class name) + assertEquals(g.toModelFilename(longName), + org.openapitools.codegen.utils.StringUtils.underscore(g.toModelName(longName))); + + // short names are left completely untouched + assertEquals(g.toModelName("Pet"), "Pet"); + assertEquals(g.toModelName("ApiResponse"), "ApiResponse"); + } + + @Test + public void testLeadingDigitOperationIdIsPrefixed() { + RubyIdiomaticClientCodegen g = new RubyIdiomaticClientCodegen(); + // Ruby method names cannot begin with a digit; OVH price-plan path segments like + // "2013v1_bhs1a_filer_hourly" would otherwise emit `def 2013v1...` (SyntaxError). + // Prefix with "call_" as the stock ruby generator does. + assertEquals(g.toOperationId("2013v1_bhs1a_filer_hourly"), "call_2013v1_bhs1a_filer_hourly"); + assertEquals(g.toOperationId("2fa"), "call_2fa"); + // ordinary names are untouched (delegated to the parent behavior) + assertEquals(g.toOperationId("getPets"), "get_pets"); + assertEquals(g.toOperationId("list"), "list"); + } + + @Test + public void testOperationGroupingBuildsNamespaces() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/petstore.yaml"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + codegen.preprocessOpenAPI(openAPI); + + io.swagger.v3.oas.models.Operation op = openAPI.getPaths().get("/pet/{petId}").getGet(); + org.openapitools.codegen.CodegenOperation co = codegen.fromOperation( + "/pet/{petId}", "GET", op, null); + java.util.Map> groups = new java.util.HashMap<>(); + codegen.addOperationToGroup("pet", "/pet/{petId}", op, co, groups); + + assertEquals(co.vendorExtensions.get("x-rb-namespace"), "pet"); + assertEquals(co.operationId, "get"); + } + + @Test + public void testOperationIdCollisionIsDeduped() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/petstore.yaml"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + codegen.preprocessOpenAPI(openAPI); + + // POST /pet (addPet) and POST /pet/{petId} (updatePetWithForm) both route to + // action "create" within the "pet" group; the second must not silently overwrite + // the first's operationId. + io.swagger.v3.oas.models.Operation addPetOp = openAPI.getPaths().get("/pet").getPost(); + org.openapitools.codegen.CodegenOperation addPetCo = codegen.fromOperation( + "/pet", "POST", addPetOp, null); + io.swagger.v3.oas.models.Operation updatePetWithFormOp = openAPI.getPaths().get("/pet/{petId}").getPost(); + org.openapitools.codegen.CodegenOperation updatePetWithFormCo = codegen.fromOperation( + "/pet/{petId}", "POST", updatePetWithFormOp, null); + + java.util.Map> groups = new java.util.HashMap<>(); + codegen.addOperationToGroup("pet", "/pet", addPetOp, addPetCo, groups); + codegen.addOperationToGroup("pet", "/pet/{petId}", updatePetWithFormOp, updatePetWithFormCo, groups); + + java.util.List petOps = groups.get("pet"); + org.testng.Assert.assertEquals(petOps.size(), 2); + org.testng.Assert.assertNotEquals(addPetCo.operationId, updatePetWithFormCo.operationId); + assertEquals(addPetCo.operationId, "create"); + assertEquals(updatePetWithFormCo.operationId, "create_post"); + } + + @Test + public void testMultiTagOperationNotDuplicated() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/crystal/qdrant.json"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + codegen.preprocessOpenAPI(openAPI); + + // GET /collections/{collection_name}/cluster carries tags ["collections", "cluster"], + // so the core delivers it to addOperationToGroup once per tag. Because we group by + // path (not tag), both deliveries land in the same group -- and must NOT produce two + // methods (`cluster` and `cluster_get`). + io.swagger.v3.oas.models.Operation op = openAPI.getPaths() + .get("/collections/{collection_name}/cluster").getGet(); + org.openapitools.codegen.CodegenOperation co = codegen.fromOperation( + "/collections/{collection_name}/cluster", "GET", op, null); + + java.util.Map> groups = new java.util.HashMap<>(); + codegen.addOperationToGroup("collections", "/collections/{collection_name}/cluster", op, co, groups); + codegen.addOperationToGroup("cluster", "/collections/{collection_name}/cluster", op, co, groups); + + int total = groups.values().stream().mapToInt(java.util.List::size).sum(); + org.testng.Assert.assertEquals(total, 1, "multi-tag operation must be emitted once"); + } + + @Test + public void testModelPropertyValidationFlags() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/petstore.yaml"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + org.openapitools.codegen.CodegenModel cm = codegen.fromModel("Pet", + openAPI.getComponents().getSchemas().get("Pet")); + org.openapitools.codegen.model.ModelsMap mm = org.openapitools.codegen.TestUtils + .createCodegenModelWrapper(cm); + codegen.postProcessModels(mm); + org.openapitools.codegen.CodegenProperty status = cm.vars.stream() + .filter(v -> v.baseName.equals("status")).findFirst().orElseThrow(RuntimeException::new); + org.testng.Assert.assertEquals(status.vendorExtensions.get("x-rb-validated"), Boolean.TRUE); + } + + @Test + public void testArrayItemsValidation() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + org.openapitools.codegen.CodegenModel cm = codegen.fromModel("ArrayTest", + openAPI.getComponents().getSchemas().get("ArrayTest")); + org.openapitools.codegen.model.ModelsMap mm = org.openapitools.codegen.TestUtils + .createCodegenModelWrapper(cm); + codegen.postProcessModels(mm); + org.openapitools.codegen.CodegenProperty arrayOfString = cm.vars.stream() + .filter(v -> v.baseName.equals("array_of_string")).findFirst().orElseThrow(RuntimeException::new); + org.testng.Assert.assertTrue(arrayOfString.isArray); + org.testng.Assert.assertEquals(arrayOfString.maxItems, Integer.valueOf(3)); + org.testng.Assert.assertEquals(arrayOfString.vendorExtensions.get("x-rb-validated"), Boolean.TRUE); + } + + @Test + public void testAdditionalPropertiesExtension() { + io.swagger.v3.oas.models.OpenAPI openAPI = org.openapitools.codegen.TestUtils + .parseSpec("src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml"); + RubyIdiomaticClientCodegen codegen = new RubyIdiomaticClientCodegen(); + codegen.setOpenAPI(openAPI); + + // FreeFormObject is `additionalProperties: true` with no declared properties -- + // exercises isAdditionalPropertiesTrue. + org.openapitools.codegen.CodegenModel freeForm = codegen.fromModel("FreeFormObject", + openAPI.getComponents().getSchemas().get("FreeFormObject")); + org.openapitools.codegen.model.ModelsMap freeFormMap = org.openapitools.codegen.TestUtils + .createCodegenModelWrapper(freeForm); + codegen.postProcessModels(freeFormMap); + assertEquals(freeForm.vendorExtensions.get("x-rb-additional-properties"), Boolean.TRUE); + + // Pet has no additionalProperties at all -- the extension must be absent so + // partial_model_generic.mustache does not emit the overflow accessor. + org.openapitools.codegen.CodegenModel pet = codegen.fromModel("Pet", + openAPI.getComponents().getSchemas().get("Pet")); + org.openapitools.codegen.model.ModelsMap petMap = org.openapitools.codegen.TestUtils + .createCodegenModelWrapper(pet); + codegen.postProcessModels(petMap); + org.testng.Assert.assertNull(pet.vendorExtensions.get("x-rb-additional-properties")); + } + + @Test + public void testApiNamespaceOption() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + gen.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + gen.processOpts(); + assertEquals(gen.additionalProperties().get("apiNamespacePresent"), Boolean.TRUE); + assertEquals(gen.additionalProperties().get("apiNamespace"), "Api"); + + RubyIdiomaticClientCodegen disabled = new RubyIdiomaticClientCodegen(); + disabled.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + disabled.additionalProperties().put("apiNamespace", ""); + disabled.processOpts(); + assertEquals(disabled.additionalProperties().get("apiNamespacePresent"), Boolean.FALSE); + } + + @Test + @SuppressWarnings("unchecked") + public void testNestedModuleName() { + // Single-level module: nesting flags off, no parents to pre-define. + RubyIdiomaticClientCodegen simple = new RubyIdiomaticClientCodegen(); + simple.additionalProperties().put(org.openapitools.codegen.CodegenConstants.MODULE_NAME, "Petstore"); + simple.processOpts(); + assertEquals(simple.additionalProperties().get("moduleNameNested"), Boolean.FALSE); + + // Two-level module: parent must be pre-defined so `module A::B` doesn't raise. + RubyIdiomaticClientCodegen nested = new RubyIdiomaticClientCodegen(); + nested.additionalProperties().put(org.openapitools.codegen.CodegenConstants.MODULE_NAME, "Dolibarr::Api"); + nested.processOpts(); + assertEquals(nested.additionalProperties().get("moduleNameNested"), Boolean.TRUE); + assertEquals(nested.additionalProperties().get("moduleNameParents"), + java.util.Arrays.asList("Dolibarr")); + + // Three-level module: cumulative parent prefixes, deepest-but-one last. + RubyIdiomaticClientCodegen deep = new RubyIdiomaticClientCodegen(); + deep.additionalProperties().put(org.openapitools.codegen.CodegenConstants.MODULE_NAME, "A::B::C"); + deep.processOpts(); + assertEquals(deep.additionalProperties().get("moduleNameParents"), + java.util.Arrays.asList("A", "A::B")); + } + + @Test + public void testLicenseMitFlag() { + RubyIdiomaticClientCodegen mit = new RubyIdiomaticClientCodegen(); + mit.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + mit.additionalProperties().put("gemLicense", "MIT"); + mit.processOpts(); + assertEquals(mit.additionalProperties().get("isLicenseMIT"), Boolean.TRUE); + + RubyIdiomaticClientCodegen def = new RubyIdiomaticClientCodegen(); + def.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + def.processOpts(); + assertEquals(def.additionalProperties().get("isLicenseMIT"), Boolean.FALSE); + } + + @Test + public void testModelReturnTypeIsModelsQualified() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + gen.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + gen.processOpts(); // sets moduleName = Petstore + + org.openapitools.codegen.CodegenOperation modelOp = new org.openapitools.codegen.CodegenOperation(); + modelOp.returnBaseType = "Pet"; + modelOp.returnType = "Pet"; + org.openapitools.codegen.CodegenOperation arrayOp = new org.openapitools.codegen.CodegenOperation(); + arrayOp.returnBaseType = "Pet"; + arrayOp.returnType = "Array"; + arrayOp.isArray = true; + org.openapitools.codegen.CodegenOperation intOp = new org.openapitools.codegen.CodegenOperation(); + intOp.returnBaseType = "integer"; + intOp.returnType = "Integer"; + + org.openapitools.codegen.model.OperationMap opMap = new org.openapitools.codegen.model.OperationMap(); + opMap.setOperation(java.util.Arrays.asList(modelOp, arrayOp, intOp)); + org.openapitools.codegen.model.OperationsMap ops = new org.openapitools.codegen.model.OperationsMap(); + ops.setOperation(opMap); + + gen.postProcessOperationsWithModels(ops, java.util.Collections.emptyList()); + + // Models live under Petstore::Models:: -- a bare Petstore::Pet would raise NameError at call time. + assertEquals(modelOp.vendorExtensions.get("x-rb-return-type"), "Petstore::Models::Pet"); + assertEquals(arrayOp.vendorExtensions.get("x-rb-return-type"), "[Petstore::Models::Pet]"); + // Primitives pass through as nil (Integer is a core class, not a dispatchable model). + assertEquals(intOp.vendorExtensions.get("x-rb-return-type"), "nil"); + } + + @Test + public void testSupportingFilesRegistered() { + RubyIdiomaticClientCodegen gen = new RubyIdiomaticClientCodegen(); + gen.additionalProperties().put(org.openapitools.codegen.CodegenConstants.GEM_NAME, "petstore"); + gen.processOpts(); + java.util.Set names = new java.util.HashSet<>(); + for (org.openapitools.codegen.SupportingFile sf : gen.supportingFiles()) names.add(sf.getTemplateFile()); + org.testng.Assert.assertTrue(names.contains("gem.mustache")); + org.testng.Assert.assertTrue(names.contains("connection.mustache")); + org.testng.Assert.assertTrue(names.contains("serializable.mustache")); + org.testng.Assert.assertTrue(names.contains("validations.mustache")); + } + + @Test + public void testConfigurationExposesMiddlewareSeam() throws Exception { + java.nio.file.Path target = java.nio.file.Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + org.openapitools.codegen.ClientOptInput input = + new org.openapitools.codegen.config.CodegenConfigurator() + .setGeneratorName("ruby-idiomatic") + .setInputSpec("src/test/resources/3_0/petstore.yaml") + .setOutputDir(target.toString()) + .addAdditionalProperty("gemName", "petstore") + .addAdditionalProperty("moduleName", "Petstore") + .toClientOptInput(); + new org.openapitools.codegen.DefaultGenerator(false).opts(input).generate(); + org.openapitools.codegen.TestUtils.assertFileContains( + target.resolve("lib/petstore/configuration.rb"), + "def use(", "@middlewares.each"); + } + + @Test + public void testAcronymModelsGetZeitwerkInflections() throws Exception { + java.nio.file.Path target = java.nio.file.Files.createTempDirectory("test"); + target.toFile().deleteOnExit(); + org.openapitools.codegen.ClientOptInput input = + new org.openapitools.codegen.config.CodegenConfigurator() + .setGeneratorName("ruby-idiomatic") + .setInputSpec("src/test/resources/3_0/ruby-idiomatic/acronym.yaml") + .setOutputDir(target.toString()) + .addAdditionalProperty("gemName", "acme") + .addAdditionalProperty("moduleName", "Acme") + .toClientOptInput(); + new org.openapitools.codegen.DefaultGenerator(false).opts(input).generate(); + // gem.rb must register the acronym exception so Zeitwerk can autoload it: the model + // class is HTTPConfig but the file is http_config.rb, which Zeitwerk would otherwise + // expect to define HttpConfig. + org.openapitools.codegen.TestUtils.assertFileContains( + target.resolve("lib/acme.rb"), + "@loader.inflector.inflect(", "\"http_config\" => \"HTTPConfig\""); + // and the model file itself must define the acronym-cased constant + org.openapitools.codegen.TestUtils.assertFileContains( + target.resolve("lib/acme/models/http_config.rb"), "HTTPConfig"); + // Acronyms in API resource classes must be registered too: the file + // api/dedicated_cloud/two_fa_whitelist.rb defines DedicatedCloud::TwoFAWhitelist, + // which the default inflector (expecting TwoFaWhitelist) would fail to autoload. + org.openapitools.codegen.TestUtils.assertFileContains( + target.resolve("lib/acme.rb"), "\"two_fa_whitelist\" => \"TwoFAWhitelist\""); + org.openapitools.codegen.TestUtils.assertFileContains( + target.resolve("lib/acme/api/dedicated_cloud/two_fa_whitelist.rb"), "TwoFAWhitelist"); + } +} diff --git a/modules/openapi-generator/src/test/resources/3_0/ruby-idiomatic/acronym.yaml b/modules/openapi-generator/src/test/resources/3_0/ruby-idiomatic/acronym.yaml new file mode 100644 index 000000000000..70b28755aa17 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/ruby-idiomatic/acronym.yaml @@ -0,0 +1,82 @@ +openapi: 3.0.0 +info: + title: Acronym API + version: 1.0.0 +paths: + /config: + get: + operationId: getConfig + responses: + '200': + description: ok + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPConfig' + /dedicatedCloud/{serviceName}/twoFAWhitelist: + get: + operationId: listTwoFAWhitelist + parameters: + - name: serviceName + in: path + required: true + schema: + type: string + responses: + '200': + description: ok + /dedicatedCloud/{serviceName}/twoFAWhitelist/{id}: + get: + operationId: getTwoFAWhitelist + parameters: + - name: serviceName + in: path + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + responses: + '200': + description: ok + /dedicatedCloud/{serviceName}/user: + get: + operationId: listUser + parameters: + - name: serviceName + in: path + required: true + schema: + type: string + responses: + '200': + description: ok + /dedicatedCloud/{serviceName}/user/{userId}: + get: + operationId: getUser + parameters: + - name: serviceName + in: path + required: true + schema: + type: string + - name: userId + in: path + required: true + schema: + type: string + responses: + '200': + description: ok +components: + schemas: + HTTPConfig: + type: object + properties: + enabled: + type: boolean + port: + type: integer diff --git a/samples/client/others/ruby-idiomatic-qdrant/.github/workflows/ci.yml b/samples/client/others/ruby-idiomatic-qdrant/.github/workflows/ci.yml new file mode 100644 index 000000000000..b1a33a852771 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +--- +name: CI + +# Minimal token permissions: only source checkout is needed (works on private repos too). +permissions: + contents: read + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + # Run workflow manually + workflow_dispatch: + +jobs: + rubocop: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Rubocop + run: bundle exec rubocop + + rspec: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + ruby: + - '4.0' + - '3.4' + - '3.3' + - '3.2' + - '3.1' + - '3.0' + - 'jruby' + - 'truffleruby' + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + # JRuby 10.x is built for Java 21; the runner ships an older default JDK. + - name: Setup Java + if: startsWith(matrix.ruby, 'jruby') + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Run RSpec + run: bundle exec rspec diff --git a/samples/client/others/ruby-idiomatic-qdrant/.gitignore b/samples/client/others/ruby-idiomatic-qdrant/.gitignore new file mode 100644 index 000000000000..e6682f5f9248 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.gitignore @@ -0,0 +1,11 @@ +# Bundler +/.bundle/ +Gemfile.lock + +# Built gem packages +/pkg/ +*.gem + +# Temporary and generated files +/tmp/ +/coverage/ diff --git a/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator-ignore b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/FILES b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/FILES new file mode 100644 index 000000000000..39cb7fa957d1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/FILES @@ -0,0 +1,363 @@ +.github/workflows/ci.yml +.gitignore +.rspec +.rubocop.yml +Gemfile +LICENSE +README.md +Rakefile +bin/rspec +bin/rubocop +lib/qdrant.rb +lib/qdrant/api/aliases.rb +lib/qdrant/api/cluster.rb +lib/qdrant/api/cluster/peer.rb +lib/qdrant/api/collections.rb +lib/qdrant/api/collections/index.rb +lib/qdrant/api/collections/points.rb +lib/qdrant/api/collections/shards.rb +lib/qdrant/api/collections/snapshots.rb +lib/qdrant/api/healthz.rb +lib/qdrant/api/issues.rb +lib/qdrant/api/livez.rb +lib/qdrant/api/locks.rb +lib/qdrant/api/metrics.rb +lib/qdrant/api/readyz.rb +lib/qdrant/api/root.rb +lib/qdrant/api/snapshots.rb +lib/qdrant/api/telemetry.rb +lib/qdrant/api_error.rb +lib/qdrant/client.rb +lib/qdrant/configuration.rb +lib/qdrant/connection.rb +lib/qdrant/models/abort_shard_transfer.rb +lib/qdrant/models/abort_transfer_operation.rb +lib/qdrant/models/alias_description.rb +lib/qdrant/models/alias_operations.rb +lib/qdrant/models/any_variants.rb +lib/qdrant/models/app_build_telemetry.rb +lib/qdrant/models/app_features_telemetry.rb +lib/qdrant/models/batch.rb +lib/qdrant/models/batch_payloads_inner.rb +lib/qdrant/models/batch_update200_response.rb +lib/qdrant/models/batch_vector_struct.rb +lib/qdrant/models/binary_quantization.rb +lib/qdrant/models/binary_quantization_config.rb +lib/qdrant/models/bool_index_params.rb +lib/qdrant/models/bool_index_type.rb +lib/qdrant/models/change_aliases_operation.rb +lib/qdrant/models/clear_payload_operation.rb +lib/qdrant/models/cluster_config_telemetry.rb +lib/qdrant/models/cluster_operations.rb +lib/qdrant/models/cluster_status.rb +lib/qdrant/models/cluster_status200_response.rb +lib/qdrant/models/cluster_status_one_of.rb +lib/qdrant/models/cluster_status_one_of1.rb +lib/qdrant/models/cluster_status_telemetry.rb +lib/qdrant/models/cluster_telemetry.rb +lib/qdrant/models/collection_cluster_info.rb +lib/qdrant/models/collection_cluster_info200_response.rb +lib/qdrant/models/collection_config.rb +lib/qdrant/models/collection_description.rb +lib/qdrant/models/collection_existence.rb +lib/qdrant/models/collection_exists200_response.rb +lib/qdrant/models/collection_info.rb +lib/qdrant/models/collection_params.rb +lib/qdrant/models/collection_params_diff.rb +lib/qdrant/models/collection_status.rb +lib/qdrant/models/collection_telemetry.rb +lib/qdrant/models/collection_telemetry_enum.rb +lib/qdrant/models/collections_aggregated_telemetry.rb +lib/qdrant/models/collections_aliases_response.rb +lib/qdrant/models/collections_response.rb +lib/qdrant/models/collections_telemetry.rb +lib/qdrant/models/compression_ratio.rb +lib/qdrant/models/condition.rb +lib/qdrant/models/consensus_config_telemetry.rb +lib/qdrant/models/consensus_thread_status.rb +lib/qdrant/models/consensus_thread_status_one_of.rb +lib/qdrant/models/consensus_thread_status_one_of1.rb +lib/qdrant/models/consensus_thread_status_one_of2.rb +lib/qdrant/models/context_example_pair.rb +lib/qdrant/models/context_input.rb +lib/qdrant/models/context_pair.rb +lib/qdrant/models/context_query.rb +lib/qdrant/models/count_points200_response.rb +lib/qdrant/models/count_request.rb +lib/qdrant/models/count_result.rb +lib/qdrant/models/create_alias.rb +lib/qdrant/models/create_alias_operation.rb +lib/qdrant/models/create_collection.rb +lib/qdrant/models/create_field_index.rb +lib/qdrant/models/create_field_index200_response.rb +lib/qdrant/models/create_shard_key200_response.rb +lib/qdrant/models/create_sharding_key.rb +lib/qdrant/models/create_sharding_key_operation.rb +lib/qdrant/models/create_snapshot200_response.rb +lib/qdrant/models/datatype.rb +lib/qdrant/models/datetime_index_params.rb +lib/qdrant/models/datetime_index_type.rb +lib/qdrant/models/datetime_range.rb +lib/qdrant/models/delete_alias.rb +lib/qdrant/models/delete_alias_operation.rb +lib/qdrant/models/delete_operation.rb +lib/qdrant/models/delete_payload.rb +lib/qdrant/models/delete_payload_operation.rb +lib/qdrant/models/delete_vectors.rb +lib/qdrant/models/delete_vectors_operation.rb +lib/qdrant/models/direction.rb +lib/qdrant/models/disabled.rb +lib/qdrant/models/discover_input.rb +lib/qdrant/models/discover_input_context.rb +lib/qdrant/models/discover_query.rb +lib/qdrant/models/discover_request.rb +lib/qdrant/models/discover_request_batch.rb +lib/qdrant/models/distance.rb +lib/qdrant/models/document.rb +lib/qdrant/models/drop_replica_operation.rb +lib/qdrant/models/drop_sharding_key.rb +lib/qdrant/models/drop_sharding_key_operation.rb +lib/qdrant/models/error_response.rb +lib/qdrant/models/error_response_status.rb +lib/qdrant/models/extended_point_id.rb +lib/qdrant/models/facet200_response.rb +lib/qdrant/models/facet_request.rb +lib/qdrant/models/facet_response.rb +lib/qdrant/models/facet_value.rb +lib/qdrant/models/facet_value_hit.rb +lib/qdrant/models/field_condition.rb +lib/qdrant/models/filter.rb +lib/qdrant/models/filter_must.rb +lib/qdrant/models/filter_must_not.rb +lib/qdrant/models/filter_selector.rb +lib/qdrant/models/filter_should.rb +lib/qdrant/models/float_index_params.rb +lib/qdrant/models/float_index_type.rb +lib/qdrant/models/fusion.rb +lib/qdrant/models/fusion_query.rb +lib/qdrant/models/geo_bounding_box.rb +lib/qdrant/models/geo_index_params.rb +lib/qdrant/models/geo_index_type.rb +lib/qdrant/models/geo_line_string.rb +lib/qdrant/models/geo_point.rb +lib/qdrant/models/geo_polygon.rb +lib/qdrant/models/geo_radius.rb +lib/qdrant/models/get_collection200_response.rb +lib/qdrant/models/get_collection_aliases200_response.rb +lib/qdrant/models/get_collections200_response.rb +lib/qdrant/models/get_locks200_response.rb +lib/qdrant/models/get_point200_response.rb +lib/qdrant/models/get_points200_response.rb +lib/qdrant/models/group_id.rb +lib/qdrant/models/groups_result.rb +lib/qdrant/models/grpc_telemetry.rb +lib/qdrant/models/has_id_condition.rb +lib/qdrant/models/hnsw_config.rb +lib/qdrant/models/hnsw_config_diff.rb +lib/qdrant/models/indexes.rb +lib/qdrant/models/indexes_one_of.rb +lib/qdrant/models/indexes_one_of1.rb +lib/qdrant/models/init_from.rb +lib/qdrant/models/integer_index_params.rb +lib/qdrant/models/integer_index_type.rb +lib/qdrant/models/is_empty_condition.rb +lib/qdrant/models/is_null_condition.rb +lib/qdrant/models/keyword_index_params.rb +lib/qdrant/models/keyword_index_type.rb +lib/qdrant/models/list_snapshots200_response.rb +lib/qdrant/models/local_shard_info.rb +lib/qdrant/models/local_shard_telemetry.rb +lib/qdrant/models/locks_option.rb +lib/qdrant/models/lookup_location.rb +lib/qdrant/models/match.rb +lib/qdrant/models/match_any.rb +lib/qdrant/models/match_except.rb +lib/qdrant/models/match_text.rb +lib/qdrant/models/match_value.rb +lib/qdrant/models/message_send_errors.rb +lib/qdrant/models/min_should.rb +lib/qdrant/models/modifier.rb +lib/qdrant/models/move_shard.rb +lib/qdrant/models/move_shard_operation.rb +lib/qdrant/models/multi_vector_comparator.rb +lib/qdrant/models/multi_vector_config.rb +lib/qdrant/models/named_sparse_vector.rb +lib/qdrant/models/named_vector.rb +lib/qdrant/models/named_vector_struct.rb +lib/qdrant/models/nearest_query.rb +lib/qdrant/models/nested.rb +lib/qdrant/models/nested_condition.rb +lib/qdrant/models/operation_duration_statistics.rb +lib/qdrant/models/optimizer_telemetry.rb +lib/qdrant/models/optimizers_config.rb +lib/qdrant/models/optimizers_config_diff.rb +lib/qdrant/models/optimizers_status.rb +lib/qdrant/models/optimizers_status_one_of.rb +lib/qdrant/models/order_by.rb +lib/qdrant/models/order_by_interface.rb +lib/qdrant/models/order_by_query.rb +lib/qdrant/models/order_value.rb +lib/qdrant/models/overwrite_payload_operation.rb +lib/qdrant/models/p2p_config_telemetry.rb +lib/qdrant/models/payload_field.rb +lib/qdrant/models/payload_field_schema.rb +lib/qdrant/models/payload_index_info.rb +lib/qdrant/models/payload_index_telemetry.rb +lib/qdrant/models/payload_schema_params.rb +lib/qdrant/models/payload_schema_type.rb +lib/qdrant/models/payload_selector.rb +lib/qdrant/models/payload_selector_exclude.rb +lib/qdrant/models/payload_selector_include.rb +lib/qdrant/models/payload_storage_type.rb +lib/qdrant/models/payload_storage_type_one_of.rb +lib/qdrant/models/payload_storage_type_one_of1.rb +lib/qdrant/models/peer_info.rb +lib/qdrant/models/point_group.rb +lib/qdrant/models/point_ids_list.rb +lib/qdrant/models/point_insert_operations.rb +lib/qdrant/models/point_request.rb +lib/qdrant/models/point_struct.rb +lib/qdrant/models/point_vectors.rb +lib/qdrant/models/points_batch.rb +lib/qdrant/models/points_list.rb +lib/qdrant/models/points_selector.rb +lib/qdrant/models/prefetch.rb +lib/qdrant/models/prefetch_prefetch.rb +lib/qdrant/models/product_quantization.rb +lib/qdrant/models/product_quantization_config.rb +lib/qdrant/models/quantization_config.rb +lib/qdrant/models/quantization_config_diff.rb +lib/qdrant/models/quantization_search_params.rb +lib/qdrant/models/query.rb +lib/qdrant/models/query_batch_points200_response.rb +lib/qdrant/models/query_groups_request.rb +lib/qdrant/models/query_interface.rb +lib/qdrant/models/query_points200_response.rb +lib/qdrant/models/query_request.rb +lib/qdrant/models/query_request_batch.rb +lib/qdrant/models/query_request_prefetch.rb +lib/qdrant/models/query_response.rb +lib/qdrant/models/raft_info.rb +lib/qdrant/models/range.rb +lib/qdrant/models/range_interface.rb +lib/qdrant/models/read_consistency.rb +lib/qdrant/models/read_consistency_type.rb +lib/qdrant/models/recommend_example.rb +lib/qdrant/models/recommend_groups_request.rb +lib/qdrant/models/recommend_input.rb +lib/qdrant/models/recommend_query.rb +lib/qdrant/models/recommend_request.rb +lib/qdrant/models/recommend_request_batch.rb +lib/qdrant/models/recommend_strategy.rb +lib/qdrant/models/record.rb +lib/qdrant/models/recover_from_uploaded_snapshot202_response.rb +lib/qdrant/models/remote_shard_info.rb +lib/qdrant/models/remote_shard_telemetry.rb +lib/qdrant/models/rename_alias.rb +lib/qdrant/models/rename_alias_operation.rb +lib/qdrant/models/replica.rb +lib/qdrant/models/replica_set_telemetry.rb +lib/qdrant/models/replica_state.rb +lib/qdrant/models/replicate_shard.rb +lib/qdrant/models/replicate_shard_operation.rb +lib/qdrant/models/requests_telemetry.rb +lib/qdrant/models/resharding_direction.rb +lib/qdrant/models/resharding_info.rb +lib/qdrant/models/restart_transfer.rb +lib/qdrant/models/restart_transfer_operation.rb +lib/qdrant/models/running_environment_telemetry.rb +lib/qdrant/models/sample.rb +lib/qdrant/models/sample_query.rb +lib/qdrant/models/scalar_quantization.rb +lib/qdrant/models/scalar_quantization_config.rb +lib/qdrant/models/scalar_type.rb +lib/qdrant/models/scored_point.rb +lib/qdrant/models/scroll_points200_response.rb +lib/qdrant/models/scroll_request.rb +lib/qdrant/models/scroll_result.rb +lib/qdrant/models/search_batch_points200_response.rb +lib/qdrant/models/search_groups_request.rb +lib/qdrant/models/search_matrix_offsets200_response.rb +lib/qdrant/models/search_matrix_offsets_response.rb +lib/qdrant/models/search_matrix_pair.rb +lib/qdrant/models/search_matrix_pairs200_response.rb +lib/qdrant/models/search_matrix_pairs_response.rb +lib/qdrant/models/search_matrix_request.rb +lib/qdrant/models/search_params.rb +lib/qdrant/models/search_point_groups200_response.rb +lib/qdrant/models/search_points200_response.rb +lib/qdrant/models/search_request.rb +lib/qdrant/models/search_request_batch.rb +lib/qdrant/models/segment_config.rb +lib/qdrant/models/segment_info.rb +lib/qdrant/models/segment_telemetry.rb +lib/qdrant/models/segment_type.rb +lib/qdrant/models/set_payload.rb +lib/qdrant/models/set_payload_operation.rb +lib/qdrant/models/shard_key.rb +lib/qdrant/models/shard_key_selector.rb +lib/qdrant/models/shard_snapshot_location.rb +lib/qdrant/models/shard_snapshot_recover.rb +lib/qdrant/models/shard_status.rb +lib/qdrant/models/shard_transfer_info.rb +lib/qdrant/models/shard_transfer_method.rb +lib/qdrant/models/sharding_method.rb +lib/qdrant/models/snapshot_description.rb +lib/qdrant/models/snapshot_priority.rb +lib/qdrant/models/snapshot_recover.rb +lib/qdrant/models/sparse_index_config.rb +lib/qdrant/models/sparse_index_params.rb +lib/qdrant/models/sparse_index_type.rb +lib/qdrant/models/sparse_vector.rb +lib/qdrant/models/sparse_vector_data_config.rb +lib/qdrant/models/sparse_vector_params.rb +lib/qdrant/models/start_from.rb +lib/qdrant/models/state_role.rb +lib/qdrant/models/telemetry200_response.rb +lib/qdrant/models/telemetry_data.rb +lib/qdrant/models/text_index_params.rb +lib/qdrant/models/text_index_type.rb +lib/qdrant/models/tokenizer_type.rb +lib/qdrant/models/tracker_status.rb +lib/qdrant/models/tracker_status_one_of.rb +lib/qdrant/models/tracker_status_one_of1.rb +lib/qdrant/models/tracker_telemetry.rb +lib/qdrant/models/update_collection.rb +lib/qdrant/models/update_operation.rb +lib/qdrant/models/update_operations.rb +lib/qdrant/models/update_result.rb +lib/qdrant/models/update_status.rb +lib/qdrant/models/update_vectors.rb +lib/qdrant/models/update_vectors_operation.rb +lib/qdrant/models/upsert_operation.rb +lib/qdrant/models/uuid_index_params.rb +lib/qdrant/models/uuid_index_type.rb +lib/qdrant/models/value_variants.rb +lib/qdrant/models/values_count.rb +lib/qdrant/models/vector.rb +lib/qdrant/models/vector_data_config.rb +lib/qdrant/models/vector_data_info.rb +lib/qdrant/models/vector_index_searches_telemetry.rb +lib/qdrant/models/vector_input.rb +lib/qdrant/models/vector_params.rb +lib/qdrant/models/vector_params_diff.rb +lib/qdrant/models/vector_storage_datatype.rb +lib/qdrant/models/vector_storage_type.rb +lib/qdrant/models/vector_struct.rb +lib/qdrant/models/vectors_config.rb +lib/qdrant/models/version_info.rb +lib/qdrant/models/wal_config.rb +lib/qdrant/models/wal_config_diff.rb +lib/qdrant/models/web_api_telemetry.rb +lib/qdrant/models/with_lookup.rb +lib/qdrant/models/with_lookup_interface.rb +lib/qdrant/models/with_payload_interface.rb +lib/qdrant/models/with_vector.rb +lib/qdrant/models/write_ordering.rb +lib/qdrant/polymorphism.rb +lib/qdrant/response.rb +lib/qdrant/serializable.rb +lib/qdrant/validations.rb +lib/qdrant/version.rb +qdrant.gemspec +spec/spec_helper.rb diff --git a/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/VERSION b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/others/ruby-idiomatic-qdrant/.rspec b/samples/client/others/ruby-idiomatic-qdrant/.rspec new file mode 100644 index 000000000000..372b5acf8cf1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.rspec @@ -0,0 +1 @@ +--warnings diff --git a/samples/client/others/ruby-idiomatic-qdrant/.rubocop.yml b/samples/client/others/ruby-idiomatic-qdrant/.rubocop.yml new file mode 100644 index 000000000000..b9e64a342177 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/.rubocop.yml @@ -0,0 +1,123 @@ +--- +plugins: + - rubocop-performance + - rubocop-rake + - rubocop-rspec + +AllCops: + NewCops: enable + TargetRubyVersion: 3.0 + SuggestExtensions: false + # Merge our exclusions with RuboCop's defaults (vendor/**/*, etc.) instead of + # replacing them. + inherit_mode: + merge: + - Exclude + Exclude: + # Zeitwerk entry point: intentionally thin and can't be reorganized further. + - lib/qdrant.rb + # Bundler binstubs (if generated) are not our code to lint. + - bin/* + +Gemspec/RequireMFA: + Enabled: false + +######### +# STYLE # +######### + +Style/Documentation: + Enabled: false + +# The generated code uses `module Qdrant` + nested class, a valid idiom RuboCop's +# nested/compact binary does not model, and which is required for sibling-constant lexical scope. +Style/ClassAndModuleChildren: + Enabled: false + +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma + +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma + +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Generated `pattern:` regexes are copied verbatim from the OpenAPI document's +# `pattern` keyword; escapes that look redundant inside a character class may +# be exactly what the spec author intended, so this gem does not rewrite them. +Style/RedundantRegexpEscape: + Enabled: false + +# Generated `enum:` arrays hold arbitrary spec-supplied string values (which +# may contain whitespace or other characters unsafe for a bare %w literal), +# so plain string arrays are kept instead of switching per-array based on +# content. +Style/WordArray: + Enabled: false + +# Operations whose operationId collides with a sibling (once camelized) get a +# numeric suffix (`_1`, `_2`, ...) from OpenAPI Generator's own operationId +# de-duplication, driven by the source document rather than this gem. +Naming/VariableNumber: + Enabled: false + +########## +# LAYOUT # +########## + +# Method-call/attribute continuation lines use a fixed extra indent rather +# than aligning to the first argument's column, since the column position +# would otherwise vary with every generated method/attribute name. +Layout/ArgumentAlignment: + EnforcedStyle: with_fixed_indentation + +Layout/HashAlignment: + EnforcedColonStyle: key + EnforcedHashRocketStyle: key + +# Generated hashes (query params, attribute maps) are mechanically emitted and legitimately long. +Layout/LineLength: + Enabled: false + +########### +# METRICS # +########### + +# Generated models/APIs mirror the shape of the OpenAPI document they were +# generated from -- a schema with many properties or an API with many +# operations legitimately produces a large class/method. Rather than chase +# generated-code-only offenses forever, the Metrics department is tuned very +# generously (effectively off) for this generated gem; genuine style cops +# above stay on. +Metrics: + Enabled: false + +######### +# RSPEC # +######### + +# Generated specs are intentionally repetitive/thin smoke tests over +# generated models and APIs; relax the cops that assume hand-written, +# example-per-behavior specs. +RSpec/ExampleLength: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/MultipleMemoizedHelpers: + Enabled: false + +RSpec/NestedGroups: + Enabled: false + +RSpec/DescribeClass: + Enabled: false + +# The generated spec tree intentionally omits an extra top-level directory +# named after the gem (spec/api/..., not spec//api/...) since the +# whole spec/ directory is already gem-scoped; that layout choice is a +# permanent mismatch with this cop's naming convention. +RSpec/SpecFilePathFormat: + Enabled: false diff --git a/samples/client/others/ruby-idiomatic-qdrant/Gemfile b/samples/client/others/ruby-idiomatic-qdrant/Gemfile new file mode 100644 index 000000000000..13f7bcbba8ef --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/Gemfile @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake' + gem 'rspec', '~> 3.6' + gem 'simplecov', require: false + + # Linter / static analysis + gem 'rubocop', require: false + gem 'rubocop-performance', require: false + gem 'rubocop-rake', require: false + gem 'rubocop-rspec', require: false +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/LICENSE b/samples/client/others/ruby-idiomatic-qdrant/LICENSE new file mode 100644 index 000000000000..fdddb29aa445 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/samples/client/others/ruby-idiomatic-qdrant/README.md b/samples/client/others/ruby-idiomatic-qdrant/README.md new file mode 100644 index 000000000000..69b0fffdfce6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/README.md @@ -0,0 +1,127 @@ +# qdrant + +Ruby client for **Qdrant API**. Generated by [OpenAPI Generator](https://openapi-generator.tech) (`ruby-idiomatic`). + +- Requires Ruby >= 3.0 +- HTTP via [Faraday](https://github.com/lostisland/faraday) +- Lazy class loading via [Zeitwerk](https://github.com/fxn/zeitwerk) + +## Installation + +Add to your `Gemfile`: + +```ruby +gem "qdrant" +``` + +then run `bundle install`. Or install it directly: + +```sh +gem install qdrant +``` + +## Getting started + +```ruby +require "qdrant" + +client = Qdrant::Client.new(base_url: "http://localhost:6333") + +# Operations are grouped into namespaced sub-clients that mirror the API's +# resources, so a call reads as `client..`: +# +# response = client..(some_param: "value") +# response.data # => the deserialized model (or Array of models) +# response.status # => the HTTP status code +# response.headers # => the response headers +# +# The response delegates to `data`, so you can iterate/index it directly: +# +# response.each { |item| ... } +``` + +## Configuration + +`Client.new` takes a base URL plus options, or a configuration block. Each client +owns its own `Configuration` and `Connection`, so several independent clients can +coexist in the same process — there is no global state. + +```ruby +client = Qdrant::Client.new(base_url: "http://localhost:6333") do |config| + config.timeout = 10 + config.api_key = "YOUR_API_KEY" + config.access_token = "YOUR_ACCESS_TOKEN" +end +``` + +## Error handling + +Every non-2xx response and every transport/network error is raised as a single +`Qdrant::ApiError`: + +```ruby +begin + client.. +rescue Qdrant::ApiError => e + e.status # => HTTP status code (nil for a transport error) + e.body # => the raw response body + e.headers # => the response headers +end +``` + +## Custom middleware / request signing + +Static credentials (`apiKey`, `bearer`, `basic`) are handled from the OpenAPI spec. +A **request signature** — a hash computed per request over the method, full URL, body +and a timestamp (OVH, AWS SigV4, RFC 9421, ...) — cannot be modeled as an OpenAPI +security scheme, so it is registered as a Faraday middleware via `config.use`. Your +middleware runs after the built-in request middleware (it sees the serialized body and +final URL) and just before the adapter: + +```ruby +require "digest/sha1" + +class OvhSignature < Faraday::Middleware + def initialize(app, app_key:, app_secret:, consumer_key:) + super(app) + @app_key = app_key + @app_secret = app_secret + @consumer_key = consumer_key + end + + def on_request(env) + ts = Time.now.to_i.to_s + url = env.url.to_s + sig = "$1$" + Digest::SHA1.hexdigest( + [@app_secret, @consumer_key, env.method.to_s.upcase, url, env.body.to_s, ts].join("+") + ) + env.request_headers.merge!( + "X-Ovh-Application" => @app_key, + "X-Ovh-Consumer" => @consumer_key, + "X-Ovh-Timestamp" => ts, + "X-Ovh-Signature" => sig + ) + end +end + +client = Qdrant::Client.new(base_url: "http://localhost:6333") do |config| + config.use(OvhSignature, app_key: "...", app_secret: "...", consumer_key: "...") +end +``` + +`config.use` returns `self`, so calls can be chained. Middlewares run in registration +order; computing the full URL (with query string) from `env.url` / `env.params` is the +middleware's responsibility. + +## Threaded servers + +Class loading is lazy. Under a threaded server (Puma, etc.), eager-load once at +boot so autoloading never happens across threads: + +```ruby +Qdrant.eager_load! +``` + +## License + +`unlicense` diff --git a/samples/client/others/ruby-idiomatic-qdrant/Rakefile b/samples/client/others/ruby-idiomatic-qdrant/Rakefile new file mode 100644 index 000000000000..82bb534a7463 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/samples/client/others/ruby-idiomatic-qdrant/bin/rspec b/samples/client/others/ruby-idiomatic-qdrant/bin/rspec new file mode 100644 index 000000000000..93e191c2ff7e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/bin/rspec @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/samples/client/others/ruby-idiomatic-qdrant/bin/rubocop b/samples/client/others/ruby-idiomatic-qdrant/bin/rubocop new file mode 100644 index 000000000000..d73598dc2283 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/bin/rubocop @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant.rb new file mode 100644 index 000000000000..5be13f72f31e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +require 'erb' +require 'forwardable' +require 'json' +require 'time' + +require 'faraday' +require 'faraday/multipart' +require 'zeitwerk' + +module Qdrant + class << self + attr_reader :loader + end + + @loader = Zeitwerk::Loader.for_gem + # The `api/` directory on disk is fixed regardless of the `apiNamespace` CliOption, + # but api.mustache only nests classes under an `Api` module when the wrapper is + # enabled (true). When it's disabled, tell Zeitwerk to collapse + # that directory so it doesn't expect a `Qdrant::Api` namespace that the + # generated classes never actually define. + @loader.setup + + def self.eager_load! + @loader.eager_load + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/aliases.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/aliases.rb new file mode 100644 index 000000000000..689c1332cbb8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/aliases.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Aliases + def initialize(connection) + @connection = connection + end + + def list + @connection.call( + :GET, + '/aliases', + type: Qdrant::Models::GetCollectionAliases200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster.rb new file mode 100644 index 000000000000..8b1c3feb05b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Cluster + def initialize(connection) + @connection = connection + end + + def recover + @connection.call( + :POST, + '/cluster/recover', + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def status + @connection.call( + :GET, + '/cluster', + type: Qdrant::Models::ClusterStatus200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster/peer.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster/peer.rb new file mode 100644 index 000000000000..564d4d9cd213 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/cluster/peer.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Cluster::Peer + def initialize(connection) + @connection = connection + end + + def delete(peer_id:, force: nil) + raise ArgumentError, 'peer_id is required' if peer_id.nil? + + @connection.call( + :DELETE, + '/cluster/peer/{peer_id}' + .gsub('{peer_id}', ERB::Util.url_encode(peer_id.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'force' => force } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections.rb new file mode 100644 index 000000000000..7edd209dc13c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Collections + def initialize(connection) + @connection = connection + end + + def aliases(timeout: nil, change_aliases_operation: nil) + @connection.call( + :POST, + '/collections/aliases', + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: change_aliases_operation + ) + end + + def aliases_get(collection_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/aliases' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::GetCollectionAliases200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def cluster(collection_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/cluster' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CollectionClusterInfo200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def cluster_post(collection_name:, timeout: nil, cluster_operations: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/cluster' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: cluster_operations + ) + end + + def delete(collection_name:, timeout: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :DELETE, + '/collections/{collection_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout } + ) + end + + def exists(collection_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/exists' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CollectionExists200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def facet(collection_name:, timeout: nil, consistency: nil, facet_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/facet' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::Facet200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout, 'consistency' => consistency }, + body: facet_request + ) + end + + def get(collection_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::GetCollection200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def list + @connection.call( + :GET, + '/collections', + type: Qdrant::Models::GetCollections200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def partial_update(collection_name:, timeout: nil, update_collection: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PATCH, + '/collections/{collection_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: update_collection + ) + end + + def update(collection_name:, timeout: nil, create_collection: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: create_collection + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/index.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/index.rb new file mode 100644 index 000000000000..bc9793c1125f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/index.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Collections::Index + def initialize(connection) + @connection = connection + end + + def bulk_update(collection_name:, wait: nil, ordering: nil, create_field_index: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/index' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: create_field_index + ) + end + + def delete(collection_name:, field_name:, wait: nil, ordering: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'field_name is required' if field_name.nil? + + @connection.call( + :DELETE, + '/collections/{collection_name}/index/{field_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{field_name}', ERB::Util.url_encode(field_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/points.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/points.rb new file mode 100644 index 000000000000..cd4157bb7e47 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/points.rb @@ -0,0 +1,376 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Collections::Points + def initialize(connection) + @connection = connection + end + + def batch(collection_name:, wait: nil, ordering: nil, update_operations: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/batch' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::BatchUpdate200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: update_operations + ) + end + + def bulk_update(collection_name:, wait: nil, ordering: nil, point_insert_operations: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/points' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: point_insert_operations + ) + end + + def count(collection_name:, timeout: nil, count_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/count' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CountPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: count_request + ) + end + + def create(collection_name:, consistency: nil, timeout: nil, point_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::GetPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: point_request + ) + end + + def delete(collection_name:, wait: nil, ordering: nil, points_selector: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/delete' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: points_selector + ) + end + + def discover(collection_name:, consistency: nil, timeout: nil, discover_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/discover' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: discover_request + ) + end + + def discover_batch(collection_name:, consistency: nil, timeout: nil, discover_request_batch: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/discover/batch' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchBatchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: discover_request_batch + ) + end + + def get(collection_name:, id:, consistency: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'id is required' if id.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/points/{id}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{id}', ERB::Util.url_encode(id.to_s)), + type: Qdrant::Models::GetPoint200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency } + ) + end + + def payload(collection_name:, wait: nil, ordering: nil, set_payload: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/points/payload' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: set_payload + ) + end + + def payload_clear(collection_name:, wait: nil, ordering: nil, points_selector: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/payload/clear' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: points_selector + ) + end + + def payload_delete(collection_name:, wait: nil, ordering: nil, delete_payload: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/payload/delete' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: delete_payload + ) + end + + def payload_post(collection_name:, wait: nil, ordering: nil, set_payload: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/payload' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: set_payload + ) + end + + def query(collection_name:, consistency: nil, timeout: nil, query_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/query' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::QueryPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: query_request + ) + end + + def query_batch(collection_name:, consistency: nil, timeout: nil, query_request_batch: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/query/batch' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::QueryBatchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: query_request_batch + ) + end + + def query_groups(collection_name:, consistency: nil, timeout: nil, query_groups_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/query/groups' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPointGroups200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: query_groups_request + ) + end + + def recommend(collection_name:, consistency: nil, timeout: nil, recommend_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/recommend' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: recommend_request + ) + end + + def recommend_batch(collection_name:, consistency: nil, timeout: nil, recommend_request_batch: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/recommend/batch' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchBatchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: recommend_request_batch + ) + end + + def recommend_groups(collection_name:, consistency: nil, timeout: nil, recommend_groups_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/recommend/groups' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPointGroups200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: recommend_groups_request + ) + end + + def scroll(collection_name:, consistency: nil, timeout: nil, scroll_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/scroll' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::ScrollPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: scroll_request + ) + end + + def search(collection_name:, consistency: nil, timeout: nil, search_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/search' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: search_request + ) + end + + def search_batch(collection_name:, consistency: nil, timeout: nil, search_request_batch: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/search/batch' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchBatchPoints200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: search_request_batch + ) + end + + def search_groups(collection_name:, consistency: nil, timeout: nil, search_groups_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/search/groups' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchPointGroups200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: search_groups_request + ) + end + + def search_matrix_offsets(collection_name:, consistency: nil, timeout: nil, search_matrix_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/search/matrix/offsets' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchMatrixOffsets200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: search_matrix_request + ) + end + + def search_matrix_pairs(collection_name:, consistency: nil, timeout: nil, search_matrix_request: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/search/matrix/pairs' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::SearchMatrixPairs200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'consistency' => consistency, 'timeout' => timeout }, + body: search_matrix_request + ) + end + + def vectors(collection_name:, wait: nil, ordering: nil, update_vectors: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/points/vectors' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: update_vectors + ) + end + + def vectors_delete(collection_name:, wait: nil, ordering: nil, delete_vectors: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/points/vectors/delete' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateFieldIndex200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'ordering' => ordering }, + body: delete_vectors + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/shards.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/shards.rb new file mode 100644 index 000000000000..a08ec39a1f4d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/shards.rb @@ -0,0 +1,133 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Collections::Shards + def initialize(connection) + @connection = connection + end + + def bulk_update(collection_name:, timeout: nil, create_sharding_key: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/shards' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: create_sharding_key + ) + end + + def delete(collection_name:, timeout: nil, drop_sharding_key: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/shards/delete' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'timeout' => timeout }, + body: drop_sharding_key + ) + end + + def snapshots(collection_name:, shard_id:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/shards/{shard_id}/snapshots' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)), + type: Qdrant::Models::ListSnapshots200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def snapshots_delete(collection_name:, shard_id:, snapshot_name:, wait: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :DELETE, + '/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)) + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def snapshots_get(collection_name:, shard_id:, snapshot_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)) + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + + def snapshots_post(collection_name:, shard_id:, wait: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/shards/{shard_id}/snapshots' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)), + type: Qdrant::Models::CreateSnapshot200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def snapshots_recover(collection_name:, shard_id:, wait: nil, shard_snapshot_recover: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/shards/{shard_id}/snapshots/recover' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait }, + body: shard_snapshot_recover + ) + end + + def snapshots_upload(collection_name:, shard_id:, wait: nil, priority: nil, checksum: nil, snapshot: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'shard_id is required' if shard_id.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/shards/{shard_id}/snapshots/upload' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{shard_id}', ERB::Util.url_encode(shard_id.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'priority' => priority, 'checksum' => checksum }, + form: { 'snapshot' => snapshot } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/snapshots.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/snapshots.rb new file mode 100644 index 000000000000..c5093b7113d3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/collections/snapshots.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Collections::Snapshots + def initialize(connection) + @connection = connection + end + + def create(collection_name:, wait: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/snapshots' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateSnapshot200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def delete(collection_name:, snapshot_name:, wait: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :DELETE, + '/collections/{collection_name}/snapshots/{snapshot_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def get(collection_name:, snapshot_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/snapshots/{snapshot_name}' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)) + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + + def list(collection_name:) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :GET, + '/collections/{collection_name}/snapshots' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::ListSnapshots200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + + def recover(collection_name:, wait: nil, snapshot_recover: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :PUT, + '/collections/{collection_name}/snapshots/recover' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait }, + body: snapshot_recover + ) + end + + def upload(collection_name:, wait: nil, priority: nil, checksum: nil, snapshot: nil) + raise ArgumentError, 'collection_name is required' if collection_name.nil? + + @connection.call( + :POST, + '/collections/{collection_name}/snapshots/upload' + .gsub('{collection_name}', ERB::Util.url_encode(collection_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait, 'priority' => priority, 'checksum' => checksum }, + form: { 'snapshot' => snapshot } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/healthz.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/healthz.rb new file mode 100644 index 000000000000..28392de1e481 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/healthz.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Healthz + def initialize(connection) + @connection = connection + end + + def list + @connection.call( + :GET, + '/healthz', + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/issues.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/issues.rb new file mode 100644 index 000000000000..e658707a7b23 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/issues.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Issues + def initialize(connection) + @connection = connection + end + + def bulk_destroy + @connection.call( + :DELETE, + '/issues', + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + + def list + @connection.call( + :GET, + '/issues', + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/livez.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/livez.rb new file mode 100644 index 000000000000..5ae3ccc5b202 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/livez.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Livez + def initialize(connection) + @connection = connection + end + + def list + @connection.call( + :GET, + '/livez', + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/locks.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/locks.rb new file mode 100644 index 000000000000..57c0b9bd1e0d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/locks.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Locks + def initialize(connection) + @connection = connection + end + + def create(locks_option: nil) + @connection.call( + :POST, + '/locks', + type: Qdrant::Models::GetLocks200Response, + auth: ['api-key', 'bearerAuth'], + body: locks_option + ) + end + + def list + @connection.call( + :GET, + '/locks', + type: Qdrant::Models::GetLocks200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/metrics.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/metrics.rb new file mode 100644 index 000000000000..06cd5b149444 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/metrics.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Metrics + def initialize(connection) + @connection = connection + end + + def list(anonymize: nil) + @connection.call( + :GET, + '/metrics', + type: nil, + auth: ['api-key', 'bearerAuth'], + query: { 'anonymize' => anonymize } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/readyz.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/readyz.rb new file mode 100644 index 000000000000..00d6e14f0f9c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/readyz.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Readyz + def initialize(connection) + @connection = connection + end + + def list + @connection.call( + :GET, + '/readyz', + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/root.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/root.rb new file mode 100644 index 000000000000..34675ac11e62 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/root.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Root + def initialize(connection) + @connection = connection + end + + def list + @connection.call( + :GET, + '/', + type: Qdrant::Models::VersionInfo, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/snapshots.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/snapshots.rb new file mode 100644 index 000000000000..3c1dbfe5c942 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/snapshots.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Snapshots + def initialize(connection) + @connection = connection + end + + def create(wait: nil) + @connection.call( + :POST, + '/snapshots', + type: Qdrant::Models::CreateSnapshot200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def delete(snapshot_name:, wait: nil) + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :DELETE, + '/snapshots/{snapshot_name}' + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: Qdrant::Models::CreateShardKey200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'wait' => wait } + ) + end + + def get(snapshot_name:) + raise ArgumentError, 'snapshot_name is required' if snapshot_name.nil? + + @connection.call( + :GET, + '/snapshots/{snapshot_name}' + .gsub('{snapshot_name}', ERB::Util.url_encode(snapshot_name.to_s)), + type: nil, + auth: ['api-key', 'bearerAuth'] + ) + end + + def list + @connection.call( + :GET, + '/snapshots', + type: Qdrant::Models::ListSnapshots200Response, + auth: ['api-key', 'bearerAuth'] + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/telemetry.rb new file mode 100644 index 000000000000..e89d1c53f9a2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api/telemetry.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Qdrant + module Api + class Telemetry + def initialize(connection) + @connection = connection + end + + def list(anonymize: nil) + @connection.call( + :GET, + '/telemetry', + type: Qdrant::Models::Telemetry200Response, + auth: ['api-key', 'bearerAuth'], + query: { 'anonymize' => anonymize } + ) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api_error.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api_error.rb new file mode 100644 index 000000000000..d5bf6150bf6c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/api_error.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Qdrant + class ApiError < StandardError + attr_reader :status, :headers, :body, :response + + def initialize(message = nil, status: nil, headers: nil, body: nil, response: nil) + @status = status + @headers = headers + @body = body + @response = response + super(message || "HTTP #{status}") + end + + def self.from(response) + new(status: response.status, headers: response.headers, body: response.body, response: response) + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/client.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/client.rb new file mode 100644 index 000000000000..95c4393379c7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/client.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module Qdrant + class Client + attr_reader :configuration, :connection + + def initialize(base_url: nil, **options, &block) + @configuration = Configuration.new(base_url: base_url, **options, &block) + @connection = Connection.new(@configuration) + end + + def aliases + @aliases ||= Qdrant::Api::Aliases.new(@connection) + end + + def cluster + @cluster ||= Qdrant::Api::Cluster.new(@connection) + end + + def collections + @collections ||= Qdrant::Api::Collections.new(@connection) + end + + def healthz + @healthz ||= Qdrant::Api::Healthz.new(@connection) + end + + def issues + @issues ||= Qdrant::Api::Issues.new(@connection) + end + + def livez + @livez ||= Qdrant::Api::Livez.new(@connection) + end + + def locks + @locks ||= Qdrant::Api::Locks.new(@connection) + end + + def metrics + @metrics ||= Qdrant::Api::Metrics.new(@connection) + end + + def readyz + @readyz ||= Qdrant::Api::Readyz.new(@connection) + end + + def root + @root ||= Qdrant::Api::Root.new(@connection) + end + + def snapshots + @snapshots ||= Qdrant::Api::Snapshots.new(@connection) + end + + def telemetry + @telemetry ||= Qdrant::Api::Telemetry.new(@connection) + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/configuration.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/configuration.rb new file mode 100644 index 000000000000..3b7fc40d0dba --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/configuration.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module Qdrant + class Configuration + attr_accessor :base_url, :timeout, :logger, :debugging, :query_array_encoding, :api_key, :access_token + + def initialize(base_url: nil, **options) + @base_url = base_url || 'http://localhost:6333' + @timeout = 60 + @query_array_encoding = :repeat + @debugging = false + @middlewares = [] + options.each do |k, v| + raise ArgumentError, "unknown configuration option: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + yield self if block_given? + end + + def configure_faraday(conn) + # Order matters: :multipart / :url_encoded must run before :json so form calls + # (Connection#call `form:`) get encoded first -- Connection#call pins the + # Content-Type to "application/json" up front on non-form calls, so these two + # middlewares' own (weaker) content-type guards correctly no-op on JSON bodies. + conn.request :multipart + conn.request :url_encoded + conn.request :json + conn.response :json, content_type: /\bjson$/ + conn.options.timeout = timeout + conn.response :logger, logger if logger && debugging + @middlewares.each { |mw, mw_args, mw_block| conn.use(mw, *mw_args, &mw_block) } + conn.adapter Faraday.default_adapter + end + + # Applies authentication credentials to a single request's headers and query + # params. Called by Connection#call on EVERY request (not baked into the + # persistent Faraday connection at build time) so credential rotation -- + # token refresh, a new api_key -- takes effect on the very next call. + # `auth_names` are the security schemes the current operation actually declares (empty + # for `security: []` public endpoints); only those are applied, so credentials never + # leak to public endpoints nor stack conflicting Authorization headers. + # rubocop:disable Lint/UnusedMethodArgument -- headers/query/auth_names form the fixed + # per-request auth interface (Connection#call); a given generated client may exercise + # only some of them (e.g. no query-based key, or no auth method at all). + def apply_auth(headers, query, auth_names) + headers['api-key'] = api_key if api_key && auth_names.include?('api-key') + headers['Authorization'] = "Bearer #{access_token}" if access_token && auth_names.include?('bearerAuth') + nil + end + # rubocop:enable Lint/UnusedMethodArgument + + # Register a Faraday middleware to run on every request, after the built-in + # request middleware (so it sees the serialized body and final URL) and just + # before the adapter. Use for request signing (OVH, AWS SigV4, ...). + def use(middleware, *args, &block) + @middlewares << [middleware, args, block] + self + end + + def encode_array(values) + case query_array_encoding + when :csv then values.join(',') + else values + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/connection.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/connection.rb new file mode 100644 index 000000000000..08c3089b9f44 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/connection.rb @@ -0,0 +1,118 @@ +# frozen_string_literal: true + +module Qdrant + # The single HTTP choke-point. Every operation goes through `call`. + class Connection + def initialize(configuration) + @configuration = configuration + # Force a trailing slash so a base_url that itself carries a path prefix + # (e.g. "https://api.ovh.com/1.0") is preserved: request paths are made + # relative (their leading slash is stripped in #call) and resolved against it. + base = configuration.base_url + base += '/' unless base.end_with?('/') + @faraday = Faraday.new(url: base) do |conn| + configuration.configure_faraday(conn) + end + end + + # `body` (JSON) and `form` (urlencoded/multipart) are mutually exclusive -- an + # operation has either a request body or form params, never both. + def call(method, path, type: nil, auth: [], query: {}, headers: {}, body: nil, form: nil) + # Faraday's `run_request` only accepts lowercase method symbols; api.mustache + # emits the readable uppercase form (e.g. `:GET`), so normalize it here. + method = method.to_s.downcase.to_sym + # Make the path relative so Faraday resolves it against the (slash-terminated) + # base_url without discarding any base path prefix. + path = path.sub(%r{\A/+}, '') + request_headers = merge_headers(headers) + request_query = query.compact.transform_keys(&:to_s) + # Only the auth schemes the operation actually declares are applied, so credentials + # never leak to endpoints with `security: []` nor stack conflicting Authorization + # headers on operations that accept only one of several schemes. + @configuration.apply_auth(request_headers, request_query, auth) + request_body = + if form + wrap_form(form) + else + # Pin the content type ourselves so the `:multipart`/`:url_encoded` request + # middlewares (registered ahead of `:json` in Configuration#configure_faraday + # so form calls can be encoded before `:json` sees them) do not mistake a + # plain JSON Hash/Array body for a form payload -- both only skip a request + # once its Content-Type is set to something other than what they handle. + request_headers['Content-Type'] ||= 'application/json' unless body.nil? + serialize_body(body) + end + + response = @faraday.run_request(method, path, request_body, request_headers) do |req| + req.params.update(encode_query(request_query)) + end + raise ApiError.from(response) unless response.success? + + Response.new(data: deserialize(response.body, type), status: response.status, headers: response.headers) + rescue Faraday::Error => e + # Ruby sets #cause automatically to `e` when raising inside a rescue block. + raise ApiError, e.message + end + + private + + def serialize_body(body) + return nil if body.nil? + + body.respond_to?(:to_body) ? body.to_body : body + end + + def merge_headers(headers) + headers.compact.transform_keys(&:to_s) + end + + def encode_query(query) + query.compact.each_with_object({}) do |(k, v), out| + out[k.to_s] = v.is_a?(Array) ? @configuration.encode_array(v) : v + end + end + + # Drops nil form values and wraps bare IO-like values (e.g. a plain `File.open(...)`) + # in a `Faraday::Multipart::FilePart` so the `:multipart` middleware's file + # detection (which looks for `:content_type`, not `:read`) can see them. Values + # that are already a FilePart/UploadIO (they respond to `:content_type`) or plain + # scalars pass through untouched; the `:multipart`/`:url_encoded` middlewares + # decide for themselves (based on whether any part looks like a file) which + # encoding to apply. + def wrap_form(form) + form.compact.transform_values do |v| + next v if !v.respond_to?(:read) || v.respond_to?(:content_type) + + Faraday::Multipart::FilePart.new(v, 'application/octet-stream') + end + end + + def deserialize(body, type) + return nil if body.nil? || body == '' + + # A successful response with a non-JSON body (plain text, HTML from a + # misbehaving proxy, ...) must not escape the single ApiError contract. + data = + if body.is_a?(String) + begin + JSON.parse(body) + rescue JSON::ParserError => e + raise ApiError, "invalid JSON in response body: #{e.message}" + end + else + body + end + return data if type.nil? + + if type.respond_to?(:from_hash) + type.from_hash(data) + elsif type.respond_to?(:build) + type.build(data) + elsif type.is_a?(Array) && type.first.respond_to?(:from_hash) + data.map { |el| type.first.from_hash(el) } + else + data + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_shard_transfer.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_shard_transfer.rb new file mode 100644 index 000000000000..87eb45a8d1c1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_shard_transfer.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class AbortShardTransfer + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :to_peer_id, + type: 'Integer', + json_key: 'to_peer_id', + required: true, + minimum: 0 + + attribute :from_peer_id, + type: 'Integer', + json_key: 'from_peer_id', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_transfer_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_transfer_operation.rb new file mode 100644 index 000000000000..54c3a68c9aa7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/abort_transfer_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class AbortTransferOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :abort_transfer, + type: 'AbortShardTransfer', + json_key: 'abort_transfer', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_description.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_description.rb new file mode 100644 index 000000000000..3a7489ecd71c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_description.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class AliasDescription + include Qdrant::Serializable + include Qdrant::Validations + + attribute :alias_name, + type: 'String', + json_key: 'alias_name', + required: true + + attribute :collection_name, + type: 'String', + json_key: 'collection_name', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_operations.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_operations.rb new file mode 100644 index 000000000000..c3ed259aeca3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/alias_operations.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module AliasOperations + CANDIDATES = [ + 'CreateAliasOperation', + 'DeleteAliasOperation', + 'RenameAliasOperation', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/any_variants.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/any_variants.rb new file mode 100644 index 000000000000..a6fad95bbb20 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/any_variants.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module AnyVariants + CANDIDATES = [ + 'Array', + 'Array', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_build_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_build_telemetry.rb new file mode 100644 index 000000000000..10ee7e7c279f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_build_telemetry.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class AppBuildTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :version, + type: 'String', + json_key: 'version', + required: true + + attribute :features, + type: 'AppFeaturesTelemetry', + json_key: 'features', + required: false + + attribute :system, + type: 'RunningEnvironmentTelemetry', + json_key: 'system', + required: false + + attribute :jwt_rbac, + type: 'Boolean', + json_key: 'jwt_rbac', + required: false + + attribute :hide_jwt_dashboard, + type: 'Boolean', + json_key: 'hide_jwt_dashboard', + required: false + + attribute :startup, + type: 'Time', + json_key: 'startup', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_features_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_features_telemetry.rb new file mode 100644 index 000000000000..b3ea3e9bd81e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/app_features_telemetry.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class AppFeaturesTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :debug, + type: 'Boolean', + json_key: 'debug', + required: true + + attribute :web_feature, + type: 'Boolean', + json_key: 'web_feature', + required: true + + attribute :service_debug_feature, + type: 'Boolean', + json_key: 'service_debug_feature', + required: true + + attribute :recovery_mode, + type: 'Boolean', + json_key: 'recovery_mode', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch.rb new file mode 100644 index 000000000000..7b167389ae35 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Batch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :ids, + type: 'Array', + json_key: 'ids', + required: true + + attribute :vectors, + type: 'BatchVectorStruct', + json_key: 'vectors', + required: true + + attribute :payloads, + type: 'Array', + json_key: 'payloads', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_payloads_inner.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_payloads_inner.rb new file mode 100644 index 000000000000..eac938e95644 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_payloads_inner.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module BatchPayloadsInner + CANDIDATES = [ + 'Hash', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_update200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_update200_response.rb new file mode 100644 index 000000000000..e5e1349466b6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_update200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class BatchUpdate200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_vector_struct.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_vector_struct.rb new file mode 100644 index 000000000000..a07892582d63 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/batch_vector_struct.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module BatchVectorStruct + CANDIDATES = [ + 'Array>>', + 'Array>', + 'Array', + 'Hash>', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization.rb new file mode 100644 index 000000000000..4f69c3de3582 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class BinaryQuantization + include Qdrant::Serializable + include Qdrant::Validations + + attribute :binary, + type: 'BinaryQuantizationConfig', + json_key: 'binary', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization_config.rb new file mode 100644 index 000000000000..e2995c9a3e11 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/binary_quantization_config.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class BinaryQuantizationConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :always_ram, + type: 'Boolean', + json_key: 'always_ram', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_params.rb new file mode 100644 index 000000000000..8ab8f00b17c1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_params.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class BoolIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'BoolIndexType', + json_key: 'type', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_type.rb new file mode 100644 index 000000000000..27091a61627e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/bool_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module BoolIndexType + BOOL = 'bool' + + def self.all + @all ||= [ + BOOL, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/change_aliases_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/change_aliases_operation.rb new file mode 100644 index 000000000000..c06e24737cdf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/change_aliases_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ChangeAliasesOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :actions, + type: 'Array', + json_key: 'actions', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/clear_payload_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/clear_payload_operation.rb new file mode 100644 index 000000000000..54de23885040 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/clear_payload_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClearPayloadOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :clear_payload, + type: 'PointsSelector', + json_key: 'clear_payload', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_config_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_config_telemetry.rb new file mode 100644 index 000000000000..c291d1eec28d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_config_telemetry.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterConfigTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :grpc_timeout_ms, + type: 'Integer', + json_key: 'grpc_timeout_ms', + required: true, + minimum: 0 + + attribute :p2p, + type: 'P2pConfigTelemetry', + json_key: 'p2p', + required: true + + attribute :consensus, + type: 'ConsensusConfigTelemetry', + json_key: 'consensus', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_operations.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_operations.rb new file mode 100644 index 000000000000..71ebae54d713 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_operations.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ClusterOperations + CANDIDATES = [ + 'AbortTransferOperation', + 'CreateShardingKeyOperation', + 'DropReplicaOperation', + 'DropShardingKeyOperation', + 'MoveShardOperation', + 'ReplicateShardOperation', + 'RestartTransferOperation', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status.rb new file mode 100644 index 000000000000..d67b9e1e13ac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module ClusterStatus + CANDIDATES = [ + 'ClusterStatusOneOf', + 'ClusterStatusOneOf1', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status200_response.rb new file mode 100644 index 000000000000..e7740432a0b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterStatus200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'ClusterStatus', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of.rb new file mode 100644 index 000000000000..57e66f3f628f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterStatusOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :status, + type: 'String', + json_key: 'status', + required: true, + enum: ['disabled'] + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of1.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of1.rb new file mode 100644 index 000000000000..b862517023f2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_one_of1.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterStatusOneOf1 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :status, + type: 'String', + json_key: 'status', + required: true, + enum: ['enabled'] + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: true, + minimum: 0 + + attribute :peers, + type: 'Hash', + json_key: 'peers', + required: true + + attribute :raft_info, + type: 'RaftInfo', + json_key: 'raft_info', + required: true + + attribute :consensus_thread_status, + type: 'ConsensusThreadStatus', + json_key: 'consensus_thread_status', + required: true + + attribute :message_send_failures, + type: 'Hash', + json_key: 'message_send_failures', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_telemetry.rb new file mode 100644 index 000000000000..88a114d4c2cb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_status_telemetry.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterStatusTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :number_of_peers, + type: 'Integer', + json_key: 'number_of_peers', + required: true, + minimum: 0 + + attribute :term, + type: 'Integer', + json_key: 'term', + required: true, + minimum: 0 + + attribute :commit, + type: 'Integer', + json_key: 'commit', + required: true, + minimum: 0 + + attribute :pending_operations, + type: 'Integer', + json_key: 'pending_operations', + required: true, + minimum: 0 + + attribute :role, + type: 'StateRole', + json_key: 'role', + required: false + + attribute :is_voter, + type: 'Boolean', + json_key: 'is_voter', + required: true + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: false, + minimum: 0 + + attribute :consensus_thread_status, + type: 'ConsensusThreadStatus', + json_key: 'consensus_thread_status', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_telemetry.rb new file mode 100644 index 000000000000..9a86543ca4b6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/cluster_telemetry.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ClusterTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :enabled, + type: 'Boolean', + json_key: 'enabled', + required: true + + attribute :status, + type: 'ClusterStatusTelemetry', + json_key: 'status', + required: false + + attribute :config, + type: 'ClusterConfigTelemetry', + json_key: 'config', + required: false + + attribute :peers, + type: 'Hash', + json_key: 'peers', + required: false + + attribute :metadata, + type: 'Hash', + json_key: 'metadata', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info.rb new file mode 100644 index 000000000000..d52eb10317f4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionClusterInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: true, + minimum: 0 + + attribute :shard_count, + type: 'Integer', + json_key: 'shard_count', + required: true, + minimum: 0 + + attribute :local_shards, + type: 'Array', + json_key: 'local_shards', + required: true + + attribute :remote_shards, + type: 'Array', + json_key: 'remote_shards', + required: true + + attribute :shard_transfers, + type: 'Array', + json_key: 'shard_transfers', + required: true + + attribute :resharding_operations, + type: 'Array', + json_key: 'resharding_operations', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info200_response.rb new file mode 100644 index 000000000000..a5baad2cfe56 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_cluster_info200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionClusterInfo200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CollectionClusterInfo', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_config.rb new file mode 100644 index 000000000000..c86d2167e77d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_config.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :params, + type: 'CollectionParams', + json_key: 'params', + required: true + + attribute :hnsw_config, + type: 'HnswConfig', + json_key: 'hnsw_config', + required: true + + attribute :optimizer_config, + type: 'OptimizersConfig', + json_key: 'optimizer_config', + required: true + + attribute :wal_config, + type: 'WalConfig', + json_key: 'wal_config', + required: true + + attribute :quantization_config, + type: 'QuantizationConfig', + json_key: 'quantization_config', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_description.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_description.rb new file mode 100644 index 000000000000..920dbc8c1734 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_description.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionDescription + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_existence.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_existence.rb new file mode 100644 index 000000000000..77032d638359 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_existence.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionExistence + include Qdrant::Serializable + include Qdrant::Validations + + attribute :exists, + type: 'Boolean', + json_key: 'exists', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_exists200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_exists200_response.rb new file mode 100644 index 000000000000..a1800e9d9c85 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_exists200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionExists200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CollectionExistence', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_info.rb new file mode 100644 index 000000000000..79efdc42fe68 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_info.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :status, + type: 'CollectionStatus', + json_key: 'status', + required: true + + attribute :optimizer_status, + type: 'OptimizersStatus', + json_key: 'optimizer_status', + required: true + + attribute :vectors_count, + type: 'Integer', + json_key: 'vectors_count', + required: false, + minimum: 0 + + attribute :indexed_vectors_count, + type: 'Integer', + json_key: 'indexed_vectors_count', + required: false, + minimum: 0 + + attribute :points_count, + type: 'Integer', + json_key: 'points_count', + required: false, + minimum: 0 + + attribute :segments_count, + type: 'Integer', + json_key: 'segments_count', + required: true, + minimum: 0 + + attribute :config, + type: 'CollectionConfig', + json_key: 'config', + required: true + + attribute :payload_schema, + type: 'Hash', + json_key: 'payload_schema', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params.rb new file mode 100644 index 000000000000..d1103c9189a6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :vectors, + type: 'VectorsConfig', + json_key: 'vectors', + required: false + + attribute :shard_number, + type: 'Integer', + json_key: 'shard_number', + required: false, + minimum: 1 + + attribute :sharding_method, + type: 'ShardingMethod', + json_key: 'sharding_method', + required: false + + attribute :replication_factor, + type: 'Integer', + json_key: 'replication_factor', + required: false, + minimum: 1 + + attribute :write_consistency_factor, + type: 'Integer', + json_key: 'write_consistency_factor', + required: false, + minimum: 1 + + attribute :read_fan_out_factor, + type: 'Integer', + json_key: 'read_fan_out_factor', + required: false, + minimum: 0 + + attribute :on_disk_payload, + type: 'Boolean', + json_key: 'on_disk_payload', + required: false + + attribute :sparse_vectors, + type: 'Hash', + json_key: 'sparse_vectors', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @shard_number = 1 if @shard_number.nil? + @replication_factor = 1 if @replication_factor.nil? + @write_consistency_factor = 1 if @write_consistency_factor.nil? + @on_disk_payload = false if @on_disk_payload.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params_diff.rb new file mode 100644 index 000000000000..c06502543c0b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_params_diff.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionParamsDiff + include Qdrant::Serializable + include Qdrant::Validations + + attribute :replication_factor, + type: 'Integer', + json_key: 'replication_factor', + required: false, + minimum: 1 + + attribute :write_consistency_factor, + type: 'Integer', + json_key: 'write_consistency_factor', + required: false, + minimum: 1 + + attribute :read_fan_out_factor, + type: 'Integer', + json_key: 'read_fan_out_factor', + required: false, + minimum: 0 + + attribute :on_disk_payload, + type: 'Boolean', + json_key: 'on_disk_payload', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_status.rb new file mode 100644 index 000000000000..dd0497883e7c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_status.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module CollectionStatus + GREEN = 'green' + YELLOW = 'yellow' + GREY = 'grey' + RED = 'red' + + def self.all + @all ||= [ + GREEN, + YELLOW, + GREY, + RED, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry.rb new file mode 100644 index 000000000000..1086e0b8ec4d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'String', + json_key: 'id', + required: true + + attribute :init_time_ms, + type: 'Integer', + json_key: 'init_time_ms', + required: true, + minimum: 0 + + attribute :config, + type: 'CollectionConfig', + json_key: 'config', + required: true + + attribute :shards, + type: 'Array', + json_key: 'shards', + required: true + + attribute :transfers, + type: 'Array', + json_key: 'transfers', + required: true + + attribute :resharding, + type: 'Array', + json_key: 'resharding', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry_enum.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry_enum.rb new file mode 100644 index 000000000000..4a540569d79b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collection_telemetry_enum.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module CollectionTelemetryEnum + CANDIDATES = [ + 'CollectionTelemetry', + 'CollectionsAggregatedTelemetry', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aggregated_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aggregated_telemetry.rb new file mode 100644 index 000000000000..01b1d3541f14 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aggregated_telemetry.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionsAggregatedTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :vectors, + type: 'Integer', + json_key: 'vectors', + required: true, + minimum: 0 + + attribute :optimizers_status, + type: 'OptimizersStatus', + json_key: 'optimizers_status', + required: true + + attribute :params, + type: 'CollectionParams', + json_key: 'params', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aliases_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aliases_response.rb new file mode 100644 index 000000000000..424888e7e111 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_aliases_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionsAliasesResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :aliases, + type: 'Array', + json_key: 'aliases', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_response.rb new file mode 100644 index 000000000000..b7bdc6c8d5a8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionsResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :collections, + type: 'Array', + json_key: 'collections', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_telemetry.rb new file mode 100644 index 000000000000..ae495b0855d5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/collections_telemetry.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CollectionsTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :number_of_collections, + type: 'Integer', + json_key: 'number_of_collections', + required: true, + minimum: 0 + + attribute :collections, + type: 'Array', + json_key: 'collections', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/compression_ratio.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/compression_ratio.rb new file mode 100644 index 000000000000..e4393b2608c7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/compression_ratio.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module CompressionRatio + X4 = 'x4' + X8 = 'x8' + X16 = 'x16' + X32 = 'x32' + X64 = 'x64' + + def self.all + @all ||= [ + X4, + X8, + X16, + X32, + X64, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/condition.rb new file mode 100644 index 000000000000..c0f626efe8eb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/condition.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module Condition + CANDIDATES = [ + 'FieldCondition', + 'Filter', + 'HasIdCondition', + 'IsEmptyCondition', + 'IsNullCondition', + 'NestedCondition', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_config_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_config_telemetry.rb new file mode 100644 index 000000000000..76b63fee15d7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_config_telemetry.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ConsensusConfigTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :max_message_queue_size, + type: 'Integer', + json_key: 'max_message_queue_size', + required: true, + minimum: 0 + + attribute :tick_period_ms, + type: 'Integer', + json_key: 'tick_period_ms', + required: true, + minimum: 0 + + attribute :bootstrap_timeout_sec, + type: 'Integer', + json_key: 'bootstrap_timeout_sec', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status.rb new file mode 100644 index 000000000000..4474138fd550 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module ConsensusThreadStatus + CANDIDATES = [ + 'ConsensusThreadStatusOneOf', + 'ConsensusThreadStatusOneOf1', + 'ConsensusThreadStatusOneOf2', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of.rb new file mode 100644 index 000000000000..8bfa9e2285e7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ConsensusThreadStatusOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :consensus_thread_status, + type: 'String', + json_key: 'consensus_thread_status', + required: true, + enum: ['working'] + + attribute :last_update, + type: 'Time', + json_key: 'last_update', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of1.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of1.rb new file mode 100644 index 000000000000..12dc8363bc3d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of1.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ConsensusThreadStatusOneOf1 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :consensus_thread_status, + type: 'String', + json_key: 'consensus_thread_status', + required: true, + enum: ['stopped'] + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of2.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of2.rb new file mode 100644 index 000000000000..7d71223bf639 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/consensus_thread_status_one_of2.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ConsensusThreadStatusOneOf2 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :consensus_thread_status, + type: 'String', + json_key: 'consensus_thread_status', + required: true, + enum: ['stopped_with_err'] + + attribute :err, + type: 'String', + json_key: 'err', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_example_pair.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_example_pair.rb new file mode 100644 index 000000000000..4b0901be9980 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_example_pair.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ContextExamplePair + include Qdrant::Serializable + include Qdrant::Validations + + attribute :positive, + type: 'RecommendExample', + json_key: 'positive', + required: true + + attribute :negative, + type: 'RecommendExample', + json_key: 'negative', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_input.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_input.rb new file mode 100644 index 000000000000..f278a9c66a77 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_input.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ContextInput + CANDIDATES = [ + 'Array', + 'ContextPair', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_pair.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_pair.rb new file mode 100644 index 000000000000..dafc8d418904 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_pair.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ContextPair + include Qdrant::Serializable + include Qdrant::Validations + + attribute :positive, + type: 'VectorInput', + json_key: 'positive', + required: true + + attribute :negative, + type: 'VectorInput', + json_key: 'negative', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_query.rb new file mode 100644 index 000000000000..eb8d3f5cbfc9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/context_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ContextQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :context, + type: 'ContextInput', + json_key: 'context', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_points200_response.rb new file mode 100644 index 000000000000..f002a41a8629 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CountPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CountResult', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_request.rb new file mode 100644 index 000000000000..93ad969c4190 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_request.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CountRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :exact, + type: 'Boolean', + json_key: 'exact', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @exact = true if @exact.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_result.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_result.rb new file mode 100644 index 000000000000..e45299e38ded --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/count_result.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CountResult + include Qdrant::Serializable + include Qdrant::Validations + + attribute :count, + type: 'Integer', + json_key: 'count', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias.rb new file mode 100644 index 000000000000..e1e3d01d22f9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateAlias + include Qdrant::Serializable + include Qdrant::Validations + + attribute :collection_name, + type: 'String', + json_key: 'collection_name', + required: true + + attribute :alias_name, + type: 'String', + json_key: 'alias_name', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias_operation.rb new file mode 100644 index 000000000000..706d9a316c0c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_alias_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateAliasOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :create_alias, + type: 'CreateAlias', + json_key: 'create_alias', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_collection.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_collection.rb new file mode 100644 index 000000000000..c773ba04ccd5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_collection.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateCollection + include Qdrant::Serializable + include Qdrant::Validations + + attribute :vectors, + type: 'VectorsConfig', + json_key: 'vectors', + required: false + + attribute :shard_number, + type: 'Integer', + json_key: 'shard_number', + required: false, + minimum: 1 + + attribute :sharding_method, + type: 'ShardingMethod', + json_key: 'sharding_method', + required: false + + attribute :replication_factor, + type: 'Integer', + json_key: 'replication_factor', + required: false, + minimum: 1 + + attribute :write_consistency_factor, + type: 'Integer', + json_key: 'write_consistency_factor', + required: false, + minimum: 1 + + attribute :on_disk_payload, + type: 'Boolean', + json_key: 'on_disk_payload', + required: false + + attribute :hnsw_config, + type: 'HnswConfigDiff', + json_key: 'hnsw_config', + required: false + + attribute :wal_config, + type: 'WalConfigDiff', + json_key: 'wal_config', + required: false + + attribute :optimizers_config, + type: 'OptimizersConfigDiff', + json_key: 'optimizers_config', + required: false + + attribute :init_from, + type: 'InitFrom', + json_key: 'init_from', + required: false + + attribute :quantization_config, + type: 'QuantizationConfig', + json_key: 'quantization_config', + required: false + + attribute :sparse_vectors, + type: 'Hash', + json_key: 'sparse_vectors', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index.rb new file mode 100644 index 000000000000..9dd3318fa79a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateFieldIndex + include Qdrant::Serializable + include Qdrant::Validations + + attribute :field_name, + type: 'String', + json_key: 'field_name', + required: true + + attribute :field_schema, + type: 'PayloadFieldSchema', + json_key: 'field_schema', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index200_response.rb new file mode 100644 index 000000000000..3be1bf3aa30d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_field_index200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateFieldIndex200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'UpdateResult', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_shard_key200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_shard_key200_response.rb new file mode 100644 index 000000000000..0a00d307ed74 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_shard_key200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateShardKey200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Boolean', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key.rb new file mode 100644 index 000000000000..99b410892f1e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateShardingKey + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: true + + attribute :shards_number, + type: 'Integer', + json_key: 'shards_number', + required: false, + minimum: 1 + + attribute :replication_factor, + type: 'Integer', + json_key: 'replication_factor', + required: false, + minimum: 1 + + attribute :placement, + type: 'Array', + json_key: 'placement', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key_operation.rb new file mode 100644 index 000000000000..3a0675381783 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_sharding_key_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateShardingKeyOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :create_sharding_key, + type: 'CreateShardingKey', + json_key: 'create_sharding_key', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_snapshot200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_snapshot200_response.rb new file mode 100644 index 000000000000..f3d7a4769693 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/create_snapshot200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class CreateSnapshot200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'SnapshotDescription', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datatype.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datatype.rb new file mode 100644 index 000000000000..8a98435d2411 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datatype.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Datatype + FLOAT32 = 'float32' + UINT8 = 'uint8' + FLOAT16 = 'float16' + + def self.all + @all ||= [ + FLOAT32, + UINT8, + FLOAT16, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_params.rb new file mode 100644 index 000000000000..c997424ed3ff --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DatetimeIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'DatetimeIndexType', + json_key: 'type', + required: true + + attribute :is_principal, + type: 'Boolean', + json_key: 'is_principal', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_type.rb new file mode 100644 index 000000000000..64254810b0b2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module DatetimeIndexType + DATETIME = 'datetime' + + def self.all + @all ||= [ + DATETIME, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_range.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_range.rb new file mode 100644 index 000000000000..67ec1788ba4c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/datetime_range.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DatetimeRange + include Qdrant::Serializable + include Qdrant::Validations + + attribute :lt, + type: 'Time', + json_key: 'lt', + required: false + + attribute :gt, + type: 'Time', + json_key: 'gt', + required: false + + attribute :gte, + type: 'Time', + json_key: 'gte', + required: false + + attribute :lte, + type: 'Time', + json_key: 'lte', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias.rb new file mode 100644 index 000000000000..5d73ff1ac775 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeleteAlias + include Qdrant::Serializable + include Qdrant::Validations + + attribute :alias_name, + type: 'String', + json_key: 'alias_name', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias_operation.rb new file mode 100644 index 000000000000..0984213bd3a2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_alias_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeleteAliasOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :delete_alias, + type: 'DeleteAlias', + json_key: 'delete_alias', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_operation.rb new file mode 100644 index 000000000000..62fff7eca6df --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeleteOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :delete, + type: 'PointsSelector', + json_key: 'delete', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload.rb new file mode 100644 index 000000000000..6f5f17c3ffdd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeletePayload + include Qdrant::Serializable + include Qdrant::Validations + + attribute :keys, + type: 'Array', + json_key: 'keys', + required: true + + attribute :points, + type: 'Array', + json_key: 'points', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload_operation.rb new file mode 100644 index 000000000000..79f3a3f36e5f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_payload_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeletePayloadOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :delete_payload, + type: 'DeletePayload', + json_key: 'delete_payload', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors.rb new file mode 100644 index 000000000000..4a910bf6ab7d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeleteVectors + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :vector, + type: 'Array', + json_key: 'vector', + required: true, + min_items: 1 + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors_operation.rb new file mode 100644 index 000000000000..30e6898a59e2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/delete_vectors_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DeleteVectorsOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :delete_vectors, + type: 'DeleteVectors', + json_key: 'delete_vectors', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/direction.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/direction.rb new file mode 100644 index 000000000000..59bfff9c173e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/direction.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Direction + ASC = 'asc' + DESC = 'desc' + + def self.all + @all ||= [ + ASC, + DESC, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/disabled.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/disabled.rb new file mode 100644 index 000000000000..b6dff598a4b6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/disabled.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Disabled + DISABLED = 'Disabled' + + def self.all + @all ||= [ + DISABLED, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input.rb new file mode 100644 index 000000000000..004fff09aa74 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DiscoverInput + include Qdrant::Serializable + include Qdrant::Validations + + attribute :target, + type: 'VectorInput', + json_key: 'target', + required: true + + attribute :context, + type: 'DiscoverInputContext', + json_key: 'context', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input_context.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input_context.rb new file mode 100644 index 000000000000..eb6c3eb12782 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_input_context.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module DiscoverInputContext + CANDIDATES = [ + 'Array', + 'ContextPair', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_query.rb new file mode 100644 index 000000000000..b4938dde6d98 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DiscoverQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :discover, + type: 'DiscoverInput', + json_key: 'discover', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request.rb new file mode 100644 index 000000000000..5450380fd020 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DiscoverRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :target, + type: 'RecommendExample', + json_key: 'target', + required: false + + attribute :context, + type: 'Array', + json_key: 'context', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: true, + minimum: 1 + + attribute :offset, + type: 'Integer', + json_key: 'offset', + required: false, + minimum: 0 + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request_batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request_batch.rb new file mode 100644 index 000000000000..27c77d19e3f6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/discover_request_batch.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DiscoverRequestBatch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :searches, + type: 'Array', + json_key: 'searches', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/distance.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/distance.rb new file mode 100644 index 000000000000..98b16c5262bf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/distance.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Distance + COSINE = 'Cosine' + EUCLID = 'Euclid' + DOT = 'Dot' + MANHATTAN = 'Manhattan' + + def self.all + @all ||= [ + COSINE, + EUCLID, + DOT, + MANHATTAN, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/document.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/document.rb new file mode 100644 index 000000000000..5f59ee39b9df --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/document.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Document + include Qdrant::Serializable + include Qdrant::Validations + + attribute :text, + type: 'String', + json_key: 'text', + required: true + + attribute :model, + type: 'String', + json_key: 'model', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_replica_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_replica_operation.rb new file mode 100644 index 000000000000..ad501089428a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_replica_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DropReplicaOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :drop_replica, + type: 'Replica', + json_key: 'drop_replica', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key.rb new file mode 100644 index 000000000000..aedc97ba443b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DropShardingKey + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key_operation.rb new file mode 100644 index 000000000000..a7f6f893b6b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/drop_sharding_key_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class DropShardingKeyOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :drop_sharding_key, + type: 'DropShardingKey', + json_key: 'drop_sharding_key', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response.rb new file mode 100644 index 000000000000..386b45e71838 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ErrorResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'ErrorResponseStatus', + json_key: 'status', + required: false + + attribute :result, + type: 'Object', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response_status.rb new file mode 100644 index 000000000000..5f09af751a36 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/error_response_status.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ErrorResponseStatus + include Qdrant::Serializable + include Qdrant::Validations + + attribute :error, + type: 'String', + json_key: 'error', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/extended_point_id.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/extended_point_id.rb new file mode 100644 index 000000000000..86b2db54d277 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/extended_point_id.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ExtendedPointId + CANDIDATES = [ + 'Integer', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet200_response.rb new file mode 100644 index 000000000000..62cffca28d85 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Facet200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'FacetResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_request.rb new file mode 100644 index 000000000000..c68c0259758c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_request.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FacetRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :key, + type: 'String', + json_key: 'key', + required: true + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :exact, + type: 'Boolean', + json_key: 'exact', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_response.rb new file mode 100644 index 000000000000..aa875632df8c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FacetResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :hits, + type: 'Array', + json_key: 'hits', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value.rb new file mode 100644 index 000000000000..4921f9b26816 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module FacetValue + CANDIDATES = [ + 'Boolean', + 'Integer', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value_hit.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value_hit.rb new file mode 100644 index 000000000000..d0e740e97101 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/facet_value_hit.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FacetValueHit + include Qdrant::Serializable + include Qdrant::Validations + + attribute :value, + type: 'FacetValue', + json_key: 'value', + required: true + + attribute :count, + type: 'Integer', + json_key: 'count', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/field_condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/field_condition.rb new file mode 100644 index 000000000000..1311dc1b7de5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/field_condition.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FieldCondition + include Qdrant::Serializable + include Qdrant::Validations + + attribute :key, + type: 'String', + json_key: 'key', + required: true + + attribute :match, + type: 'Match', + json_key: 'match', + required: false + + attribute :range, + type: 'RangeInterface', + json_key: 'range', + required: false + + attribute :geo_bounding_box, + type: 'GeoBoundingBox', + json_key: 'geo_bounding_box', + required: false + + attribute :geo_radius, + type: 'GeoRadius', + json_key: 'geo_radius', + required: false + + attribute :geo_polygon, + type: 'GeoPolygon', + json_key: 'geo_polygon', + required: false + + attribute :values_count, + type: 'ValuesCount', + json_key: 'values_count', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter.rb new file mode 100644 index 000000000000..6634af61df5e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Filter + include Qdrant::Serializable + include Qdrant::Validations + + attribute :should, + type: 'FilterShould', + json_key: 'should', + required: false + + attribute :min_should, + type: 'MinShould', + json_key: 'min_should', + required: false + + attribute :must, + type: 'FilterMust', + json_key: 'must', + required: false + + attribute :must_not, + type: 'FilterMustNot', + json_key: 'must_not', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must.rb new file mode 100644 index 000000000000..6f7b21a951d9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module FilterMust + CANDIDATES = [ + 'Array', + 'Condition', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must_not.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must_not.rb new file mode 100644 index 000000000000..cb17e1557002 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_must_not.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module FilterMustNot + CANDIDATES = [ + 'Array', + 'Condition', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_selector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_selector.rb new file mode 100644 index 000000000000..19200eec2488 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_selector.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FilterSelector + include Qdrant::Serializable + include Qdrant::Validations + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: true + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_should.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_should.rb new file mode 100644 index 000000000000..0da01b8258b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/filter_should.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module FilterShould + CANDIDATES = [ + 'Array', + 'Condition', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_params.rb new file mode 100644 index 000000000000..2152dc33bbb2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FloatIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'FloatIndexType', + json_key: 'type', + required: true + + attribute :is_principal, + type: 'Boolean', + json_key: 'is_principal', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_type.rb new file mode 100644 index 000000000000..666be58001fc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/float_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module FloatIndexType + FLOAT = 'float' + + def self.all + @all ||= [ + FLOAT, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion.rb new file mode 100644 index 000000000000..1ee930a1f4ac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Fusion + RRF = 'rrf' + DBSF = 'dbsf' + + def self.all + @all ||= [ + RRF, + DBSF, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion_query.rb new file mode 100644 index 000000000000..93bf4110348b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/fusion_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class FusionQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :fusion, + type: 'Fusion', + json_key: 'fusion', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_bounding_box.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_bounding_box.rb new file mode 100644 index 000000000000..967efca24c03 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_bounding_box.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoBoundingBox + include Qdrant::Serializable + include Qdrant::Validations + + attribute :top_left, + type: 'GeoPoint', + json_key: 'top_left', + required: true + + attribute :bottom_right, + type: 'GeoPoint', + json_key: 'bottom_right', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_params.rb new file mode 100644 index 000000000000..cc9b3d4a091f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'GeoIndexType', + json_key: 'type', + required: true + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_type.rb new file mode 100644 index 000000000000..43051f794fe6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module GeoIndexType + GEO = 'geo' + + def self.all + @all ||= [ + GEO, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_line_string.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_line_string.rb new file mode 100644 index 000000000000..022c3acf62e4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_line_string.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoLineString + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_point.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_point.rb new file mode 100644 index 000000000000..1feaeb39d281 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_point.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoPoint + include Qdrant::Serializable + include Qdrant::Validations + + attribute :lon, + type: 'Float', + json_key: 'lon', + required: true + + attribute :lat, + type: 'Float', + json_key: 'lat', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_polygon.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_polygon.rb new file mode 100644 index 000000000000..3135cf65fe3c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_polygon.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoPolygon + include Qdrant::Serializable + include Qdrant::Validations + + attribute :exterior, + type: 'GeoLineString', + json_key: 'exterior', + required: true + + attribute :interiors, + type: 'Array', + json_key: 'interiors', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_radius.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_radius.rb new file mode 100644 index 000000000000..492207bf5be3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/geo_radius.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GeoRadius + include Qdrant::Serializable + include Qdrant::Validations + + attribute :center, + type: 'GeoPoint', + json_key: 'center', + required: true + + attribute :radius, + type: 'Float', + json_key: 'radius', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection200_response.rb new file mode 100644 index 000000000000..f70aa0dec671 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetCollection200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CollectionInfo', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection_aliases200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection_aliases200_response.rb new file mode 100644 index 000000000000..2e1ff3a2894d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collection_aliases200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetCollectionAliases200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CollectionsAliasesResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collections200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collections200_response.rb new file mode 100644 index 000000000000..799afa8a1536 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_collections200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetCollections200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'CollectionsResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_locks200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_locks200_response.rb new file mode 100644 index 000000000000..efdf8329f650 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_locks200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetLocks200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'LocksOption', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_point200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_point200_response.rb new file mode 100644 index 000000000000..9a0464035bb5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_point200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetPoint200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Record', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_points200_response.rb new file mode 100644 index 000000000000..89e1e5f32b22 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/get_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GetPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/group_id.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/group_id.rb new file mode 100644 index 000000000000..2dce66c76aa1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/group_id.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module GroupId + CANDIDATES = [ + 'Integer', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/groups_result.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/groups_result.rb new file mode 100644 index 000000000000..48d815313508 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/groups_result.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GroupsResult + include Qdrant::Serializable + include Qdrant::Validations + + attribute :groups, + type: 'Array', + json_key: 'groups', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/grpc_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/grpc_telemetry.rb new file mode 100644 index 000000000000..f4bfdb024ab6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/grpc_telemetry.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class GrpcTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :responses, + type: 'Hash', + json_key: 'responses', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/has_id_condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/has_id_condition.rb new file mode 100644 index 000000000000..a0cfdc3c42b6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/has_id_condition.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class HasIdCondition + include Qdrant::Serializable + include Qdrant::Validations + + attribute :has_id, + type: 'Array', + json_key: 'has_id', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config.rb new file mode 100644 index 000000000000..2bc4188d7014 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class HnswConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :m, + type: 'Integer', + json_key: 'm', + required: true, + minimum: 0 + + attribute :ef_construct, + type: 'Integer', + json_key: 'ef_construct', + required: true, + minimum: 4 + + attribute :full_scan_threshold, + type: 'Integer', + json_key: 'full_scan_threshold', + required: true, + minimum: 0 + + attribute :max_indexing_threads, + type: 'Integer', + json_key: 'max_indexing_threads', + required: false, + minimum: 0 + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + attribute :payload_m, + type: 'Integer', + json_key: 'payload_m', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @max_indexing_threads = 0 if @max_indexing_threads.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config_diff.rb new file mode 100644 index 000000000000..4b3ba2090055 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/hnsw_config_diff.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class HnswConfigDiff + include Qdrant::Serializable + include Qdrant::Validations + + attribute :m, + type: 'Integer', + json_key: 'm', + required: false, + minimum: 0 + + attribute :ef_construct, + type: 'Integer', + json_key: 'ef_construct', + required: false, + minimum: 4 + + attribute :full_scan_threshold, + type: 'Integer', + json_key: 'full_scan_threshold', + required: false, + minimum: 10 + + attribute :max_indexing_threads, + type: 'Integer', + json_key: 'max_indexing_threads', + required: false, + minimum: 0 + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + attribute :payload_m, + type: 'Integer', + json_key: 'payload_m', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes.rb new file mode 100644 index 000000000000..fe6f8c72ee39 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module Indexes + CANDIDATES = [ + 'IndexesOneOf', + 'IndexesOneOf1', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of.rb new file mode 100644 index 000000000000..00d78f250818 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class IndexesOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'String', + json_key: 'type', + required: true, + enum: ['plain'] + + attribute :options, + type: 'Object', + json_key: 'options', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of1.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of1.rb new file mode 100644 index 000000000000..bc7b232518d2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/indexes_one_of1.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class IndexesOneOf1 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'String', + json_key: 'type', + required: true, + enum: ['hnsw'] + + attribute :options, + type: 'HnswConfig', + json_key: 'options', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/init_from.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/init_from.rb new file mode 100644 index 000000000000..ae1bc419b4d4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/init_from.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class InitFrom + include Qdrant::Serializable + include Qdrant::Validations + + attribute :collection, + type: 'String', + json_key: 'collection', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_params.rb new file mode 100644 index 000000000000..7d91528ff7d1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_params.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class IntegerIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'IntegerIndexType', + json_key: 'type', + required: true + + attribute :lookup, + type: 'Boolean', + json_key: 'lookup', + required: false + + attribute :range, + type: 'Boolean', + json_key: 'range', + required: false + + attribute :is_principal, + type: 'Boolean', + json_key: 'is_principal', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_type.rb new file mode 100644 index 000000000000..4ff93a873c94 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/integer_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module IntegerIndexType + INTEGER = 'integer' + + def self.all + @all ||= [ + INTEGER, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_empty_condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_empty_condition.rb new file mode 100644 index 000000000000..ac38232cd23c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_empty_condition.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class IsEmptyCondition + include Qdrant::Serializable + include Qdrant::Validations + + attribute :is_empty, + type: 'PayloadField', + json_key: 'is_empty', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_null_condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_null_condition.rb new file mode 100644 index 000000000000..369d8beb4f5c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/is_null_condition.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class IsNullCondition + include Qdrant::Serializable + include Qdrant::Validations + + attribute :is_null, + type: 'PayloadField', + json_key: 'is_null', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_params.rb new file mode 100644 index 000000000000..2ab59cd66799 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class KeywordIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'KeywordIndexType', + json_key: 'type', + required: true + + attribute :is_tenant, + type: 'Boolean', + json_key: 'is_tenant', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_type.rb new file mode 100644 index 000000000000..61f905154396 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/keyword_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module KeywordIndexType + KEYWORD = 'keyword' + + def self.all + @all ||= [ + KEYWORD, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/list_snapshots200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/list_snapshots200_response.rb new file mode 100644 index 000000000000..5b7efb908081 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/list_snapshots200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ListSnapshots200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_info.rb new file mode 100644 index 000000000000..7ea354dfed0f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_info.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class LocalShardInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: false + + attribute :points_count, + type: 'Integer', + json_key: 'points_count', + required: true, + minimum: 0 + + attribute :state, + type: 'ReplicaState', + json_key: 'state', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_telemetry.rb new file mode 100644 index 000000000000..e418e3a8ac79 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/local_shard_telemetry.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class LocalShardTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :variant_name, + type: 'String', + json_key: 'variant_name', + required: false + + attribute :status, + type: 'ShardStatus', + json_key: 'status', + required: false + + attribute :total_optimized_points, + type: 'Integer', + json_key: 'total_optimized_points', + required: true, + minimum: 0 + + attribute :segments, + type: 'Array', + json_key: 'segments', + required: true + + attribute :optimizations, + type: 'OptimizerTelemetry', + json_key: 'optimizations', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/locks_option.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/locks_option.rb new file mode 100644 index 000000000000..ddc1841e11b7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/locks_option.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class LocksOption + include Qdrant::Serializable + include Qdrant::Validations + + attribute :error_message, + type: 'String', + json_key: 'error_message', + required: false + + attribute :write, + type: 'Boolean', + json_key: 'write', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/lookup_location.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/lookup_location.rb new file mode 100644 index 000000000000..38f8aec3647f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/lookup_location.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class LookupLocation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :collection, + type: 'String', + json_key: 'collection', + required: true + + attribute :vector, + type: 'String', + json_key: 'vector', + required: false + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match.rb new file mode 100644 index 000000000000..a429b1f04c87 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module Match + CANDIDATES = [ + 'MatchAny', + 'MatchExcept', + 'MatchText', + 'MatchValue', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_any.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_any.rb new file mode 100644 index 000000000000..e1758ae6f5e0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_any.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MatchAny + include Qdrant::Serializable + include Qdrant::Validations + + attribute :any, + type: 'AnyVariants', + json_key: 'any', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_except.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_except.rb new file mode 100644 index 000000000000..a90e6948ec35 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_except.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MatchExcept + include Qdrant::Serializable + include Qdrant::Validations + + attribute :except, + type: 'AnyVariants', + json_key: 'except', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_text.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_text.rb new file mode 100644 index 000000000000..f1611b5907b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_text.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MatchText + include Qdrant::Serializable + include Qdrant::Validations + + attribute :text, + type: 'String', + json_key: 'text', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_value.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_value.rb new file mode 100644 index 000000000000..9c7d9110b07e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/match_value.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MatchValue + include Qdrant::Serializable + include Qdrant::Validations + + attribute :value, + type: 'ValueVariants', + json_key: 'value', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/message_send_errors.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/message_send_errors.rb new file mode 100644 index 000000000000..4f5c60000c1d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/message_send_errors.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MessageSendErrors + include Qdrant::Serializable + include Qdrant::Validations + + attribute :count, + type: 'Integer', + json_key: 'count', + required: true, + minimum: 0 + + attribute :latest_error, + type: 'String', + json_key: 'latest_error', + required: false + + attribute :latest_error_timestamp, + type: 'Time', + json_key: 'latest_error_timestamp', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/min_should.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/min_should.rb new file mode 100644 index 000000000000..e0802012de8a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/min_should.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MinShould + include Qdrant::Serializable + include Qdrant::Validations + + attribute :conditions, + type: 'Array', + json_key: 'conditions', + required: true + + attribute :min_count, + type: 'Integer', + json_key: 'min_count', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/modifier.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/modifier.rb new file mode 100644 index 000000000000..c7a18a4f5573 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/modifier.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Modifier + NONE = 'none' + IDF = 'idf' + + def self.all + @all ||= [ + NONE, + IDF, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard.rb new file mode 100644 index 000000000000..c5805d3c11ff --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MoveShard + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :to_peer_id, + type: 'Integer', + json_key: 'to_peer_id', + required: true, + minimum: 0 + + attribute :from_peer_id, + type: 'Integer', + json_key: 'from_peer_id', + required: true, + minimum: 0 + + attribute :method, + type: 'ShardTransferMethod', + json_key: 'method', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard_operation.rb new file mode 100644 index 000000000000..56327071ea9b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/move_shard_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MoveShardOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :move_shard, + type: 'MoveShard', + json_key: 'move_shard', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_comparator.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_comparator.rb new file mode 100644 index 000000000000..a1a4b5493e5b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_comparator.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module MultiVectorComparator + MAX_SIM = 'max_sim' + + def self.all + @all ||= [ + MAX_SIM, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_config.rb new file mode 100644 index 000000000000..127098f57097 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/multi_vector_config.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class MultiVectorConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :comparator, + type: 'MultiVectorComparator', + json_key: 'comparator', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_sparse_vector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_sparse_vector.rb new file mode 100644 index 000000000000..fd904763d594 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_sparse_vector.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class NamedSparseVector + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :vector, + type: 'SparseVector', + json_key: 'vector', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector.rb new file mode 100644 index 000000000000..5ba283d22dc1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class NamedVector + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :vector, + type: 'Array', + json_key: 'vector', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector_struct.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector_struct.rb new file mode 100644 index 000000000000..9f392e5203e6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/named_vector_struct.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module NamedVectorStruct + CANDIDATES = [ + 'Array', + 'NamedSparseVector', + 'NamedVector', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nearest_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nearest_query.rb new file mode 100644 index 000000000000..cb4362102459 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nearest_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class NearestQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :nearest, + type: 'VectorInput', + json_key: 'nearest', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested.rb new file mode 100644 index 000000000000..a35404f8295d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Nested + include Qdrant::Serializable + include Qdrant::Validations + + attribute :key, + type: 'String', + json_key: 'key', + required: true + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested_condition.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested_condition.rb new file mode 100644 index 000000000000..f1263ef64327 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/nested_condition.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class NestedCondition + include Qdrant::Serializable + include Qdrant::Validations + + attribute :nested, + type: 'Nested', + json_key: 'nested', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/operation_duration_statistics.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/operation_duration_statistics.rb new file mode 100644 index 000000000000..6c8769fa1b47 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/operation_duration_statistics.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OperationDurationStatistics + include Qdrant::Serializable + include Qdrant::Validations + + attribute :count, + type: 'Integer', + json_key: 'count', + required: true, + minimum: 0 + + attribute :fail_count, + type: 'Integer', + json_key: 'fail_count', + required: false, + minimum: 0 + + attribute :avg_duration_micros, + type: 'Float', + json_key: 'avg_duration_micros', + required: false + + attribute :min_duration_micros, + type: 'Float', + json_key: 'min_duration_micros', + required: false + + attribute :max_duration_micros, + type: 'Float', + json_key: 'max_duration_micros', + required: false + + attribute :total_duration_micros, + type: 'Integer', + json_key: 'total_duration_micros', + required: true, + minimum: 0 + + attribute :last_responded, + type: 'Time', + json_key: 'last_responded', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizer_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizer_telemetry.rb new file mode 100644 index 000000000000..adbb848e2d59 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizer_telemetry.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OptimizerTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :status, + type: 'OptimizersStatus', + json_key: 'status', + required: true + + attribute :optimizations, + type: 'OperationDurationStatistics', + json_key: 'optimizations', + required: true + + attribute :log, + type: 'Array', + json_key: 'log', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config.rb new file mode 100644 index 000000000000..3c44140fc12f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OptimizersConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :deleted_threshold, + type: 'Float', + json_key: 'deleted_threshold', + required: true, + maximum: 1, + minimum: 0 + + attribute :vacuum_min_vector_number, + type: 'Integer', + json_key: 'vacuum_min_vector_number', + required: true, + minimum: 100 + + attribute :default_segment_number, + type: 'Integer', + json_key: 'default_segment_number', + required: true, + minimum: 0 + + attribute :max_segment_size, + type: 'Integer', + json_key: 'max_segment_size', + required: false, + minimum: 0 + + attribute :memmap_threshold, + type: 'Integer', + json_key: 'memmap_threshold', + required: false, + minimum: 0 + + attribute :indexing_threshold, + type: 'Integer', + json_key: 'indexing_threshold', + required: false, + minimum: 0 + + attribute :flush_interval_sec, + type: 'Integer', + json_key: 'flush_interval_sec', + required: true, + minimum: 0 + + attribute :max_optimization_threads, + type: 'Integer', + json_key: 'max_optimization_threads', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config_diff.rb new file mode 100644 index 000000000000..389a1beefc99 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_config_diff.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OptimizersConfigDiff + include Qdrant::Serializable + include Qdrant::Validations + + attribute :deleted_threshold, + type: 'Float', + json_key: 'deleted_threshold', + required: false + + attribute :vacuum_min_vector_number, + type: 'Integer', + json_key: 'vacuum_min_vector_number', + required: false, + minimum: 0 + + attribute :default_segment_number, + type: 'Integer', + json_key: 'default_segment_number', + required: false, + minimum: 0 + + attribute :max_segment_size, + type: 'Integer', + json_key: 'max_segment_size', + required: false, + minimum: 0 + + attribute :memmap_threshold, + type: 'Integer', + json_key: 'memmap_threshold', + required: false, + minimum: 0 + + attribute :indexing_threshold, + type: 'Integer', + json_key: 'indexing_threshold', + required: false, + minimum: 0 + + attribute :flush_interval_sec, + type: 'Integer', + json_key: 'flush_interval_sec', + required: false, + minimum: 0 + + attribute :max_optimization_threads, + type: 'Integer', + json_key: 'max_optimization_threads', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status.rb new file mode 100644 index 000000000000..0f3e7f1a2597 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module OptimizersStatus + CANDIDATES = [ + 'OptimizersStatusOneOf', + 'String', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status_one_of.rb new file mode 100644 index 000000000000..0bcdefb8d38f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/optimizers_status_one_of.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OptimizersStatusOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :error, + type: 'String', + json_key: 'error', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by.rb new file mode 100644 index 000000000000..2a3e92d4bfcc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OrderBy + include Qdrant::Serializable + include Qdrant::Validations + + attribute :key, + type: 'String', + json_key: 'key', + required: true + + attribute :direction, + type: 'Direction', + json_key: 'direction', + required: false + + attribute :start_from, + type: 'StartFrom', + json_key: 'start_from', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_interface.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_interface.rb new file mode 100644 index 000000000000..3ea81308d6fd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_interface.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module OrderByInterface + CANDIDATES = [ + 'OrderBy', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_query.rb new file mode 100644 index 000000000000..fcfd900a8a18 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_by_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OrderByQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :order_by, + type: 'OrderByInterface', + json_key: 'order_by', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_value.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_value.rb new file mode 100644 index 000000000000..7c4bdfa9de41 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/order_value.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module OrderValue + CANDIDATES = [ + 'Float', + 'Integer', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/overwrite_payload_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/overwrite_payload_operation.rb new file mode 100644 index 000000000000..41c534deee81 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/overwrite_payload_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class OverwritePayloadOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :overwrite_payload, + type: 'SetPayload', + json_key: 'overwrite_payload', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/p2p_config_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/p2p_config_telemetry.rb new file mode 100644 index 000000000000..f4e39059fac9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/p2p_config_telemetry.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class P2pConfigTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :connection_pool_size, + type: 'Integer', + json_key: 'connection_pool_size', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field.rb new file mode 100644 index 000000000000..1c766d989714 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadField + include Qdrant::Serializable + include Qdrant::Validations + + attribute :key, + type: 'String', + json_key: 'key', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field_schema.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field_schema.rb new file mode 100644 index 000000000000..aa785ad72356 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_field_schema.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PayloadFieldSchema + CANDIDATES = [ + 'PayloadSchemaParams', + 'PayloadSchemaType', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_info.rb new file mode 100644 index 000000000000..65773b51ca96 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_info.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadIndexInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :data_type, + type: 'PayloadSchemaType', + json_key: 'data_type', + required: true + + attribute :params, + type: 'PayloadSchemaParams', + json_key: 'params', + required: false + + attribute :points, + type: 'Integer', + json_key: 'points', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_telemetry.rb new file mode 100644 index 000000000000..0c94d80d4d03 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_index_telemetry.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadIndexTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :field_name, + type: 'String', + json_key: 'field_name', + required: false + + attribute :points_values_count, + type: 'Integer', + json_key: 'points_values_count', + required: true, + minimum: 0 + + attribute :points_count, + type: 'Integer', + json_key: 'points_count', + required: true, + minimum: 0 + + attribute :histogram_bucket_size, + type: 'Integer', + json_key: 'histogram_bucket_size', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_params.rb new file mode 100644 index 000000000000..c14ceda04db3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_params.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PayloadSchemaParams + CANDIDATES = [ + 'BoolIndexParams', + 'DatetimeIndexParams', + 'FloatIndexParams', + 'GeoIndexParams', + 'IntegerIndexParams', + 'KeywordIndexParams', + 'TextIndexParams', + 'UuidIndexParams', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_type.rb new file mode 100644 index 000000000000..55af3d95c6cd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_schema_type.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module PayloadSchemaType + KEYWORD = 'keyword' + INTEGER = 'integer' + FLOAT = 'float' + GEO = 'geo' + TEXT = 'text' + BOOL = 'bool' + DATETIME = 'datetime' + UUID = 'uuid' + + def self.all + @all ||= [ + KEYWORD, + INTEGER, + FLOAT, + GEO, + TEXT, + BOOL, + DATETIME, + UUID, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector.rb new file mode 100644 index 000000000000..dd7eef113c9b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PayloadSelector + CANDIDATES = [ + 'PayloadSelectorExclude', + 'PayloadSelectorInclude', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_exclude.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_exclude.rb new file mode 100644 index 000000000000..7b3542f13005 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_exclude.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadSelectorExclude + include Qdrant::Serializable + include Qdrant::Validations + + attribute :exclude, + type: 'Array', + json_key: 'exclude', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_include.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_include.rb new file mode 100644 index 000000000000..b4df8c413c9f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_selector_include.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadSelectorInclude + include Qdrant::Serializable + include Qdrant::Validations + + attribute :include, + type: 'Array', + json_key: 'include', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type.rb new file mode 100644 index 000000000000..3c6ee18ba298 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module PayloadStorageType + CANDIDATES = [ + 'PayloadStorageTypeOneOf', + 'PayloadStorageTypeOneOf1', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of.rb new file mode 100644 index 000000000000..dad21b1be539 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadStorageTypeOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'String', + json_key: 'type', + required: true, + enum: ['in_memory'] + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of1.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of1.rb new file mode 100644 index 000000000000..a47c616546db --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/payload_storage_type_one_of1.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PayloadStorageTypeOneOf1 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'String', + json_key: 'type', + required: true, + enum: ['on_disk'] + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/peer_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/peer_info.rb new file mode 100644 index 000000000000..891089fe113a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/peer_info.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PeerInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :uri, + type: 'String', + json_key: 'uri', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_group.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_group.rb new file mode 100644 index 000000000000..7aa83537e5a6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_group.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointGroup + include Qdrant::Serializable + include Qdrant::Validations + + attribute :hits, + type: 'Array', + json_key: 'hits', + required: true + + attribute :id, + type: 'GroupId', + json_key: 'id', + required: true + + attribute :lookup, + type: 'Record', + json_key: 'lookup', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_ids_list.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_ids_list.rb new file mode 100644 index 000000000000..1f9001a93b32 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_ids_list.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointIdsList + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_insert_operations.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_insert_operations.rb new file mode 100644 index 000000000000..637b724cecb1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_insert_operations.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PointInsertOperations + CANDIDATES = [ + 'PointsBatch', + 'PointsList', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_request.rb new file mode 100644 index 000000000000..2d9363af13c3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_request.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :ids, + type: 'Array', + json_key: 'ids', + required: true + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_struct.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_struct.rb new file mode 100644 index 000000000000..c3e9c3e14fda --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_struct.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointStruct + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'ExtendedPointId', + json_key: 'id', + required: true + + attribute :vector, + type: 'VectorStruct', + json_key: 'vector', + required: true + + attribute :payload, + type: 'Hash', + json_key: 'payload', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_vectors.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_vectors.rb new file mode 100644 index 000000000000..19e34359af35 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/point_vectors.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointVectors + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'ExtendedPointId', + json_key: 'id', + required: true + + attribute :vector, + type: 'VectorStruct', + json_key: 'vector', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_batch.rb new file mode 100644 index 000000000000..0d5ce21bed52 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_batch.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointsBatch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :batch, + type: 'Batch', + json_key: 'batch', + required: true + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_list.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_list.rb new file mode 100644 index 000000000000..5e9578628435 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_list.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class PointsList + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_selector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_selector.rb new file mode 100644 index 000000000000..650d03b93e2e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/points_selector.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PointsSelector + CANDIDATES = [ + 'FilterSelector', + 'PointIdsList', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch.rb new file mode 100644 index 000000000000..9dcfa8a22ff6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Prefetch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :prefetch, + type: 'PrefetchPrefetch', + json_key: 'prefetch', + required: false + + attribute :query, + type: 'QueryInterface', + json_key: 'query', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch_prefetch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch_prefetch.rb new file mode 100644 index 000000000000..8d773fa571ae --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/prefetch_prefetch.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module PrefetchPrefetch + CANDIDATES = [ + 'Array', + 'Prefetch', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization.rb new file mode 100644 index 000000000000..95cdcc70df44 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ProductQuantization + include Qdrant::Serializable + include Qdrant::Validations + + attribute :product, + type: 'ProductQuantizationConfig', + json_key: 'product', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization_config.rb new file mode 100644 index 000000000000..f84c6f1a7afb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/product_quantization_config.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ProductQuantizationConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :compression, + type: 'CompressionRatio', + json_key: 'compression', + required: true + + attribute :always_ram, + type: 'Boolean', + json_key: 'always_ram', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config.rb new file mode 100644 index 000000000000..baa72d25b350 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module QuantizationConfig + CANDIDATES = [ + 'BinaryQuantization', + 'ProductQuantization', + 'ScalarQuantization', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config_diff.rb new file mode 100644 index 000000000000..73d456d3ff80 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_config_diff.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module QuantizationConfigDiff + CANDIDATES = [ + 'BinaryQuantization', + 'Disabled', + 'ProductQuantization', + 'ScalarQuantization', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_search_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_search_params.rb new file mode 100644 index 000000000000..f70f2dda79e5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/quantization_search_params.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QuantizationSearchParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :ignore, + type: 'Boolean', + json_key: 'ignore', + required: false + + attribute :rescore, + type: 'Boolean', + json_key: 'rescore', + required: false + + attribute :oversampling, + type: 'Float', + json_key: 'oversampling', + required: false, + minimum: 1 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @ignore = false if @ignore.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query.rb new file mode 100644 index 000000000000..c99688b8d85e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module Query + CANDIDATES = [ + 'ContextQuery', + 'DiscoverQuery', + 'FusionQuery', + 'NearestQuery', + 'OrderByQuery', + 'RecommendQuery', + 'SampleQuery', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_batch_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_batch_points200_response.rb new file mode 100644 index 000000000000..22f9077fc68d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_batch_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryBatchPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_groups_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_groups_request.rb new file mode 100644 index 000000000000..c6f8eb80d0d4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_groups_request.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryGroupsRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :prefetch, + type: 'QueryRequestPrefetch', + json_key: 'prefetch', + required: false + + attribute :query, + type: 'QueryInterface', + json_key: 'query', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + attribute :group_by, + type: 'String', + json_key: 'group_by', + required: true, + min_length: 1 + + attribute :group_size, + type: 'Integer', + json_key: 'group_size', + required: false, + minimum: 1 + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :with_lookup, + type: 'WithLookupInterface', + json_key: 'with_lookup', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_interface.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_interface.rb new file mode 100644 index 000000000000..498f3b5a1d76 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_interface.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module QueryInterface + CANDIDATES = [ + 'Query', + 'VectorInput', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_points200_response.rb new file mode 100644 index 000000000000..168272d166af --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'QueryResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request.rb new file mode 100644 index 000000000000..d813d38dfa38 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :prefetch, + type: 'QueryRequestPrefetch', + json_key: 'prefetch', + required: false + + attribute :query, + type: 'QueryInterface', + json_key: 'query', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :offset, + type: 'Integer', + json_key: 'offset', + required: false, + minimum: 0 + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_batch.rb new file mode 100644 index 000000000000..9b2d40435697 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_batch.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryRequestBatch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :searches, + type: 'Array', + json_key: 'searches', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_prefetch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_prefetch.rb new file mode 100644 index 000000000000..924bf26b59e5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_request_prefetch.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module QueryRequestPrefetch + CANDIDATES = [ + 'Array', + 'Prefetch', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_response.rb new file mode 100644 index 000000000000..e887d3ac1a47 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/query_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class QueryResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/raft_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/raft_info.rb new file mode 100644 index 000000000000..176f23e56eb0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/raft_info.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RaftInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :term, + type: 'Integer', + json_key: 'term', + required: true, + minimum: 0 + + attribute :commit, + type: 'Integer', + json_key: 'commit', + required: true, + minimum: 0 + + attribute :pending_operations, + type: 'Integer', + json_key: 'pending_operations', + required: true, + minimum: 0 + + attribute :leader, + type: 'Integer', + json_key: 'leader', + required: false, + minimum: 0 + + attribute :role, + type: 'StateRole', + json_key: 'role', + required: false + + attribute :is_voter, + type: 'Boolean', + json_key: 'is_voter', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range.rb new file mode 100644 index 000000000000..3c1f5eec87aa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Range + include Qdrant::Serializable + include Qdrant::Validations + + attribute :lt, + type: 'Float', + json_key: 'lt', + required: false + + attribute :gt, + type: 'Float', + json_key: 'gt', + required: false + + attribute :gte, + type: 'Float', + json_key: 'gte', + required: false + + attribute :lte, + type: 'Float', + json_key: 'lte', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range_interface.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range_interface.rb new file mode 100644 index 000000000000..c144ee81c916 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/range_interface.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module RangeInterface + CANDIDATES = [ + 'DatetimeRange', + 'Range', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency.rb new file mode 100644 index 000000000000..957fcb178642 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ReadConsistency + CANDIDATES = [ + 'Integer', + 'ReadConsistencyType', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency_type.rb new file mode 100644 index 000000000000..e2b7e333f4d8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/read_consistency_type.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ReadConsistencyType + MAJORITY = 'majority' + QUORUM = 'quorum' + ALL = 'all' + + def self.all + @all ||= [ + MAJORITY, + QUORUM, + ALL, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_example.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_example.rb new file mode 100644 index 000000000000..fb1e0482dee4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_example.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module RecommendExample + CANDIDATES = [ + 'Array', + 'ExtendedPointId', + 'SparseVector', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_groups_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_groups_request.rb new file mode 100644 index 000000000000..5acd05c8560e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_groups_request.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecommendGroupsRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :positive, + type: 'Array', + json_key: 'positive', + required: false + + attribute :negative, + type: 'Array', + json_key: 'negative', + required: false + + attribute :strategy, + type: 'RecommendStrategy', + json_key: 'strategy', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + attribute :group_by, + type: 'String', + json_key: 'group_by', + required: true, + min_length: 1 + + attribute :group_size, + type: 'Integer', + json_key: 'group_size', + required: true, + minimum: 1 + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: true, + minimum: 1 + + attribute :with_lookup, + type: 'WithLookupInterface', + json_key: 'with_lookup', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_input.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_input.rb new file mode 100644 index 000000000000..5057048d04f6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_input.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecommendInput + include Qdrant::Serializable + include Qdrant::Validations + + attribute :positive, + type: 'Array', + json_key: 'positive', + required: false + + attribute :negative, + type: 'Array', + json_key: 'negative', + required: false + + attribute :strategy, + type: 'RecommendStrategy', + json_key: 'strategy', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_query.rb new file mode 100644 index 000000000000..f5b925a549d9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecommendQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :recommend, + type: 'RecommendInput', + json_key: 'recommend', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request.rb new file mode 100644 index 000000000000..c032c60892cf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecommendRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :positive, + type: 'Array', + json_key: 'positive', + required: false + + attribute :negative, + type: 'Array', + json_key: 'negative', + required: false + + attribute :strategy, + type: 'RecommendStrategy', + json_key: 'strategy', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: true, + minimum: 1 + + attribute :offset, + type: 'Integer', + json_key: 'offset', + required: false, + minimum: 0 + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + attribute :lookup_from, + type: 'LookupLocation', + json_key: 'lookup_from', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request_batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request_batch.rb new file mode 100644 index 000000000000..d351aa7f0bac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_request_batch.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecommendRequestBatch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :searches, + type: 'Array', + json_key: 'searches', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_strategy.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_strategy.rb new file mode 100644 index 000000000000..8d205352feb9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recommend_strategy.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module RecommendStrategy + AVERAGE_VECTOR = 'average_vector' + BEST_SCORE = 'best_score' + + def self.all + @all ||= [ + AVERAGE_VECTOR, + BEST_SCORE, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/record.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/record.rb new file mode 100644 index 000000000000..cca8d2c651c3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/record.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Record + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'ExtendedPointId', + json_key: 'id', + required: true + + attribute :payload, + type: 'Hash', + json_key: 'payload', + required: false + + attribute :vector, + type: 'VectorStruct', + json_key: 'vector', + required: false + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: false + + attribute :order_value, + type: 'OrderValue', + json_key: 'order_value', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recover_from_uploaded_snapshot202_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recover_from_uploaded_snapshot202_response.rb new file mode 100644 index 000000000000..fec7c0f9752c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/recover_from_uploaded_snapshot202_response.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RecoverFromUploadedSnapshot202Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_info.rb new file mode 100644 index 000000000000..de5b26d5c372 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_info.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RemoteShardInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: false + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: true, + minimum: 0 + + attribute :state, + type: 'ReplicaState', + json_key: 'state', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_telemetry.rb new file mode 100644 index 000000000000..c6df8ccb154e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/remote_shard_telemetry.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RemoteShardTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: false, + minimum: 0 + + attribute :searches, + type: 'OperationDurationStatistics', + json_key: 'searches', + required: true + + attribute :updates, + type: 'OperationDurationStatistics', + json_key: 'updates', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias.rb new file mode 100644 index 000000000000..6812b596bd53 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RenameAlias + include Qdrant::Serializable + include Qdrant::Validations + + attribute :old_alias_name, + type: 'String', + json_key: 'old_alias_name', + required: true + + attribute :new_alias_name, + type: 'String', + json_key: 'new_alias_name', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias_operation.rb new file mode 100644 index 000000000000..22c07aab1ca9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/rename_alias_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RenameAliasOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :rename_alias, + type: 'RenameAlias', + json_key: 'rename_alias', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica.rb new file mode 100644 index 000000000000..174ad14fea5d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Replica + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_set_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_set_telemetry.rb new file mode 100644 index 000000000000..a43a0d44a285 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_set_telemetry.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ReplicaSetTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: true, + minimum: 0 + + attribute :local, + type: 'LocalShardTelemetry', + json_key: 'local', + required: false + + attribute :remote, + type: 'Array', + json_key: 'remote', + required: true + + attribute :replicate_states, + type: 'Hash', + json_key: 'replicate_states', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_state.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_state.rb new file mode 100644 index 000000000000..96cfdbe6bf93 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replica_state.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ReplicaState + ACTIVE = 'Active' + DEAD = 'Dead' + PARTIAL = 'Partial' + INITIALIZING = 'Initializing' + LISTENER = 'Listener' + PARTIAL_SNAPSHOT = 'PartialSnapshot' + RECOVERY = 'Recovery' + + def self.all + @all ||= [ + ACTIVE, + DEAD, + PARTIAL, + INITIALIZING, + LISTENER, + PARTIAL_SNAPSHOT, + RECOVERY, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard.rb new file mode 100644 index 000000000000..1f2d3295624e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ReplicateShard + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :to_peer_id, + type: 'Integer', + json_key: 'to_peer_id', + required: true, + minimum: 0 + + attribute :from_peer_id, + type: 'Integer', + json_key: 'from_peer_id', + required: true, + minimum: 0 + + attribute :method, + type: 'ShardTransferMethod', + json_key: 'method', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard_operation.rb new file mode 100644 index 000000000000..88af5c8bf374 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/replicate_shard_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ReplicateShardOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :replicate_shard, + type: 'ReplicateShard', + json_key: 'replicate_shard', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/requests_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/requests_telemetry.rb new file mode 100644 index 000000000000..8730c822a05e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/requests_telemetry.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RequestsTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :rest, + type: 'WebApiTelemetry', + json_key: 'rest', + required: true + + attribute :grpc, + type: 'GrpcTelemetry', + json_key: 'grpc', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_direction.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_direction.rb new file mode 100644 index 000000000000..bfc72d7f6f28 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_direction.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ReshardingDirection + UP = 'up' + DOWN = 'down' + + def self.all + @all ||= [ + UP, + DOWN, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_info.rb new file mode 100644 index 000000000000..bc80e09371ab --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/resharding_info.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ReshardingInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :direction, + type: 'ReshardingDirection', + json_key: 'direction', + required: true + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :peer_id, + type: 'Integer', + json_key: 'peer_id', + required: true, + minimum: 0 + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: false + + attribute :comment, + type: 'String', + json_key: 'comment', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer.rb new file mode 100644 index 000000000000..bb36bf0604b1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RestartTransfer + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :from_peer_id, + type: 'Integer', + json_key: 'from_peer_id', + required: true, + minimum: 0 + + attribute :to_peer_id, + type: 'Integer', + json_key: 'to_peer_id', + required: true, + minimum: 0 + + attribute :method, + type: 'ShardTransferMethod', + json_key: 'method', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer_operation.rb new file mode 100644 index 000000000000..2abbf6967e6a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/restart_transfer_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RestartTransferOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :restart_transfer, + type: 'RestartTransfer', + json_key: 'restart_transfer', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/running_environment_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/running_environment_telemetry.rb new file mode 100644 index 000000000000..158e6445a7dd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/running_environment_telemetry.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class RunningEnvironmentTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :distribution, + type: 'String', + json_key: 'distribution', + required: false + + attribute :distribution_version, + type: 'String', + json_key: 'distribution_version', + required: false + + attribute :is_docker, + type: 'Boolean', + json_key: 'is_docker', + required: true + + attribute :cores, + type: 'Integer', + json_key: 'cores', + required: false, + minimum: 0 + + attribute :ram_size, + type: 'Integer', + json_key: 'ram_size', + required: false, + minimum: 0 + + attribute :disk_size, + type: 'Integer', + json_key: 'disk_size', + required: false, + minimum: 0 + + attribute :cpu_flags, + type: 'String', + json_key: 'cpu_flags', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample.rb new file mode 100644 index 000000000000..eff0f5dc7762 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module Sample + RANDOM = 'random' + + def self.all + @all ||= [ + RANDOM, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample_query.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample_query.rb new file mode 100644 index 000000000000..ace57a47d293 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sample_query.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SampleQuery + include Qdrant::Serializable + include Qdrant::Validations + + attribute :sample, + type: 'Sample', + json_key: 'sample', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization.rb new file mode 100644 index 000000000000..817b403a08d3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScalarQuantization + include Qdrant::Serializable + include Qdrant::Validations + + attribute :scalar, + type: 'ScalarQuantizationConfig', + json_key: 'scalar', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization_config.rb new file mode 100644 index 000000000000..06d9a227ba22 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_quantization_config.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScalarQuantizationConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'ScalarType', + json_key: 'type', + required: true + + attribute :quantile, + type: 'Float', + json_key: 'quantile', + required: false, + maximum: 1, + minimum: 0.5 + + attribute :always_ram, + type: 'Boolean', + json_key: 'always_ram', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_type.rb new file mode 100644 index 000000000000..5fc86a7c28ac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scalar_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ScalarType + INT8 = 'int8' + + def self.all + @all ||= [ + INT8, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scored_point.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scored_point.rb new file mode 100644 index 000000000000..14b765396131 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scored_point.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScoredPoint + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'ExtendedPointId', + json_key: 'id', + required: true + + attribute :version, + type: 'Integer', + json_key: 'version', + required: true, + minimum: 0 + + attribute :score, + type: 'Float', + json_key: 'score', + required: true + + attribute :payload, + type: 'Hash', + json_key: 'payload', + required: false + + attribute :vector, + type: 'VectorStruct', + json_key: 'vector', + required: false + + attribute :shard_key, + type: 'ShardKey', + json_key: 'shard_key', + required: false + + attribute :order_value, + type: 'OrderValue', + json_key: 'order_value', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_points200_response.rb new file mode 100644 index 000000000000..0f1f4e688311 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScrollPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'ScrollResult', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_request.rb new file mode 100644 index 000000000000..8d761603fde2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_request.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScrollRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :offset, + type: 'ExtendedPointId', + json_key: 'offset', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :order_by, + type: 'OrderByInterface', + json_key: 'order_by', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_result.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_result.rb new file mode 100644 index 000000000000..4db7a7673d28 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/scroll_result.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ScrollResult + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true + + attribute :next_page_offset, + type: 'ExtendedPointId', + json_key: 'next_page_offset', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_batch_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_batch_points200_response.rb new file mode 100644 index 000000000000..e6cfb59c4bfb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_batch_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchBatchPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array>', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_groups_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_groups_request.rb new file mode 100644 index 000000000000..171c01a4a57f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_groups_request.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchGroupsRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :vector, + type: 'NamedVectorStruct', + json_key: 'vector', + required: true + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + attribute :group_by, + type: 'String', + json_key: 'group_by', + required: true, + min_length: 1 + + attribute :group_size, + type: 'Integer', + json_key: 'group_size', + required: true, + minimum: 1 + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: true, + minimum: 1 + + attribute :with_lookup, + type: 'WithLookupInterface', + json_key: 'with_lookup', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets200_response.rb new file mode 100644 index 000000000000..effe862bfd36 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixOffsets200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'SearchMatrixOffsetsResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets_response.rb new file mode 100644 index 000000000000..0748860120f4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_offsets_response.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixOffsetsResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :offsets_row, + type: 'Array', + json_key: 'offsets_row', + required: true + + attribute :offsets_col, + type: 'Array', + json_key: 'offsets_col', + required: true + + attribute :scores, + type: 'Array', + json_key: 'scores', + required: true + + attribute :ids, + type: 'Array', + json_key: 'ids', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pair.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pair.rb new file mode 100644 index 000000000000..0e886699b778 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pair.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixPair + include Qdrant::Serializable + include Qdrant::Validations + + attribute :a, + type: 'ExtendedPointId', + json_key: 'a', + required: true + + attribute :b, + type: 'ExtendedPointId', + json_key: 'b', + required: true + + attribute :score, + type: 'Float', + json_key: 'score', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs200_response.rb new file mode 100644 index 000000000000..8ae63e6891fe --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixPairs200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'SearchMatrixPairsResponse', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs_response.rb new file mode 100644 index 000000000000..612a12b1899b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_pairs_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixPairsResponse + include Qdrant::Serializable + include Qdrant::Validations + + attribute :pairs, + type: 'Array', + json_key: 'pairs', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_request.rb new file mode 100644 index 000000000000..5e5b1d510aa8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_matrix_request.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchMatrixRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :sample, + type: 'Integer', + json_key: 'sample', + required: false, + minimum: 2 + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: false, + minimum: 1 + + attribute :using, + type: 'String', + json_key: 'using', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_params.rb new file mode 100644 index 000000000000..374ed2c4a17f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_params.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :hnsw_ef, + type: 'Integer', + json_key: 'hnsw_ef', + required: false, + minimum: 0 + + attribute :exact, + type: 'Boolean', + json_key: 'exact', + required: false + + attribute :quantization, + type: 'QuantizationSearchParams', + json_key: 'quantization', + required: false + + attribute :indexed_only, + type: 'Boolean', + json_key: 'indexed_only', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @exact = false if @exact.nil? + @indexed_only = false if @indexed_only.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_point_groups200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_point_groups200_response.rb new file mode 100644 index 000000000000..34f84c146629 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_point_groups200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchPointGroups200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'GroupsResult', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_points200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_points200_response.rb new file mode 100644 index 000000000000..953e2142ebc6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_points200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchPoints200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'Array', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request.rb new file mode 100644 index 000000000000..2f55b7c8b58e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchRequest + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :vector, + type: 'NamedVectorStruct', + json_key: 'vector', + required: true + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :params, + type: 'SearchParams', + json_key: 'params', + required: false + + attribute :limit, + type: 'Integer', + json_key: 'limit', + required: true, + minimum: 1 + + attribute :offset, + type: 'Integer', + json_key: 'offset', + required: false, + minimum: 0 + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vector, + type: 'WithVector', + json_key: 'with_vector', + required: false + + attribute :score_threshold, + type: 'Float', + json_key: 'score_threshold', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request_batch.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request_batch.rb new file mode 100644 index 000000000000..3ecfbb9ec3d4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/search_request_batch.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SearchRequestBatch + include Qdrant::Serializable + include Qdrant::Validations + + attribute :searches, + type: 'Array', + json_key: 'searches', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_config.rb new file mode 100644 index 000000000000..3aa6e6c2c4bf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_config.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SegmentConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :vector_data, + type: 'Hash', + json_key: 'vector_data', + required: false + + attribute :sparse_vector_data, + type: 'Hash', + json_key: 'sparse_vector_data', + required: false + + attribute :payload_storage_type, + type: 'PayloadStorageType', + json_key: 'payload_storage_type', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_info.rb new file mode 100644 index 000000000000..82041a9c0936 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_info.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SegmentInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :segment_type, + type: 'SegmentType', + json_key: 'segment_type', + required: true + + attribute :num_vectors, + type: 'Integer', + json_key: 'num_vectors', + required: true, + minimum: 0 + + attribute :num_points, + type: 'Integer', + json_key: 'num_points', + required: true, + minimum: 0 + + attribute :num_indexed_vectors, + type: 'Integer', + json_key: 'num_indexed_vectors', + required: true, + minimum: 0 + + attribute :num_deleted_vectors, + type: 'Integer', + json_key: 'num_deleted_vectors', + required: true, + minimum: 0 + + attribute :ram_usage_bytes, + type: 'Integer', + json_key: 'ram_usage_bytes', + required: true, + minimum: 0 + + attribute :disk_usage_bytes, + type: 'Integer', + json_key: 'disk_usage_bytes', + required: true, + minimum: 0 + + attribute :is_appendable, + type: 'Boolean', + json_key: 'is_appendable', + required: true + + attribute :index_schema, + type: 'Hash', + json_key: 'index_schema', + required: true + + attribute :vector_data, + type: 'Hash', + json_key: 'vector_data', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_telemetry.rb new file mode 100644 index 000000000000..ce5d15a47c99 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_telemetry.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SegmentTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :info, + type: 'SegmentInfo', + json_key: 'info', + required: true + + attribute :config, + type: 'SegmentConfig', + json_key: 'config', + required: true + + attribute :vector_index_searches, + type: 'Array', + json_key: 'vector_index_searches', + required: true + + attribute :payload_field_indices, + type: 'Array', + json_key: 'payload_field_indices', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_type.rb new file mode 100644 index 000000000000..04cda99c418e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/segment_type.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module SegmentType + PLAIN = 'plain' + INDEXED = 'indexed' + SPECIAL = 'special' + + def self.all + @all ||= [ + PLAIN, + INDEXED, + SPECIAL, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload.rb new file mode 100644 index 000000000000..8465c6d7cdae --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SetPayload + include Qdrant::Serializable + include Qdrant::Validations + + attribute :payload, + type: 'Hash', + json_key: 'payload', + required: true + + attribute :points, + type: 'Array', + json_key: 'points', + required: false + + attribute :filter, + type: 'Filter', + json_key: 'filter', + required: false + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + attribute :key, + type: 'String', + json_key: 'key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload_operation.rb new file mode 100644 index 000000000000..a5e8b8919051 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/set_payload_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SetPayloadOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :set_payload, + type: 'SetPayload', + json_key: 'set_payload', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key.rb new file mode 100644 index 000000000000..7ac41126367d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ShardKey + CANDIDATES = [ + 'Integer', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key_selector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key_selector.rb new file mode 100644 index 000000000000..fb600ff306eb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_key_selector.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ShardKeySelector + CANDIDATES = [ + 'Array', + 'ShardKey', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_location.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_location.rb new file mode 100644 index 000000000000..5a88cc0642b1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_location.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ShardSnapshotLocation + CANDIDATES = [ + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_recover.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_recover.rb new file mode 100644 index 000000000000..3ac632a01036 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_snapshot_recover.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ShardSnapshotRecover + include Qdrant::Serializable + include Qdrant::Validations + + attribute :location, + type: 'ShardSnapshotLocation', + json_key: 'location', + required: true + + attribute :priority, + type: 'SnapshotPriority', + json_key: 'priority', + required: false + + attribute :checksum, + type: 'String', + json_key: 'checksum', + required: false + + attribute :api_key, + type: 'String', + json_key: 'api_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_status.rb new file mode 100644 index 000000000000..c64824d0e9a5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_status.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ShardStatus + GREEN = 'green' + YELLOW = 'yellow' + GREY = 'grey' + RED = 'red' + + def self.all + @all ||= [ + GREEN, + YELLOW, + GREY, + RED, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_info.rb new file mode 100644 index 000000000000..2eef4b05e1b1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_info.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ShardTransferInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :shard_id, + type: 'Integer', + json_key: 'shard_id', + required: true, + minimum: 0 + + attribute :from, + type: 'Integer', + json_key: 'from', + required: true, + minimum: 0 + + attribute :to, + type: 'Integer', + json_key: 'to', + required: true, + minimum: 0 + + attribute :sync, + type: 'Boolean', + json_key: 'sync', + required: true + + attribute :method, + type: 'ShardTransferMethod', + json_key: 'method', + required: false + + attribute :comment, + type: 'String', + json_key: 'comment', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_method.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_method.rb new file mode 100644 index 000000000000..f54519751ec5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/shard_transfer_method.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ShardTransferMethod + STREAM_RECORDS = 'stream_records' + SNAPSHOT = 'snapshot' + WAL_DELTA = 'wal_delta' + + def self.all + @all ||= [ + STREAM_RECORDS, + SNAPSHOT, + WAL_DELTA, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sharding_method.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sharding_method.rb new file mode 100644 index 000000000000..83baf39601fc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sharding_method.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module ShardingMethod + AUTO = 'auto' + CUSTOM = 'custom' + + def self.all + @all ||= [ + AUTO, + CUSTOM, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_description.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_description.rb new file mode 100644 index 000000000000..9393d3959fb5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_description.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SnapshotDescription + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :creation_time, + type: 'String', + json_key: 'creation_time', + required: false + + attribute :size, + type: 'Integer', + json_key: 'size', + required: true, + minimum: 0 + + attribute :checksum, + type: 'String', + json_key: 'checksum', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_priority.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_priority.rb new file mode 100644 index 000000000000..97b6efea5109 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_priority.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module SnapshotPriority + NO_SYNC = 'no_sync' + SNAPSHOT = 'snapshot' + REPLICA = 'replica' + + def self.all + @all ||= [ + NO_SYNC, + SNAPSHOT, + REPLICA, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_recover.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_recover.rb new file mode 100644 index 000000000000..7f2a3cae8996 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/snapshot_recover.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SnapshotRecover + include Qdrant::Serializable + include Qdrant::Validations + + attribute :location, + type: 'String', + json_key: 'location', + required: true + + attribute :priority, + type: 'SnapshotPriority', + json_key: 'priority', + required: false + + attribute :checksum, + type: 'String', + json_key: 'checksum', + required: false + + attribute :api_key, + type: 'String', + json_key: 'api_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_config.rb new file mode 100644 index 000000000000..7f6d0c06ff5d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_config.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SparseIndexConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :full_scan_threshold, + type: 'Integer', + json_key: 'full_scan_threshold', + required: false, + minimum: 0 + + attribute :index_type, + type: 'SparseIndexType', + json_key: 'index_type', + required: true + + attribute :datatype, + type: 'VectorStorageDatatype', + json_key: 'datatype', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_params.rb new file mode 100644 index 000000000000..a64d7bfd6aac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_params.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SparseIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :full_scan_threshold, + type: 'Integer', + json_key: 'full_scan_threshold', + required: false, + minimum: 0 + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + attribute :datatype, + type: 'Datatype', + json_key: 'datatype', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_type.rb new file mode 100644 index 000000000000..4962bb7a2379 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_index_type.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module SparseIndexType + MUTABLE_RAM = 'MutableRam' + IMMUTABLE_RAM = 'ImmutableRam' + MMAP = 'Mmap' + + def self.all + @all ||= [ + MUTABLE_RAM, + IMMUTABLE_RAM, + MMAP, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector.rb new file mode 100644 index 000000000000..ac7f288c7370 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SparseVector + include Qdrant::Serializable + include Qdrant::Validations + + attribute :indices, + type: 'Array', + json_key: 'indices', + required: true + + attribute :values, + type: 'Array', + json_key: 'values', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_data_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_data_config.rb new file mode 100644 index 000000000000..feba012fbd5c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_data_config.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SparseVectorDataConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :index, + type: 'SparseIndexConfig', + json_key: 'index', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_params.rb new file mode 100644 index 000000000000..84102f44e1d0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/sparse_vector_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class SparseVectorParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :index, + type: 'SparseIndexParams', + json_key: 'index', + required: false + + attribute :modifier, + type: 'Modifier', + json_key: 'modifier', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/start_from.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/start_from.rb new file mode 100644 index 000000000000..324ec40d779c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/start_from.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module StartFrom + CANDIDATES = [ + 'Float', + 'Integer', + 'Time', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/state_role.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/state_role.rb new file mode 100644 index 000000000000..384727e7234b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/state_role.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module StateRole + FOLLOWER = 'Follower' + CANDIDATE = 'Candidate' + LEADER = 'Leader' + PRE_CANDIDATE = 'PreCandidate' + + def self.all + @all ||= [ + FOLLOWER, + CANDIDATE, + LEADER, + PRE_CANDIDATE, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry200_response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry200_response.rb new file mode 100644 index 000000000000..0656cf40e339 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry200_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class Telemetry200Response + include Qdrant::Serializable + include Qdrant::Validations + + attribute :time, + type: 'Float', + json_key: 'time', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false + + attribute :result, + type: 'TelemetryData', + json_key: 'result', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry_data.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry_data.rb new file mode 100644 index 000000000000..07e539ceaa94 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/telemetry_data.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class TelemetryData + include Qdrant::Serializable + include Qdrant::Validations + + attribute :id, + type: 'String', + json_key: 'id', + required: true + + attribute :app, + type: 'AppBuildTelemetry', + json_key: 'app', + required: true + + attribute :collections, + type: 'CollectionsTelemetry', + json_key: 'collections', + required: true + + attribute :cluster, + type: 'ClusterTelemetry', + json_key: 'cluster', + required: true + + attribute :requests, + type: 'RequestsTelemetry', + json_key: 'requests', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_params.rb new file mode 100644 index 000000000000..9528d3e0aa59 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_params.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class TextIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'TextIndexType', + json_key: 'type', + required: true + + attribute :tokenizer, + type: 'TokenizerType', + json_key: 'tokenizer', + required: false + + attribute :min_token_len, + type: 'Integer', + json_key: 'min_token_len', + required: false, + minimum: 0 + + attribute :max_token_len, + type: 'Integer', + json_key: 'max_token_len', + required: false, + minimum: 0 + + attribute :lowercase, + type: 'Boolean', + json_key: 'lowercase', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_type.rb new file mode 100644 index 000000000000..9373090e930a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/text_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module TextIndexType + TEXT = 'text' + + def self.all + @all ||= [ + TEXT, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tokenizer_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tokenizer_type.rb new file mode 100644 index 000000000000..e3d9b1b1414a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tokenizer_type.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module TokenizerType + PREFIX = 'prefix' + WHITESPACE = 'whitespace' + WORD = 'word' + MULTILINGUAL = 'multilingual' + + def self.all + @all ||= [ + PREFIX, + WHITESPACE, + WORD, + MULTILINGUAL, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status.rb new file mode 100644 index 000000000000..6b2eac9f7577 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # oneOf wrapper. Builds the matching member from the discriminator when present, + # else tries each candidate type in order. + module TrackerStatus + CANDIDATES = [ + 'String', + 'TrackerStatusOneOf', + 'TrackerStatusOneOf1', + ].freeze + + def self.build(data) + # oneOf semantics: exactly one candidate must match. Collect every match so an + # ambiguous payload (satisfying more than one schema) is surfaced rather than + # silently resolved to whichever candidate happens to be listed first. (A match + # can legitimately be `false`, so reject only nil -- never use compact/filter_map.) + matches = [] + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + matches << result unless result.nil? + end + raise ArgumentError, "ambiguous oneOf for #{name}: #{matches.size} candidates matched" if matches.size > 1 + return matches.first unless matches.empty? + return data if CANDIDATES.include?('AnyType') + + raise ArgumentError, "oneOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of.rb new file mode 100644 index 000000000000..9952b219cd4a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class TrackerStatusOneOf + include Qdrant::Serializable + include Qdrant::Validations + + attribute :cancelled, + type: 'String', + json_key: 'cancelled', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of1.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of1.rb new file mode 100644 index 000000000000..4e761082740b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_status_one_of1.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class TrackerStatusOneOf1 + include Qdrant::Serializable + include Qdrant::Validations + + attribute :error, + type: 'String', + json_key: 'error', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_telemetry.rb new file mode 100644 index 000000000000..ee718eb1a235 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/tracker_telemetry.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class TrackerTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :segment_ids, + type: 'Array', + json_key: 'segment_ids', + required: true + + attribute :status, + type: 'TrackerStatus', + json_key: 'status', + required: true + + attribute :start_at, + type: 'Time', + json_key: 'start_at', + required: true + + attribute :end_at, + type: 'Time', + json_key: 'end_at', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_collection.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_collection.rb new file mode 100644 index 000000000000..fc17d40a4049 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_collection.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpdateCollection + include Qdrant::Serializable + include Qdrant::Validations + + attribute :vectors, + type: 'Hash', + json_key: 'vectors', + required: false + + attribute :optimizers_config, + type: 'OptimizersConfigDiff', + json_key: 'optimizers_config', + required: false + + attribute :params, + type: 'CollectionParamsDiff', + json_key: 'params', + required: false + + attribute :hnsw_config, + type: 'HnswConfigDiff', + json_key: 'hnsw_config', + required: false + + attribute :quantization_config, + type: 'QuantizationConfigDiff', + json_key: 'quantization_config', + required: false + + attribute :sparse_vectors, + type: 'Hash', + json_key: 'sparse_vectors', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operation.rb new file mode 100644 index 000000000000..8b7745c754a9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operation.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module UpdateOperation + CANDIDATES = [ + 'ClearPayloadOperation', + 'DeleteOperation', + 'DeletePayloadOperation', + 'DeleteVectorsOperation', + 'OverwritePayloadOperation', + 'SetPayloadOperation', + 'UpdateVectorsOperation', + 'UpsertOperation', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operations.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operations.rb new file mode 100644 index 000000000000..a52ecdf59d81 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_operations.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpdateOperations + include Qdrant::Serializable + include Qdrant::Validations + + attribute :operations, + type: 'Array', + json_key: 'operations', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_result.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_result.rb new file mode 100644 index 000000000000..554009be667b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_result.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpdateResult + include Qdrant::Serializable + include Qdrant::Validations + + attribute :operation_id, + type: 'Integer', + json_key: 'operation_id', + required: false, + minimum: 0 + + attribute :status, + type: 'UpdateStatus', + json_key: 'status', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_status.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_status.rb new file mode 100644 index 000000000000..07430b7ae482 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_status.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module UpdateStatus + ACKNOWLEDGED = 'acknowledged' + COMPLETED = 'completed' + + def self.all + @all ||= [ + ACKNOWLEDGED, + COMPLETED, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors.rb new file mode 100644 index 000000000000..e61df9adff6c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpdateVectors + include Qdrant::Serializable + include Qdrant::Validations + + attribute :points, + type: 'Array', + json_key: 'points', + required: true, + min_items: 1 + + attribute :shard_key, + type: 'ShardKeySelector', + json_key: 'shard_key', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors_operation.rb new file mode 100644 index 000000000000..60bd130bcf9e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/update_vectors_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpdateVectorsOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :update_vectors, + type: 'UpdateVectors', + json_key: 'update_vectors', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/upsert_operation.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/upsert_operation.rb new file mode 100644 index 000000000000..1ad6e516bbfc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/upsert_operation.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UpsertOperation + include Qdrant::Serializable + include Qdrant::Validations + + attribute :upsert, + type: 'PointInsertOperations', + json_key: 'upsert', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_params.rb new file mode 100644 index 000000000000..39480508e29b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class UuidIndexParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :type, + type: 'UuidIndexType', + json_key: 'type', + required: true + + attribute :is_tenant, + type: 'Boolean', + json_key: 'is_tenant', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_type.rb new file mode 100644 index 000000000000..72d26b35bad3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/uuid_index_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module UuidIndexType + UUID = 'uuid' + + def self.all + @all ||= [ + UUID, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/value_variants.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/value_variants.rb new file mode 100644 index 000000000000..74faddf78744 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/value_variants.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module ValueVariants + CANDIDATES = [ + 'Boolean', + 'Integer', + 'String', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/values_count.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/values_count.rb new file mode 100644 index 000000000000..895daaaf48c1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/values_count.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class ValuesCount + include Qdrant::Serializable + include Qdrant::Validations + + attribute :lt, + type: 'Integer', + json_key: 'lt', + required: false, + minimum: 0 + + attribute :gt, + type: 'Integer', + json_key: 'gt', + required: false, + minimum: 0 + + attribute :gte, + type: 'Integer', + json_key: 'gte', + required: false, + minimum: 0 + + attribute :lte, + type: 'Integer', + json_key: 'lte', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector.rb new file mode 100644 index 000000000000..a09edcbce9cb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module Vector + CANDIDATES = [ + 'Array>', + 'Array', + 'Document', + 'SparseVector', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_config.rb new file mode 100644 index 000000000000..c0bfc15bd553 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_config.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VectorDataConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :size, + type: 'Integer', + json_key: 'size', + required: true, + minimum: 0 + + attribute :distance, + type: 'Distance', + json_key: 'distance', + required: true + + attribute :storage_type, + type: 'VectorStorageType', + json_key: 'storage_type', + required: true + + attribute :index, + type: 'Indexes', + json_key: 'index', + required: true + + attribute :quantization_config, + type: 'QuantizationConfig', + json_key: 'quantization_config', + required: false + + attribute :multivector_config, + type: 'MultiVectorConfig', + json_key: 'multivector_config', + required: false + + attribute :datatype, + type: 'VectorStorageDatatype', + json_key: 'datatype', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_info.rb new file mode 100644 index 000000000000..9aae93dfca7a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_data_info.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VectorDataInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :num_vectors, + type: 'Integer', + json_key: 'num_vectors', + required: true, + minimum: 0 + + attribute :num_indexed_vectors, + type: 'Integer', + json_key: 'num_indexed_vectors', + required: true, + minimum: 0 + + attribute :num_deleted_vectors, + type: 'Integer', + json_key: 'num_deleted_vectors', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_index_searches_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_index_searches_telemetry.rb new file mode 100644 index 000000000000..422647d6ca3d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_index_searches_telemetry.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VectorIndexSearchesTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :index_name, + type: 'String', + json_key: 'index_name', + required: false + + attribute :unfiltered_plain, + type: 'OperationDurationStatistics', + json_key: 'unfiltered_plain', + required: true + + attribute :unfiltered_hnsw, + type: 'OperationDurationStatistics', + json_key: 'unfiltered_hnsw', + required: true + + attribute :unfiltered_sparse, + type: 'OperationDurationStatistics', + json_key: 'unfiltered_sparse', + required: true + + attribute :filtered_plain, + type: 'OperationDurationStatistics', + json_key: 'filtered_plain', + required: true + + attribute :filtered_small_cardinality, + type: 'OperationDurationStatistics', + json_key: 'filtered_small_cardinality', + required: true + + attribute :filtered_large_cardinality, + type: 'OperationDurationStatistics', + json_key: 'filtered_large_cardinality', + required: true + + attribute :filtered_exact, + type: 'OperationDurationStatistics', + json_key: 'filtered_exact', + required: true + + attribute :filtered_sparse, + type: 'OperationDurationStatistics', + json_key: 'filtered_sparse', + required: true + + attribute :unfiltered_exact, + type: 'OperationDurationStatistics', + json_key: 'unfiltered_exact', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_input.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_input.rb new file mode 100644 index 000000000000..71720fd464ea --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_input.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module VectorInput + CANDIDATES = [ + 'Array>', + 'Array', + 'Document', + 'ExtendedPointId', + 'SparseVector', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params.rb new file mode 100644 index 000000000000..d0c08419e171 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VectorParams + include Qdrant::Serializable + include Qdrant::Validations + + attribute :size, + type: 'Integer', + json_key: 'size', + required: true, + minimum: 1 + + attribute :distance, + type: 'Distance', + json_key: 'distance', + required: true + + attribute :hnsw_config, + type: 'HnswConfigDiff', + json_key: 'hnsw_config', + required: false + + attribute :quantization_config, + type: 'QuantizationConfig', + json_key: 'quantization_config', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + attribute :datatype, + type: 'Datatype', + json_key: 'datatype', + required: false + + attribute :multivector_config, + type: 'MultiVectorConfig', + json_key: 'multivector_config', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params_diff.rb new file mode 100644 index 000000000000..108a262acd77 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_params_diff.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VectorParamsDiff + include Qdrant::Serializable + include Qdrant::Validations + + attribute :hnsw_config, + type: 'HnswConfigDiff', + json_key: 'hnsw_config', + required: false + + attribute :quantization_config, + type: 'QuantizationConfigDiff', + json_key: 'quantization_config', + required: false + + attribute :on_disk, + type: 'Boolean', + json_key: 'on_disk', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_datatype.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_datatype.rb new file mode 100644 index 000000000000..a6481ac725ab --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_datatype.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module VectorStorageDatatype + FLOAT32 = 'float32' + FLOAT16 = 'float16' + UINT8 = 'uint8' + + def self.all + @all ||= [ + FLOAT32, + FLOAT16, + UINT8, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_type.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_type.rb new file mode 100644 index 000000000000..54cf6b5d8665 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_storage_type.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module VectorStorageType + MEMORY = 'Memory' + MMAP = 'Mmap' + CHUNKED_MMAP = 'ChunkedMmap' + IN_RAM_CHUNKED_MMAP = 'InRamChunkedMmap' + + def self.all + @all ||= [ + MEMORY, + MMAP, + CHUNKED_MMAP, + IN_RAM_CHUNKED_MMAP, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_struct.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_struct.rb new file mode 100644 index 000000000000..d88e9e8455a4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vector_struct.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module VectorStruct + CANDIDATES = [ + 'Array>', + 'Array', + 'Document', + 'Hash', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vectors_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vectors_config.rb new file mode 100644 index 000000000000..c51238603034 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/vectors_config.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module VectorsConfig + CANDIDATES = [ + 'Hash', + 'VectorParams', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/version_info.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/version_info.rb new file mode 100644 index 000000000000..5234dfda4289 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/version_info.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class VersionInfo + include Qdrant::Serializable + include Qdrant::Validations + + attribute :title, + type: 'String', + json_key: 'title', + required: true + + attribute :version, + type: 'String', + json_key: 'version', + required: true + + attribute :commit, + type: 'String', + json_key: 'commit', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config.rb new file mode 100644 index 000000000000..9e5ce7972702 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class WalConfig + include Qdrant::Serializable + include Qdrant::Validations + + attribute :wal_capacity_mb, + type: 'Integer', + json_key: 'wal_capacity_mb', + required: true, + minimum: 1 + + attribute :wal_segments_ahead, + type: 'Integer', + json_key: 'wal_segments_ahead', + required: true, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config_diff.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config_diff.rb new file mode 100644 index 000000000000..ddfb5a1bd28a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/wal_config_diff.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class WalConfigDiff + include Qdrant::Serializable + include Qdrant::Validations + + attribute :wal_capacity_mb, + type: 'Integer', + json_key: 'wal_capacity_mb', + required: false, + minimum: 1 + + attribute :wal_segments_ahead, + type: 'Integer', + json_key: 'wal_segments_ahead', + required: false, + minimum: 0 + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/web_api_telemetry.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/web_api_telemetry.rb new file mode 100644 index 000000000000..87025e684a81 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/web_api_telemetry.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class WebApiTelemetry + include Qdrant::Serializable + include Qdrant::Validations + + attribute :responses, + type: 'Hash>', + json_key: 'responses', + required: true + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup.rb new file mode 100644 index 000000000000..ad9a7183c9a8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + class WithLookup + include Qdrant::Serializable + include Qdrant::Validations + + attribute :collection, + type: 'String', + json_key: 'collection', + required: true + + attribute :with_payload, + type: 'WithPayloadInterface', + json_key: 'with_payload', + required: false + + attribute :with_vectors, + type: 'WithVector', + json_key: 'with_vectors', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup_interface.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup_interface.rb new file mode 100644 index 000000000000..6878db5f60f7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_lookup_interface.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module WithLookupInterface + CANDIDATES = [ + 'String', + 'WithLookup', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_payload_interface.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_payload_interface.rb new file mode 100644 index 000000000000..3f2393acca30 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_payload_interface.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module WithPayloadInterface + CANDIDATES = [ + 'Array', + 'Boolean', + 'PayloadSelector', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_vector.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_vector.rb new file mode 100644 index 000000000000..97371cdd70af --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/with_vector.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + # anyOf wrapper. Returns the first candidate that validates. + module WithVector + CANDIDATES = [ + 'Array', + 'Boolean', + ].freeze + + def self.build(data) + CANDIDATES.each do |type_name| + next if type_name == 'AnyType' + + result = Qdrant::Polymorphism.cast(type_name, data) + return result unless result.nil? + end + return data if CANDIDATES.include?('AnyType') + + # No candidate matched: surface the payload drift instead of returning a silent + # nil that would only fail later as a downstream NoMethodError. + raise ArgumentError, "anyOf for #{name}: no candidate matched #{CANDIDATES.inspect}" + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/write_ordering.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/write_ordering.rb new file mode 100644 index 000000000000..b2f4e0199d50 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/models/write_ordering.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Qdrant API +# +# The version of the OpenAPI document: master +# Contact: andrey@vasnetsov.com +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Qdrant + module Models + module WriteOrdering + WEAK = 'weak' + MEDIUM = 'medium' + STRONG = 'strong' + + def self.all + @all ||= [ + WEAK, + MEDIUM, + STRONG, + ].freeze + end + + def self.valid?(value) + all.include?(value) + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/polymorphism.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/polymorphism.rb new file mode 100644 index 000000000000..427dcbda2a4c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/polymorphism.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +module Qdrant + # Runtime support for anyOf/oneOf candidate resolution. Casts raw + # deserialized data (Hash/Array/primitive) against a declared candidate + # type name and returns the matching value, or nil when it does not match. + # + # Candidate type names are plain OpenAPI-Generator Ruby type declarations + # (e.g. 'Integer', "Array", "Hash", or a bare model + # name resolved under Qdrant::Models). This mirrors the type-name + # dispatch used by the stock `ruby` generator's `find_and_cast_into_type`, + # adapted to the idiomatic Models:: namespace and attribute DSL. + module Polymorphism + ARRAY_TYPE = /\AArray<(?.+)>\z/ + HASH_TYPE = /\AHash.+)>\z/ + + # Internal sentinel distinguishing "no candidate matched" from a + # genuinely null value that legitimately matched a nullable candidate + # (e.g. a nullable array/hash element, or a nullable model reference). + # `nil` alone is ambiguous for that purpose, so it cannot be reused here. + NO_MATCH = Object.new.freeze + private_constant :NO_MATCH + + # Public entry point used by generated anyOf/oneOf wrappers. Returns the + # matching value, or nil when no candidate matched. + def self.cast(type_name, data) + result = cast_raw(type_name, data) + result.equal?(NO_MATCH) ? nil : result + end + + def self.cast_raw(type_name, data) + case type_name + when 'Boolean' + [true, false].include?(data) ? data : NO_MATCH + when 'Integer' + data.is_a?(Integer) ? data : NO_MATCH + when 'Float' + data.is_a?(Numeric) ? data.to_f : NO_MATCH + when 'String' + data.is_a?(String) ? data : NO_MATCH + when 'Time' + cast_time(data) + when 'Object', 'Hash' + data.is_a?(Hash) ? data : NO_MATCH + when ARRAY_TYPE + cast_array(Regexp.last_match[:sub_type], data) + when HASH_TYPE + cast_hash(Regexp.last_match[:sub_type], data) + else + data.nil? ? nil : cast_model(type_name, data) + end + end + private_class_method :cast_raw + + def self.cast_time(data) + return NO_MATCH unless data.is_a?(String) + + Time.parse(data) + rescue ArgumentError, TypeError + NO_MATCH + end + private_class_method :cast_time + + def self.cast_array(sub_type, data) + return NO_MATCH unless data.is_a?(Array) + + cast_items = data.map { |item| cast_raw(sub_type, item) } + cast_items.any? { |item| item.equal?(NO_MATCH) } ? NO_MATCH : cast_items + end + private_class_method :cast_array + + def self.cast_hash(sub_type, data) + return NO_MATCH unless data.is_a?(Hash) + + cast_pairs = data.transform_values { |value| cast_raw(sub_type, value) } + cast_pairs.any? { |_k, v| v.equal?(NO_MATCH) } ? NO_MATCH : cast_pairs + end + private_class_method :cast_hash + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is: + # - a real model class (Serializable/Validations): responds to `from_hash` + # - an enum module: responds to class-level `valid?(value)` + # - a nested oneOf/anyOf wrapper module: responds to `build(data)` only + def self.cast_model(type_name, data) + return NO_MATCH unless Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + obj = const.from_hash(data) + obj.valid? ? obj : NO_MATCH + elsif const.respond_to?(:valid?) + const.valid?(data) ? data : NO_MATCH + elsif const.respond_to?(:build) + const.build(data) + else + NO_MATCH + end + # A non-matching candidate must not abort the whole anyOf/oneOf resolution: a wrong + # shape (Array where a Hash is expected, a nested build that raises, ...) simply means + # "this candidate does not match", so treat any resolution failure as NO_MATCH. + rescue NameError, TypeError, ArgumentError + # NameError already covers its subclass NoMethodError. + NO_MATCH + end + private_class_method :cast_model + + # Non-validating structural coercion used by `from_hash` deserialization. + # Unlike `cast`/`cast_raw` (which gate on `valid?` to pick the right + # anyOf/oneOf candidate), `coerce` never rejects data: it builds the best + # typed representation it can and falls back to returning the data + # unchanged when it cannot resolve a type. This ensures deserialization + # never silently drops a valid-but-incomplete nested object. + def self.coerce(type_name, data) + return nil if data.nil? + + case type_name + when 'Boolean', 'Integer', 'String', 'Object', 'Hash', nil + data + when 'Float' + data.is_a?(Numeric) ? data.to_f : data + when 'Time' + coerce_time(data) + when ARRAY_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Array) ? data.map { |item| coerce(sub_type, item) } : data + when HASH_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Hash) ? data.transform_values { |value| coerce(sub_type, value) } : data + else + coerce_model(type_name, data) + end + end + + def self.coerce_time(data) + return data unless data.is_a?(String) + + begin + Time.parse(data) + rescue ArgumentError, TypeError + data + end + end + private_class_method :coerce_time + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is, without any `valid?` gating: + # - a real model class (Serializable/Validations): `from_hash` (recurses) + # - a nested oneOf/anyOf wrapper module: `build(data)` + # - an enum module: returns the raw value unchanged + # - anything unresolvable: returns the data unchanged + def self.coerce_model(type_name, data) + return data unless type_name.is_a?(String) && Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + const.from_hash(data) + elsif const.respond_to?(:build) + const.build(data) + else + data + end + rescue NameError + data + end + private_class_method :coerce_model + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/response.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/response.rb new file mode 100644 index 000000000000..6888eb6b4412 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/response.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Qdrant + # Result of an operation. Delegates to `data` for ergonomic access while keeping + # status/headers available. Replaces the `_with_http_info` twin methods. + class Response + extend Forwardable + + attr_reader :data, :status, :headers + + def initialize(data:, status:, headers:) + @data = data + @status = status + @headers = headers + end + + def_delegators :data, :[], :each, :map, :to_a, :to_hash, :dig + + def to_h + data.respond_to?(:to_hash) ? data.to_hash : data + end + + def deconstruct_keys(_keys) + { data: data, status: status, headers: headers } + end + + def deconstruct + [data, status, headers] + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/serializable.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/serializable.rb new file mode 100644 index 000000000000..5e4150362ef8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/serializable.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module Qdrant + # Shared serialization for all models. Models declare their attributes via the + # `attribute` DSL (see Validations); this reads the resulting attribute table. + module Serializable + def to_hash + result = self.class.openapi_attributes.each_with_object({}) do |(name, attr), hash| + value = public_send(name) + next if value.nil? && !attr[:required] + + hash[attr[:json_key]] = Serializable.serialize(value) + end + if respond_to?(:additional_properties) && additional_properties && !additional_properties.empty? + # A declared attribute always wins over an overflow key of the same name. + result.merge!(Serializable.serialize(additional_properties)) { |_key, declared, _extra| declared } + end + result + end + + def to_body + to_hash + end + + def to_json(*args) + to_hash.to_json(*args) + end + + def to_s + to_hash.to_s + end + + def ==(other) + other.is_a?(self.class) && to_hash == other.to_hash + end + alias eql? == + + def hash + to_hash.hash + end + + def self.serialize(value) + case value + when Array then value.map { |v| serialize(v) } + when Hash then value.transform_values { |v| serialize(v) } + else value.respond_to?(:to_hash) ? value.to_hash : value + end + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/validations.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/validations.rb new file mode 100644 index 000000000000..9c611f27a19c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/validations.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module Qdrant + # Declarative attribute DSL. `attribute :name, type:, required:, enum:, ...` + # generates the accessor, registers the attribute in `openapi_attributes`, + # and stores the validation rules. Replaces the per-model EnumAttributeValidator. + module Validations + def self.included(base) + base.extend(ClassMethods) + end + + module ClassMethods + def openapi_attributes + @openapi_attributes ||= superclass.respond_to?(:openapi_attributes) ? superclass.openapi_attributes.dup : {} + end + + def attribute(name, type:, json_key: name.to_s, required: false, **rules) + openapi_attributes[name] = { type: type, json_key: json_key, required: required, rules: rules } + attr_accessor name + end + + # Deserialization/builder paths use `allocate` (not `new`) on purpose: they must + # stay resilient (a server response may legitimately omit fields the schema marks + # required, or drift from the spec), whereas the caller-facing `initialize` is + # strict and validating. Bypassing `initialize` keeps those two contracts separate. + def build(**attrs) + obj = allocate + attrs.each { |k, v| obj.public_send("#{k}=", v) } + obj + end + + def from_hash(hash) + obj = allocate + openapi_attributes.each do |name, attr| + next unless hash.key?(attr[:json_key]) + + obj.public_send("#{name}=", Qdrant::Polymorphism.coerce(attr[:type], hash[attr[:json_key]])) + end + if obj.respond_to?(:additional_properties=) + known = openapi_attributes.values.map { |a| a[:json_key] } + obj.additional_properties = hash.except(*known) + end + obj + end + + def from_json(json) + from_hash(JSON.parse(json)) + end + end + + def list_invalid_properties + errors = [] + self.class.openapi_attributes.each do |name, attr| + errors.concat(validate_attribute(name, attr, public_send(name))) + end + errors + end + + def valid? + list_invalid_properties.empty? + end + + private + + def validate_attribute(name, attr, value) + out = [] + if attr[:required] && value.nil? + out << "invalid value for \"#{name}\", must be provided" + return out + end + return out if value.nil? + + rules = attr[:rules] + out << "invalid value for \"#{name}\", must be one of #{rules[:enum].inspect}" if rules[:enum] && !rules[:enum].include?(value) + out << "\"#{name}\" too long (max #{rules[:max_length]})" if rules[:max_length] && value.to_s.length > rules[:max_length] + out << "\"#{name}\" too short (min #{rules[:min_length]})" if rules[:min_length] && value.to_s.length < rules[:min_length] + # Guard the comparisons: `valid?` must stay a safe, exception-free query even when a + # caller assigns the wrong type (a String to a numeric field, a scalar to an array). + out << "\"#{name}\" must be <= #{rules[:maximum]}" if rules[:maximum] && value.is_a?(Numeric) && value > rules[:maximum] + out << "\"#{name}\" must be >= #{rules[:minimum]}" if rules[:minimum] && value.is_a?(Numeric) && value < rules[:minimum] + out << "\"#{name}\" too many items (max #{rules[:max_items]})" if rules[:max_items] && value.respond_to?(:length) && value.length > rules[:max_items] + out << "\"#{name}\" too few items (min #{rules[:min_items]})" if rules[:min_items] && value.respond_to?(:length) && value.length < rules[:min_items] + out << "\"#{name}\" does not match #{rules[:pattern]}" if rules[:pattern] && value !~ rules[:pattern] + out + end + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/version.rb b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/version.rb new file mode 100644 index 000000000000..81dc907a7b36 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/lib/qdrant/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Qdrant + VERSION = '1.0.0' +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/qdrant.gemspec b/samples/client/others/ruby-idiomatic-qdrant/qdrant.gemspec new file mode 100644 index 000000000000..c3e7582d5443 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/qdrant.gemspec @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require_relative 'lib/qdrant/version' + +Gem::Specification.new do |s| + s.name = 'qdrant' + s.version = Qdrant::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ['OpenAPI-Generator'] + s.email = [''] + s.homepage = 'https://openapitools.org' + s.summary = 'A Ruby client generated by openapi-generator' + s.description = 'A Ruby client generated by openapi-generator' + s.license = 'unlicense' + + s.required_ruby_version = '>= 3.0.0' + + s.files = Dir['LICENSE', 'README.md', 'lib/**/*.rb'] + + s.add_dependency 'faraday' + s.add_dependency 'faraday-multipart' + s.add_dependency 'zeitwerk' +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/aliases_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/aliases_spec.rb new file mode 100644 index 000000000000..c0d04f874e0c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/aliases_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Aliases do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster/peer_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster/peer_spec.rb new file mode 100644 index 000000000000..e869ac4cb8bd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster/peer_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Cluster::Peer do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster_spec.rb new file mode 100644 index 000000000000..efd582a3ac7d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/cluster_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Cluster do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/index_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/index_spec.rb new file mode 100644 index 000000000000..d0c408db8bb6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/index_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Collections::Index do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/points_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/points_spec.rb new file mode 100644 index 000000000000..d3c9180bee75 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/points_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Collections::Points do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/shards_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/shards_spec.rb new file mode 100644 index 000000000000..1009d60e40db --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/shards_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Collections::Shards do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/snapshots_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/snapshots_spec.rb new file mode 100644 index 000000000000..571d50e91196 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections/snapshots_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Collections::Snapshots do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections_spec.rb new file mode 100644 index 000000000000..a9fda5c3393b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/collections_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Collections do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/healthz_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/healthz_spec.rb new file mode 100644 index 000000000000..00f3c81828f7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/healthz_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Healthz do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/issues_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/issues_spec.rb new file mode 100644 index 000000000000..4c187d74ae30 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/issues_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Issues do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/livez_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/livez_spec.rb new file mode 100644 index 000000000000..8179f20350e9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/livez_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Livez do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/locks_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/locks_spec.rb new file mode 100644 index 000000000000..46acb9c74f66 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/locks_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Locks do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/metrics_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/metrics_spec.rb new file mode 100644 index 000000000000..4874aca63a20 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/metrics_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Metrics do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/readyz_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/readyz_spec.rb new file mode 100644 index 000000000000..5ef4f62abb21 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/readyz_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Readyz do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/root_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/root_spec.rb new file mode 100644 index 000000000000..13f2fd738511 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/root_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Root do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/snapshots_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/snapshots_spec.rb new file mode 100644 index 000000000000..12e2726bdc93 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/snapshots_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Snapshots do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/api/telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/api/telemetry_spec.rb new file mode 100644 index 000000000000..cb198496ff3b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/api/telemetry_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Api::Telemetry do + let(:client) { Qdrant::Client.new(base_url: 'http://localhost:6333') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_shard_transfer_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_shard_transfer_spec.rb new file mode 100644 index 000000000000..32c0024d2282 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_shard_transfer_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AbortShardTransfer do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_transfer_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_transfer_operation_spec.rb new file mode 100644 index 000000000000..ec5afd3f55c1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/abort_transfer_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AbortTransferOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_description_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_description_spec.rb new file mode 100644 index 000000000000..4d667f5f2ec1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_description_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AliasDescription do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_operations_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_operations_spec.rb new file mode 100644 index 000000000000..510731ef9289 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/alias_operations_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AliasOperations do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/any_variants_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/any_variants_spec.rb new file mode 100644 index 000000000000..b8acff287a9d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/any_variants_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AnyVariants do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_build_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_build_telemetry_spec.rb new file mode 100644 index 000000000000..730477459e37 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_build_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AppBuildTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_features_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_features_telemetry_spec.rb new file mode 100644 index 000000000000..700ce4ca0aad --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/app_features_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::AppFeaturesTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_payloads_inner_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_payloads_inner_spec.rb new file mode 100644 index 000000000000..5e76ab678f12 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_payloads_inner_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BatchPayloadsInner do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_spec.rb new file mode 100644 index 000000000000..381aadb19d56 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Batch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_update200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_update200_response_spec.rb new file mode 100644 index 000000000000..3ef2c535bb71 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_update200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BatchUpdate200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_vector_struct_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_vector_struct_spec.rb new file mode 100644 index 000000000000..9c5988a4aacb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/batch_vector_struct_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BatchVectorStruct do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_config_spec.rb new file mode 100644 index 000000000000..b9dce0419c69 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BinaryQuantizationConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_spec.rb new file mode 100644 index 000000000000..b8a155d08145 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/binary_quantization_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BinaryQuantization do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_params_spec.rb new file mode 100644 index 000000000000..b00022a1f9b1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BoolIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_type_spec.rb new file mode 100644 index 000000000000..0a0bb8678a7f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/bool_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::BoolIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/change_aliases_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/change_aliases_operation_spec.rb new file mode 100644 index 000000000000..f582c4ae8920 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/change_aliases_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ChangeAliasesOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/clear_payload_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/clear_payload_operation_spec.rb new file mode 100644 index 000000000000..0711f32291db --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/clear_payload_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClearPayloadOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_config_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_config_telemetry_spec.rb new file mode 100644 index 000000000000..943fb9d24e5d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_config_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterConfigTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_operations_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_operations_spec.rb new file mode 100644 index 000000000000..e46814350e30 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_operations_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterOperations do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status200_response_spec.rb new file mode 100644 index 000000000000..1dd5df7b3d9d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterStatus200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of1_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of1_spec.rb new file mode 100644 index 000000000000..a13fc7ee3075 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of1_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterStatusOneOf1 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of_spec.rb new file mode 100644 index 000000000000..2041d72c3b6a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterStatusOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_spec.rb new file mode 100644 index 000000000000..f793df09ed9e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterStatus do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_telemetry_spec.rb new file mode 100644 index 000000000000..b081a378d270 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_status_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterStatusTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_telemetry_spec.rb new file mode 100644 index 000000000000..543243db0888 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/cluster_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ClusterTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info200_response_spec.rb new file mode 100644 index 000000000000..00291d2f81fc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionClusterInfo200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info_spec.rb new file mode 100644 index 000000000000..bd5211affb46 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_cluster_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionClusterInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_config_spec.rb new file mode 100644 index 000000000000..a10239a6ebf5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_description_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_description_spec.rb new file mode 100644 index 000000000000..5db4b5cb4a09 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_description_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionDescription do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_existence_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_existence_spec.rb new file mode 100644 index 000000000000..8f1a1c7ee310 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_existence_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionExistence do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_exists200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_exists200_response_spec.rb new file mode 100644 index 000000000000..4e9ed275dc33 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_exists200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionExists200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_info_spec.rb new file mode 100644 index 000000000000..87b02dac14a8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_diff_spec.rb new file mode 100644 index 000000000000..80f13c69bd0c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_diff_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionParamsDiff do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_spec.rb new file mode 100644 index 000000000000..f4949587a5fa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_status_spec.rb new file mode 100644 index 000000000000..83a5ac87dea8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionStatus do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_enum_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_enum_spec.rb new file mode 100644 index 000000000000..cc73737c5a48 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_enum_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionTelemetryEnum do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_spec.rb new file mode 100644 index 000000000000..13f55a261ecd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collection_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aggregated_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aggregated_telemetry_spec.rb new file mode 100644 index 000000000000..a2c34bfa040d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aggregated_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionsAggregatedTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aliases_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aliases_response_spec.rb new file mode 100644 index 000000000000..0b6ae75b56b8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_aliases_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionsAliasesResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_response_spec.rb new file mode 100644 index 000000000000..14fa0a30af1b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionsResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_telemetry_spec.rb new file mode 100644 index 000000000000..233dae2abc21 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/collections_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CollectionsTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/compression_ratio_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/compression_ratio_spec.rb new file mode 100644 index 000000000000..475be0546eee --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/compression_ratio_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CompressionRatio do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/condition_spec.rb new file mode 100644 index 000000000000..f84c68b06458 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/condition_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Condition do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_config_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_config_telemetry_spec.rb new file mode 100644 index 000000000000..ebba1bab8b1f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_config_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ConsensusConfigTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of1_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of1_spec.rb new file mode 100644 index 000000000000..a7cc45a3e811 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of1_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ConsensusThreadStatusOneOf1 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of2_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of2_spec.rb new file mode 100644 index 000000000000..682d4018fb56 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of2_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ConsensusThreadStatusOneOf2 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of_spec.rb new file mode 100644 index 000000000000..6c26b906397e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ConsensusThreadStatusOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_spec.rb new file mode 100644 index 000000000000..71d538f9517e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/consensus_thread_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ConsensusThreadStatus do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_example_pair_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_example_pair_spec.rb new file mode 100644 index 000000000000..6b5345696581 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_example_pair_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ContextExamplePair do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_input_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_input_spec.rb new file mode 100644 index 000000000000..be4c655e9ecd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_input_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ContextInput do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_pair_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_pair_spec.rb new file mode 100644 index 000000000000..548f5a9535cc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_pair_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ContextPair do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_query_spec.rb new file mode 100644 index 000000000000..7946bd8b0193 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/context_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ContextQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_points200_response_spec.rb new file mode 100644 index 000000000000..90d8daa7cc13 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CountPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_request_spec.rb new file mode 100644 index 000000000000..6377df507666 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CountRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_result_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_result_spec.rb new file mode 100644 index 000000000000..d0f7661ffdfa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/count_result_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CountResult do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_operation_spec.rb new file mode 100644 index 000000000000..28062fd409e5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateAliasOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_spec.rb new file mode 100644 index 000000000000..f66afb4c28a3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_alias_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateAlias do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_collection_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_collection_spec.rb new file mode 100644 index 000000000000..0e2a5d10a7b5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_collection_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateCollection do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index200_response_spec.rb new file mode 100644 index 000000000000..413b97975924 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateFieldIndex200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index_spec.rb new file mode 100644 index 000000000000..db9f704d3b91 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_field_index_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateFieldIndex do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_shard_key200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_shard_key200_response_spec.rb new file mode 100644 index 000000000000..a608bbc2dea9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_shard_key200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateShardKey200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_operation_spec.rb new file mode 100644 index 000000000000..bb41b99817f7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateShardingKeyOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_spec.rb new file mode 100644 index 000000000000..64deace9a486 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_sharding_key_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateShardingKey do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_snapshot200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_snapshot200_response_spec.rb new file mode 100644 index 000000000000..e6517f1de413 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/create_snapshot200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::CreateSnapshot200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/datatype_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datatype_spec.rb new file mode 100644 index 000000000000..6b48cc7a29f7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datatype_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Datatype do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_params_spec.rb new file mode 100644 index 000000000000..349436768175 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DatetimeIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_type_spec.rb new file mode 100644 index 000000000000..c80c85940749 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DatetimeIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_range_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_range_spec.rb new file mode 100644 index 000000000000..1b0bbb3c92c7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/datetime_range_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DatetimeRange do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_operation_spec.rb new file mode 100644 index 000000000000..2543edf9a4cc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeleteAliasOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_spec.rb new file mode 100644 index 000000000000..b1c166eb13ae --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_alias_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeleteAlias do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_operation_spec.rb new file mode 100644 index 000000000000..38136d4a45f4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeleteOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_operation_spec.rb new file mode 100644 index 000000000000..a671467b463a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeletePayloadOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_spec.rb new file mode 100644 index 000000000000..8be1365d5868 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_payload_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeletePayload do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_operation_spec.rb new file mode 100644 index 000000000000..14dfd6935b51 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeleteVectorsOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_spec.rb new file mode 100644 index 000000000000..08bb21fec13a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/delete_vectors_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DeleteVectors do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/direction_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/direction_spec.rb new file mode 100644 index 000000000000..f89d899197df --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/direction_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Direction do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/disabled_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/disabled_spec.rb new file mode 100644 index 000000000000..3718bd1a64c0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/disabled_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Disabled do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_context_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_context_spec.rb new file mode 100644 index 000000000000..1c42f1556975 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_context_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DiscoverInputContext do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_spec.rb new file mode 100644 index 000000000000..4c414452b149 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_input_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DiscoverInput do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_query_spec.rb new file mode 100644 index 000000000000..1474ba2a2317 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DiscoverQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_batch_spec.rb new file mode 100644 index 000000000000..0e87eca60b50 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DiscoverRequestBatch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_spec.rb new file mode 100644 index 000000000000..1a1ffa3827ec --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/discover_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DiscoverRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/distance_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/distance_spec.rb new file mode 100644 index 000000000000..40ccb57208a4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/distance_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Distance do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/document_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/document_spec.rb new file mode 100644 index 000000000000..3fe2ce61995e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/document_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Document do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_replica_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_replica_operation_spec.rb new file mode 100644 index 000000000000..2b07dc9534ec --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_replica_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DropReplicaOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_operation_spec.rb new file mode 100644 index 000000000000..5bcead44c78f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DropShardingKeyOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_spec.rb new file mode 100644 index 000000000000..6617c6505dd7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/drop_sharding_key_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::DropShardingKey do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_spec.rb new file mode 100644 index 000000000000..c3f0ccea9e78 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ErrorResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_status_spec.rb new file mode 100644 index 000000000000..7e6933408ca7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/error_response_status_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ErrorResponseStatus do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/extended_point_id_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/extended_point_id_spec.rb new file mode 100644 index 000000000000..6686b8612fda --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/extended_point_id_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ExtendedPointId do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet200_response_spec.rb new file mode 100644 index 000000000000..46e35179ff6e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Facet200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_request_spec.rb new file mode 100644 index 000000000000..724f72fc039d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FacetRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_response_spec.rb new file mode 100644 index 000000000000..5989ee7346b7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FacetResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_hit_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_hit_spec.rb new file mode 100644 index 000000000000..1fdc3383f1a8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_hit_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FacetValueHit do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_spec.rb new file mode 100644 index 000000000000..f96f1317e1b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/facet_value_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FacetValue do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/field_condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/field_condition_spec.rb new file mode 100644 index 000000000000..90211531cd7b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/field_condition_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FieldCondition do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_not_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_not_spec.rb new file mode 100644 index 000000000000..f37f142dc046 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_not_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FilterMustNot do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_spec.rb new file mode 100644 index 000000000000..6927257de9b7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_must_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FilterMust do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_selector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_selector_spec.rb new file mode 100644 index 000000000000..5d7f5a7c8240 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_selector_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FilterSelector do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_should_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_should_spec.rb new file mode 100644 index 000000000000..59ea0a7022c2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_should_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FilterShould do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_spec.rb new file mode 100644 index 000000000000..0f4d77f98cf9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/filter_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Filter do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_params_spec.rb new file mode 100644 index 000000000000..ddd89ab4780f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FloatIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_type_spec.rb new file mode 100644 index 000000000000..94f984328f35 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/float_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FloatIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_query_spec.rb new file mode 100644 index 000000000000..5843f1e32c6f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::FusionQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_spec.rb new file mode 100644 index 000000000000..c4e87432d232 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/fusion_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Fusion do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_bounding_box_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_bounding_box_spec.rb new file mode 100644 index 000000000000..2095966e1a77 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_bounding_box_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoBoundingBox do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_params_spec.rb new file mode 100644 index 000000000000..15a496ce0544 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_type_spec.rb new file mode 100644 index 000000000000..141ae9643faf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_line_string_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_line_string_spec.rb new file mode 100644 index 000000000000..6d2db836fe13 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_line_string_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoLineString do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_point_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_point_spec.rb new file mode 100644 index 000000000000..786477267156 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_point_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoPoint do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_polygon_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_polygon_spec.rb new file mode 100644 index 000000000000..2b50624ee957 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_polygon_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoPolygon do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_radius_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_radius_spec.rb new file mode 100644 index 000000000000..9dff37f61a17 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/geo_radius_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GeoRadius do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection200_response_spec.rb new file mode 100644 index 000000000000..371dbb7b4366 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetCollection200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection_aliases200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection_aliases200_response_spec.rb new file mode 100644 index 000000000000..08b46ee3ea70 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collection_aliases200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetCollectionAliases200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collections200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collections200_response_spec.rb new file mode 100644 index 000000000000..30c6158e40b0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_collections200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetCollections200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_locks200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_locks200_response_spec.rb new file mode 100644 index 000000000000..f579216bc7bf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_locks200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetLocks200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_point200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_point200_response_spec.rb new file mode 100644 index 000000000000..e8a21105ec26 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_point200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetPoint200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_points200_response_spec.rb new file mode 100644 index 000000000000..57ef7b7cea62 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/get_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GetPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/group_id_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/group_id_spec.rb new file mode 100644 index 000000000000..38938f327e1b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/group_id_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GroupId do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/groups_result_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/groups_result_spec.rb new file mode 100644 index 000000000000..1a74c2ff628c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/groups_result_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GroupsResult do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/grpc_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/grpc_telemetry_spec.rb new file mode 100644 index 000000000000..635ee89d6322 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/grpc_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::GrpcTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/has_id_condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/has_id_condition_spec.rb new file mode 100644 index 000000000000..f778447910a9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/has_id_condition_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::HasIdCondition do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_diff_spec.rb new file mode 100644 index 000000000000..0c4319dd66c7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_diff_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::HnswConfigDiff do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_spec.rb new file mode 100644 index 000000000000..9a697ca213d7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/hnsw_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::HnswConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of1_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of1_spec.rb new file mode 100644 index 000000000000..2af447eb6b45 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of1_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IndexesOneOf1 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of_spec.rb new file mode 100644 index 000000000000..5754dc00d68c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IndexesOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_spec.rb new file mode 100644 index 000000000000..b79515a16efe --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/indexes_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Indexes do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/init_from_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/init_from_spec.rb new file mode 100644 index 000000000000..21ac5651a2af --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/init_from_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::InitFrom do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_params_spec.rb new file mode 100644 index 000000000000..a61c9ad9a0da --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IntegerIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_type_spec.rb new file mode 100644 index 000000000000..21555ea4f3ef --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/integer_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IntegerIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_empty_condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_empty_condition_spec.rb new file mode 100644 index 000000000000..8c9c1166fe29 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_empty_condition_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IsEmptyCondition do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_null_condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_null_condition_spec.rb new file mode 100644 index 000000000000..d38d791b72bc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/is_null_condition_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::IsNullCondition do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_params_spec.rb new file mode 100644 index 000000000000..27a1184cb3b9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::KeywordIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_type_spec.rb new file mode 100644 index 000000000000..5f722b2265f1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/keyword_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::KeywordIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/list_snapshots200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/list_snapshots200_response_spec.rb new file mode 100644 index 000000000000..658d30ede6f4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/list_snapshots200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ListSnapshots200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_info_spec.rb new file mode 100644 index 000000000000..5ba4bc6b169c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::LocalShardInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_telemetry_spec.rb new file mode 100644 index 000000000000..f8e37cfc07cf --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/local_shard_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::LocalShardTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/locks_option_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/locks_option_spec.rb new file mode 100644 index 000000000000..fcfd29f64197 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/locks_option_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::LocksOption do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/lookup_location_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/lookup_location_spec.rb new file mode 100644 index 000000000000..98f8709c33e4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/lookup_location_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::LookupLocation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_any_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_any_spec.rb new file mode 100644 index 000000000000..22d9294e780f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_any_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MatchAny do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_except_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_except_spec.rb new file mode 100644 index 000000000000..2d2b7e2694a1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_except_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MatchExcept do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_spec.rb new file mode 100644 index 000000000000..66e92cd48791 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Match do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_text_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_text_spec.rb new file mode 100644 index 000000000000..238dfe4bc14f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_text_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MatchText do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_value_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_value_spec.rb new file mode 100644 index 000000000000..4d5881914725 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/match_value_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MatchValue do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/message_send_errors_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/message_send_errors_spec.rb new file mode 100644 index 000000000000..12762557eb9f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/message_send_errors_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MessageSendErrors do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/min_should_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/min_should_spec.rb new file mode 100644 index 000000000000..19ca3e38a2ff --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/min_should_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MinShould do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/modifier_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/modifier_spec.rb new file mode 100644 index 000000000000..c0746e08b3d7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/modifier_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Modifier do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_operation_spec.rb new file mode 100644 index 000000000000..35f965ebdc34 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MoveShardOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_spec.rb new file mode 100644 index 000000000000..4f9387d5f648 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/move_shard_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MoveShard do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_comparator_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_comparator_spec.rb new file mode 100644 index 000000000000..211de041571e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_comparator_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MultiVectorComparator do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_config_spec.rb new file mode 100644 index 000000000000..a3a60200280f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/multi_vector_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::MultiVectorConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_sparse_vector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_sparse_vector_spec.rb new file mode 100644 index 000000000000..3fb370c0c984 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_sparse_vector_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::NamedSparseVector do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_spec.rb new file mode 100644 index 000000000000..2b216c042f60 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::NamedVector do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_struct_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_struct_spec.rb new file mode 100644 index 000000000000..d62e2c1195d8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/named_vector_struct_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::NamedVectorStruct do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/nearest_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nearest_query_spec.rb new file mode 100644 index 000000000000..a8712869890e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nearest_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::NearestQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_condition_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_condition_spec.rb new file mode 100644 index 000000000000..0dc75c00335a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_condition_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::NestedCondition do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_spec.rb new file mode 100644 index 000000000000..fa8a97ef9493 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/nested_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Nested do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/operation_duration_statistics_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/operation_duration_statistics_spec.rb new file mode 100644 index 000000000000..eb3786901157 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/operation_duration_statistics_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OperationDurationStatistics do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizer_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizer_telemetry_spec.rb new file mode 100644 index 000000000000..7297978543f2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizer_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OptimizerTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_diff_spec.rb new file mode 100644 index 000000000000..c63840faec5a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_diff_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OptimizersConfigDiff do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_spec.rb new file mode 100644 index 000000000000..8be22c9173b6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OptimizersConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_one_of_spec.rb new file mode 100644 index 000000000000..f19ecb04a1de --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OptimizersStatusOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_spec.rb new file mode 100644 index 000000000000..0c8ad99bf221 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/optimizers_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OptimizersStatus do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_interface_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_interface_spec.rb new file mode 100644 index 000000000000..aea881f0cf98 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_interface_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OrderByInterface do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_query_spec.rb new file mode 100644 index 000000000000..a590cb51588c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OrderByQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_spec.rb new file mode 100644 index 000000000000..872bd0196cc9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_by_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OrderBy do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_value_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_value_spec.rb new file mode 100644 index 000000000000..33a8d24440f1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/order_value_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OrderValue do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/overwrite_payload_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/overwrite_payload_operation_spec.rb new file mode 100644 index 000000000000..ab2ef1d36471 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/overwrite_payload_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::OverwritePayloadOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/p2p_config_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/p2p_config_telemetry_spec.rb new file mode 100644 index 000000000000..615d5b0300e5 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/p2p_config_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::P2pConfigTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_schema_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_schema_spec.rb new file mode 100644 index 000000000000..4537d5f105ab --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_schema_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadFieldSchema do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_spec.rb new file mode 100644 index 000000000000..92d251ed8045 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_field_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadField do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_info_spec.rb new file mode 100644 index 000000000000..b424d994ad9a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadIndexInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_telemetry_spec.rb new file mode 100644 index 000000000000..d72543a6f869 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_index_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadIndexTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_params_spec.rb new file mode 100644 index 000000000000..5e5fac12c158 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_params_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadSchemaParams do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_type_spec.rb new file mode 100644 index 000000000000..0798557fc475 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_schema_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadSchemaType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_exclude_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_exclude_spec.rb new file mode 100644 index 000000000000..fabc218af7bc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_exclude_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadSelectorExclude do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_include_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_include_spec.rb new file mode 100644 index 000000000000..8f85386fe35f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_include_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadSelectorInclude do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_spec.rb new file mode 100644 index 000000000000..35a0e3a26e6c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_selector_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadSelector do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of1_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of1_spec.rb new file mode 100644 index 000000000000..2474c4538e5f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of1_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadStorageTypeOneOf1 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of_spec.rb new file mode 100644 index 000000000000..35f59bf7efe2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadStorageTypeOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_spec.rb new file mode 100644 index 000000000000..5d8c45fc2d76 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/payload_storage_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PayloadStorageType do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/peer_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/peer_info_spec.rb new file mode 100644 index 000000000000..b6c43e63fb54 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/peer_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PeerInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_group_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_group_spec.rb new file mode 100644 index 000000000000..bfa02a1dc20b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_group_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointGroup do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_ids_list_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_ids_list_spec.rb new file mode 100644 index 000000000000..7326175a1878 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_ids_list_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointIdsList do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_insert_operations_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_insert_operations_spec.rb new file mode 100644 index 000000000000..8a3a102d0c08 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_insert_operations_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointInsertOperations do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_request_spec.rb new file mode 100644 index 000000000000..3690ac2faf02 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_struct_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_struct_spec.rb new file mode 100644 index 000000000000..775a5bb980ed --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_struct_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointStruct do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_vectors_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_vectors_spec.rb new file mode 100644 index 000000000000..e9c72748dc8b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/point_vectors_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointVectors do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_batch_spec.rb new file mode 100644 index 000000000000..9878b530e178 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointsBatch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_list_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_list_spec.rb new file mode 100644 index 000000000000..0eee6a2e4633 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_list_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointsList do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_selector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_selector_spec.rb new file mode 100644 index 000000000000..471a9a702e83 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/points_selector_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PointsSelector do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_prefetch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_prefetch_spec.rb new file mode 100644 index 000000000000..eec133ad22aa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_prefetch_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::PrefetchPrefetch do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_spec.rb new file mode 100644 index 000000000000..2cffdbaaff68 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/prefetch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Prefetch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_config_spec.rb new file mode 100644 index 000000000000..5bdf1fc0a01c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ProductQuantizationConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_spec.rb new file mode 100644 index 000000000000..704c0ee66763 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/product_quantization_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ProductQuantization do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_diff_spec.rb new file mode 100644 index 000000000000..a90d1a478af3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_diff_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QuantizationConfigDiff do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_spec.rb new file mode 100644 index 000000000000..f667e7733b33 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_config_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QuantizationConfig do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_search_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_search_params_spec.rb new file mode 100644 index 000000000000..e5d13ad8526a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/quantization_search_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QuantizationSearchParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_batch_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_batch_points200_response_spec.rb new file mode 100644 index 000000000000..2c62a780c3d4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_batch_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryBatchPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_groups_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_groups_request_spec.rb new file mode 100644 index 000000000000..f49a5880ab85 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_groups_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryGroupsRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_interface_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_interface_spec.rb new file mode 100644 index 000000000000..ea8710e97e73 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_interface_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryInterface do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_points200_response_spec.rb new file mode 100644 index 000000000000..64f0a11f4430 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_batch_spec.rb new file mode 100644 index 000000000000..f380d60b341f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryRequestBatch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_prefetch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_prefetch_spec.rb new file mode 100644 index 000000000000..77f62eb309de --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_prefetch_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryRequestPrefetch do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_spec.rb new file mode 100644 index 000000000000..9e2ba6ee7ff1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_response_spec.rb new file mode 100644 index 000000000000..1ba235a53341 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::QueryResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_spec.rb new file mode 100644 index 000000000000..30f5e44fd32a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/query_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Query do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/raft_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/raft_info_spec.rb new file mode 100644 index 000000000000..a84ae82b3200 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/raft_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RaftInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_interface_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_interface_spec.rb new file mode 100644 index 000000000000..21e8b9f103c1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_interface_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RangeInterface do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_spec.rb new file mode 100644 index 000000000000..f852365fee03 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/range_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Range do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_spec.rb new file mode 100644 index 000000000000..4bc2cf47302d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReadConsistency do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_type_spec.rb new file mode 100644 index 000000000000..c924408b765c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/read_consistency_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReadConsistencyType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_example_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_example_spec.rb new file mode 100644 index 000000000000..d484125596cc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_example_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendExample do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_groups_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_groups_request_spec.rb new file mode 100644 index 000000000000..ed8359b5767b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_groups_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendGroupsRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_input_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_input_spec.rb new file mode 100644 index 000000000000..b2ad394e20a9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_input_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendInput do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_query_spec.rb new file mode 100644 index 000000000000..f79d203f3eef --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_batch_spec.rb new file mode 100644 index 000000000000..d33f68fa0d0f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendRequestBatch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_spec.rb new file mode 100644 index 000000000000..162dae5a6f8e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_strategy_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_strategy_spec.rb new file mode 100644 index 000000000000..a72670592cf6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recommend_strategy_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecommendStrategy do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/record_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/record_spec.rb new file mode 100644 index 000000000000..a8d0a1fe8357 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/record_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Record do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.rb new file mode 100644 index 000000000000..9de80f83f7f3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RecoverFromUploadedSnapshot202Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_info_spec.rb new file mode 100644 index 000000000000..3b3d702f33c2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RemoteShardInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_telemetry_spec.rb new file mode 100644 index 000000000000..d37fe41e7d20 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/remote_shard_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RemoteShardTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_operation_spec.rb new file mode 100644 index 000000000000..59401b0c04f1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RenameAliasOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_spec.rb new file mode 100644 index 000000000000..b019e54e9581 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/rename_alias_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RenameAlias do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_set_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_set_telemetry_spec.rb new file mode 100644 index 000000000000..2ae84d1644c0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_set_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReplicaSetTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_spec.rb new file mode 100644 index 000000000000..9cc2e3bba13a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Replica do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_state_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_state_spec.rb new file mode 100644 index 000000000000..be181b4da97c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replica_state_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReplicaState do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_operation_spec.rb new file mode 100644 index 000000000000..80393879ead8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReplicateShardOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_spec.rb new file mode 100644 index 000000000000..5ed71fcec6cd --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/replicate_shard_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReplicateShard do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/requests_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/requests_telemetry_spec.rb new file mode 100644 index 000000000000..b32e80b49d49 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/requests_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RequestsTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_direction_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_direction_spec.rb new file mode 100644 index 000000000000..5cc08537ac0e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_direction_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReshardingDirection do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_info_spec.rb new file mode 100644 index 000000000000..3fb4e9faf1cb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/resharding_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ReshardingInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_operation_spec.rb new file mode 100644 index 000000000000..fe52c307e09b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RestartTransferOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_spec.rb new file mode 100644 index 000000000000..9d90a52680de --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/restart_transfer_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RestartTransfer do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/running_environment_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/running_environment_telemetry_spec.rb new file mode 100644 index 000000000000..65f01c411178 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/running_environment_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::RunningEnvironmentTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_query_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_query_spec.rb new file mode 100644 index 000000000000..7015907ae2a3 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_query_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SampleQuery do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_spec.rb new file mode 100644 index 000000000000..01e09f092f29 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sample_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Sample do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_config_spec.rb new file mode 100644 index 000000000000..4f0929ab7da8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScalarQuantizationConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_spec.rb new file mode 100644 index 000000000000..c07288ee0a46 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_quantization_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScalarQuantization do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_type_spec.rb new file mode 100644 index 000000000000..42392c0d775a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scalar_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScalarType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scored_point_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scored_point_spec.rb new file mode 100644 index 000000000000..2a7390171c59 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scored_point_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScoredPoint do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_points200_response_spec.rb new file mode 100644 index 000000000000..e78404d8ad5e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScrollPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_request_spec.rb new file mode 100644 index 000000000000..12a75df08f67 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScrollRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_result_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_result_spec.rb new file mode 100644 index 000000000000..ba7bf10be4d4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/scroll_result_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ScrollResult do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_batch_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_batch_points200_response_spec.rb new file mode 100644 index 000000000000..b11706d378aa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_batch_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchBatchPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_groups_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_groups_request_spec.rb new file mode 100644 index 000000000000..159c3fdfc2fb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_groups_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchGroupsRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets200_response_spec.rb new file mode 100644 index 000000000000..6c9dc3c98b46 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixOffsets200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets_response_spec.rb new file mode 100644 index 000000000000..9aedaf748771 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_offsets_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixOffsetsResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pair_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pair_spec.rb new file mode 100644 index 000000000000..a4cd41791d2a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pair_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixPair do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs200_response_spec.rb new file mode 100644 index 000000000000..9113a46de949 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixPairs200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs_response_spec.rb new file mode 100644 index 000000000000..9ee92db7b039 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_pairs_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixPairsResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_request_spec.rb new file mode 100644 index 000000000000..2feea24e74ce --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_matrix_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchMatrixRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_params_spec.rb new file mode 100644 index 000000000000..c3dd41cd3c3e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_point_groups200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_point_groups200_response_spec.rb new file mode 100644 index 000000000000..72bdc58d2006 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_point_groups200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchPointGroups200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_points200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_points200_response_spec.rb new file mode 100644 index 000000000000..129c4958e81c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_points200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchPoints200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_batch_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_batch_spec.rb new file mode 100644 index 000000000000..0a5328a758c7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_batch_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchRequestBatch do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_spec.rb new file mode 100644 index 000000000000..6a9e71bb5f6c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/search_request_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SearchRequest do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_config_spec.rb new file mode 100644 index 000000000000..535193d2cf5d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SegmentConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_info_spec.rb new file mode 100644 index 000000000000..b1d9cb931ade --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SegmentInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_telemetry_spec.rb new file mode 100644 index 000000000000..ed5b45e354c2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SegmentTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_type_spec.rb new file mode 100644 index 000000000000..e2804ffb2fb9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/segment_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SegmentType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_operation_spec.rb new file mode 100644 index 000000000000..90a0e726bd04 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SetPayloadOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_spec.rb new file mode 100644 index 000000000000..b15cbc1e8870 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/set_payload_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SetPayload do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_selector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_selector_spec.rb new file mode 100644 index 000000000000..7ef11ef0a03e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_selector_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardKeySelector do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_spec.rb new file mode 100644 index 000000000000..a28eab1239b7 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_key_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardKey do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_location_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_location_spec.rb new file mode 100644 index 000000000000..96daf0955794 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_location_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardSnapshotLocation do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_recover_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_recover_spec.rb new file mode 100644 index 000000000000..b38faa487bf6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_snapshot_recover_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardSnapshotRecover do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_status_spec.rb new file mode 100644 index 000000000000..19b913a81929 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardStatus do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_info_spec.rb new file mode 100644 index 000000000000..fe4e7659165b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardTransferInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_method_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_method_spec.rb new file mode 100644 index 000000000000..69a8f6069793 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/shard_transfer_method_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardTransferMethod do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sharding_method_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sharding_method_spec.rb new file mode 100644 index 000000000000..631a5b51c017 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sharding_method_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ShardingMethod do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_description_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_description_spec.rb new file mode 100644 index 000000000000..e7219846fac2 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_description_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SnapshotDescription do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_priority_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_priority_spec.rb new file mode 100644 index 000000000000..bdcbce544cd4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_priority_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SnapshotPriority do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_recover_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_recover_spec.rb new file mode 100644 index 000000000000..c4031e49fe30 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/snapshot_recover_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SnapshotRecover do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_config_spec.rb new file mode 100644 index 000000000000..3452fab55c70 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseIndexConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_params_spec.rb new file mode 100644 index 000000000000..5bedef606051 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_type_spec.rb new file mode 100644 index 000000000000..8cbac7bf0517 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_data_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_data_config_spec.rb new file mode 100644 index 000000000000..9857debe876c --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_data_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseVectorDataConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_params_spec.rb new file mode 100644 index 000000000000..50d0a5df5880 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseVectorParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_spec.rb new file mode 100644 index 000000000000..10f1edd346c9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/sparse_vector_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::SparseVector do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/start_from_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/start_from_spec.rb new file mode 100644 index 000000000000..c42142cc50ba --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/start_from_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::StartFrom do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/state_role_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/state_role_spec.rb new file mode 100644 index 000000000000..a9be77424354 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/state_role_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::StateRole do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry200_response_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry200_response_spec.rb new file mode 100644 index 000000000000..4875d15f341e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry200_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Telemetry200Response do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry_data_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry_data_spec.rb new file mode 100644 index 000000000000..0937005490ff --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/telemetry_data_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TelemetryData do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_params_spec.rb new file mode 100644 index 000000000000..55ce5339e9f1 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TextIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_type_spec.rb new file mode 100644 index 000000000000..61fd55df01ac --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/text_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TextIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/tokenizer_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tokenizer_type_spec.rb new file mode 100644 index 000000000000..650aa2a48f2d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tokenizer_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TokenizerType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of1_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of1_spec.rb new file mode 100644 index 000000000000..f488bccc0f65 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of1_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TrackerStatusOneOf1 do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of_spec.rb new file mode 100644 index 000000000000..17459b5676fe --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_one_of_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TrackerStatusOneOf do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_spec.rb new file mode 100644 index 000000000000..101d29e45f4b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TrackerStatus do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_telemetry_spec.rb new file mode 100644 index 000000000000..a0c48de4316d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/tracker_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::TrackerTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_collection_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_collection_spec.rb new file mode 100644 index 000000000000..690c0e2860ec --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_collection_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateCollection do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operation_spec.rb new file mode 100644 index 000000000000..af0e2922e482 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operation_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateOperation do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operations_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operations_spec.rb new file mode 100644 index 000000000000..18b2ea9e8024 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_operations_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateOperations do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_result_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_result_spec.rb new file mode 100644 index 000000000000..9aba6b1999f4 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_result_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateResult do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_status_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_status_spec.rb new file mode 100644 index 000000000000..80b9ecaedf0a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_status_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateStatus do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_operation_spec.rb new file mode 100644 index 000000000000..a557b7b376c6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateVectorsOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_spec.rb new file mode 100644 index 000000000000..78c641a23d78 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/update_vectors_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpdateVectors do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/upsert_operation_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/upsert_operation_spec.rb new file mode 100644 index 000000000000..e6848a1f98a9 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/upsert_operation_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UpsertOperation do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_params_spec.rb new file mode 100644 index 000000000000..d816487a2f2b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UuidIndexParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_type_spec.rb new file mode 100644 index 000000000000..897b61f52a8a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/uuid_index_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::UuidIndexType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/value_variants_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/value_variants_spec.rb new file mode 100644 index 000000000000..4f96a08803aa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/value_variants_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ValueVariants do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/values_count_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/values_count_spec.rb new file mode 100644 index 000000000000..fa53d189229e --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/values_count_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::ValuesCount do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_config_spec.rb new file mode 100644 index 000000000000..48420a1981a6 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorDataConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_info_spec.rb new file mode 100644 index 000000000000..64ac77b8ed68 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_data_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorDataInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_index_searches_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_index_searches_telemetry_spec.rb new file mode 100644 index 000000000000..1b3f709e90ee --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_index_searches_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorIndexSearchesTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_input_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_input_spec.rb new file mode 100644 index 000000000000..fe12c23d1a57 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_input_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorInput do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_diff_spec.rb new file mode 100644 index 000000000000..dd3942996e61 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_diff_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorParamsDiff do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_spec.rb new file mode 100644 index 000000000000..4201ca18a1fc --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_params_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorParams do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_spec.rb new file mode 100644 index 000000000000..3225848b051f --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::Vector do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_datatype_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_datatype_spec.rb new file mode 100644 index 000000000000..28454908a783 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_datatype_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorStorageDatatype do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_type_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_type_spec.rb new file mode 100644 index 000000000000..0f3adfb79e7a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_storage_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorStorageType do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_struct_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_struct_spec.rb new file mode 100644 index 000000000000..e92dcc9f9f39 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vector_struct_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorStruct do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/vectors_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vectors_config_spec.rb new file mode 100644 index 000000000000..7d82ab3feadb --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/vectors_config_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VectorsConfig do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/version_info_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/version_info_spec.rb new file mode 100644 index 000000000000..6afc1dc80b9d --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/version_info_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::VersionInfo do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_diff_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_diff_spec.rb new file mode 100644 index 000000000000..364b6219e47a --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_diff_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WalConfigDiff do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_spec.rb new file mode 100644 index 000000000000..322c76eeab7b --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/wal_config_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WalConfig do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/web_api_telemetry_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/web_api_telemetry_spec.rb new file mode 100644 index 000000000000..a6c962a0b4b8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/web_api_telemetry_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WebApiTelemetry do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_interface_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_interface_spec.rb new file mode 100644 index 000000000000..4b00d98843b8 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_interface_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WithLookupInterface do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_spec.rb new file mode 100644 index 000000000000..c67e2d78c029 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_lookup_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WithLookup do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_payload_interface_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_payload_interface_spec.rb new file mode 100644 index 000000000000..932690f2f1ca --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_payload_interface_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WithPayloadInterface do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_vector_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_vector_spec.rb new file mode 100644 index 000000000000..dd034cba21fa --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/with_vector_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WithVector do + it 'exposes its candidate types' do + expect(described_class::CANDIDATES).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/models/write_ordering_spec.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/models/write_ordering_spec.rb new file mode 100644 index 000000000000..12a8f62dfaf0 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/models/write_ordering_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Qdrant::Models::WriteOrdering do + it 'lists its known values' do + expect(described_class.all).not_to be_empty + end +end diff --git a/samples/client/others/ruby-idiomatic-qdrant/spec/spec_helper.rb b/samples/client/others/ruby-idiomatic-qdrant/spec/spec_helper.rb new file mode 100644 index 000000000000..b8913ae58b80 --- /dev/null +++ b/samples/client/others/ruby-idiomatic-qdrant/spec/spec_helper.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'simplecov' + +SimpleCov.start do + add_filter '/spec/' +end + +RSpec.configure do |config| + config.color = true + config.fail_fast = false + + config.order = :random + Kernel.srand config.seed + + config.expect_with :rspec do |c| + c.syntax = :expect + end + + # disable monkey patching + # see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode + config.disable_monkey_patching! + + config.raise_errors_for_deprecations! +end + +require 'qdrant' diff --git a/samples/client/petstore/ruby-idiomatic/.github/workflows/ci.yml b/samples/client/petstore/ruby-idiomatic/.github/workflows/ci.yml new file mode 100644 index 000000000000..b1a33a852771 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +--- +name: CI + +# Minimal token permissions: only source checkout is needed (works on private repos too). +permissions: + contents: read + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + # Run workflow manually + workflow_dispatch: + +jobs: + rubocop: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Rubocop + run: bundle exec rubocop + + rspec: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + ruby: + - '4.0' + - '3.4' + - '3.3' + - '3.2' + - '3.1' + - '3.0' + - 'jruby' + - 'truffleruby' + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + # JRuby 10.x is built for Java 21; the runner ships an older default JDK. + - name: Setup Java + if: startsWith(matrix.ruby, 'jruby') + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Run RSpec + run: bundle exec rspec diff --git a/samples/client/petstore/ruby-idiomatic/.gitignore b/samples/client/petstore/ruby-idiomatic/.gitignore new file mode 100644 index 000000000000..e6682f5f9248 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.gitignore @@ -0,0 +1,11 @@ +# Bundler +/.bundle/ +Gemfile.lock + +# Built gem packages +/pkg/ +*.gem + +# Temporary and generated files +/tmp/ +/coverage/ diff --git a/samples/client/petstore/ruby-idiomatic/.openapi-generator-ignore b/samples/client/petstore/ruby-idiomatic/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/ruby-idiomatic/.openapi-generator/FILES b/samples/client/petstore/ruby-idiomatic/.openapi-generator/FILES new file mode 100644 index 000000000000..074cb58bd6cc --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.openapi-generator/FILES @@ -0,0 +1,32 @@ +.github/workflows/ci.yml +.gitignore +.rspec +.rubocop.yml +Gemfile +LICENSE +README.md +Rakefile +bin/rspec +bin/rubocop +lib/petstore.rb +lib/petstore/api/pet.rb +lib/petstore/api/store.rb +lib/petstore/api/store/order.rb +lib/petstore/api/user.rb +lib/petstore/api_error.rb +lib/petstore/client.rb +lib/petstore/configuration.rb +lib/petstore/connection.rb +lib/petstore/models/api_response.rb +lib/petstore/models/category.rb +lib/petstore/models/order.rb +lib/petstore/models/pet.rb +lib/petstore/models/tag.rb +lib/petstore/models/user.rb +lib/petstore/polymorphism.rb +lib/petstore/response.rb +lib/petstore/serializable.rb +lib/petstore/validations.rb +lib/petstore/version.rb +petstore.gemspec +spec/spec_helper.rb diff --git a/samples/client/petstore/ruby-idiomatic/.openapi-generator/VERSION b/samples/client/petstore/ruby-idiomatic/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/ruby-idiomatic/.rspec b/samples/client/petstore/ruby-idiomatic/.rspec new file mode 100644 index 000000000000..372b5acf8cf1 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.rspec @@ -0,0 +1 @@ +--warnings diff --git a/samples/client/petstore/ruby-idiomatic/.rubocop.yml b/samples/client/petstore/ruby-idiomatic/.rubocop.yml new file mode 100644 index 000000000000..4d84dc6aa16f --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/.rubocop.yml @@ -0,0 +1,123 @@ +--- +plugins: + - rubocop-performance + - rubocop-rake + - rubocop-rspec + +AllCops: + NewCops: enable + TargetRubyVersion: 3.0 + SuggestExtensions: false + # Merge our exclusions with RuboCop's defaults (vendor/**/*, etc.) instead of + # replacing them. + inherit_mode: + merge: + - Exclude + Exclude: + # Zeitwerk entry point: intentionally thin and can't be reorganized further. + - lib/petstore.rb + # Bundler binstubs (if generated) are not our code to lint. + - bin/* + +Gemspec/RequireMFA: + Enabled: false + +######### +# STYLE # +######### + +Style/Documentation: + Enabled: false + +# The generated code uses `module Petstore` + nested class, a valid idiom RuboCop's +# nested/compact binary does not model, and which is required for sibling-constant lexical scope. +Style/ClassAndModuleChildren: + Enabled: false + +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma + +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma + +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Generated `pattern:` regexes are copied verbatim from the OpenAPI document's +# `pattern` keyword; escapes that look redundant inside a character class may +# be exactly what the spec author intended, so this gem does not rewrite them. +Style/RedundantRegexpEscape: + Enabled: false + +# Generated `enum:` arrays hold arbitrary spec-supplied string values (which +# may contain whitespace or other characters unsafe for a bare %w literal), +# so plain string arrays are kept instead of switching per-array based on +# content. +Style/WordArray: + Enabled: false + +# Operations whose operationId collides with a sibling (once camelized) get a +# numeric suffix (`_1`, `_2`, ...) from OpenAPI Generator's own operationId +# de-duplication, driven by the source document rather than this gem. +Naming/VariableNumber: + Enabled: false + +########## +# LAYOUT # +########## + +# Method-call/attribute continuation lines use a fixed extra indent rather +# than aligning to the first argument's column, since the column position +# would otherwise vary with every generated method/attribute name. +Layout/ArgumentAlignment: + EnforcedStyle: with_fixed_indentation + +Layout/HashAlignment: + EnforcedColonStyle: key + EnforcedHashRocketStyle: key + +# Generated hashes (query params, attribute maps) are mechanically emitted and legitimately long. +Layout/LineLength: + Enabled: false + +########### +# METRICS # +########### + +# Generated models/APIs mirror the shape of the OpenAPI document they were +# generated from -- a schema with many properties or an API with many +# operations legitimately produces a large class/method. Rather than chase +# generated-code-only offenses forever, the Metrics department is tuned very +# generously (effectively off) for this generated gem; genuine style cops +# above stay on. +Metrics: + Enabled: false + +######### +# RSPEC # +######### + +# Generated specs are intentionally repetitive/thin smoke tests over +# generated models and APIs; relax the cops that assume hand-written, +# example-per-behavior specs. +RSpec/ExampleLength: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/MultipleMemoizedHelpers: + Enabled: false + +RSpec/NestedGroups: + Enabled: false + +RSpec/DescribeClass: + Enabled: false + +# The generated spec tree intentionally omits an extra top-level directory +# named after the gem (spec/api/..., not spec//api/...) since the +# whole spec/ directory is already gem-scoped; that layout choice is a +# permanent mismatch with this cop's naming convention. +RSpec/SpecFilePathFormat: + Enabled: false diff --git a/samples/client/petstore/ruby-idiomatic/Gemfile b/samples/client/petstore/ruby-idiomatic/Gemfile new file mode 100644 index 000000000000..13f7bcbba8ef --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/Gemfile @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake' + gem 'rspec', '~> 3.6' + gem 'simplecov', require: false + + # Linter / static analysis + gem 'rubocop', require: false + gem 'rubocop-performance', require: false + gem 'rubocop-rake', require: false + gem 'rubocop-rspec', require: false +end diff --git a/samples/client/petstore/ruby-idiomatic/LICENSE b/samples/client/petstore/ruby-idiomatic/LICENSE new file mode 100644 index 000000000000..fdddb29aa445 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/samples/client/petstore/ruby-idiomatic/README.md b/samples/client/petstore/ruby-idiomatic/README.md new file mode 100644 index 000000000000..44f5754c89b2 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/README.md @@ -0,0 +1,126 @@ +# petstore + +Ruby client for **OpenAPI Petstore**. Generated by [OpenAPI Generator](https://openapi-generator.tech) (`ruby-idiomatic`). + +- Requires Ruby >= 3.0 +- HTTP via [Faraday](https://github.com/lostisland/faraday) +- Lazy class loading via [Zeitwerk](https://github.com/fxn/zeitwerk) + +## Installation + +Add to your `Gemfile`: + +```ruby +gem "petstore" +``` + +then run `bundle install`. Or install it directly: + +```sh +gem install petstore +``` + +## Getting started + +```ruby +require "petstore" + +client = Petstore::Client.new(base_url: "http://petstore.swagger.io/v2") + +# Operations are grouped into namespaced sub-clients that mirror the API's +# resources, so a call reads as `client..`: +# +# response = client..(some_param: "value") +# response.data # => the deserialized model (or Array of models) +# response.status # => the HTTP status code +# response.headers # => the response headers +# +# The response delegates to `data`, so you can iterate/index it directly: +# +# response.each { |item| ... } +``` + +## Configuration + +`Client.new` takes a base URL plus options, or a configuration block. Each client +owns its own `Configuration` and `Connection`, so several independent clients can +coexist in the same process — there is no global state. + +```ruby +client = Petstore::Client.new(base_url: "http://petstore.swagger.io/v2") do |config| + config.timeout = 10 + config.api_key = "YOUR_API_KEY" +end +``` + +## Error handling + +Every non-2xx response and every transport/network error is raised as a single +`Petstore::ApiError`: + +```ruby +begin + client.. +rescue Petstore::ApiError => e + e.status # => HTTP status code (nil for a transport error) + e.body # => the raw response body + e.headers # => the response headers +end +``` + +## Custom middleware / request signing + +Static credentials (`apiKey`, `bearer`, `basic`) are handled from the OpenAPI spec. +A **request signature** — a hash computed per request over the method, full URL, body +and a timestamp (OVH, AWS SigV4, RFC 9421, ...) — cannot be modeled as an OpenAPI +security scheme, so it is registered as a Faraday middleware via `config.use`. Your +middleware runs after the built-in request middleware (it sees the serialized body and +final URL) and just before the adapter: + +```ruby +require "digest/sha1" + +class OvhSignature < Faraday::Middleware + def initialize(app, app_key:, app_secret:, consumer_key:) + super(app) + @app_key = app_key + @app_secret = app_secret + @consumer_key = consumer_key + end + + def on_request(env) + ts = Time.now.to_i.to_s + url = env.url.to_s + sig = "$1$" + Digest::SHA1.hexdigest( + [@app_secret, @consumer_key, env.method.to_s.upcase, url, env.body.to_s, ts].join("+") + ) + env.request_headers.merge!( + "X-Ovh-Application" => @app_key, + "X-Ovh-Consumer" => @consumer_key, + "X-Ovh-Timestamp" => ts, + "X-Ovh-Signature" => sig + ) + end +end + +client = Petstore::Client.new(base_url: "http://petstore.swagger.io/v2") do |config| + config.use(OvhSignature, app_key: "...", app_secret: "...", consumer_key: "...") +end +``` + +`config.use` returns `self`, so calls can be chained. Middlewares run in registration +order; computing the full URL (with query string) from `env.url` / `env.params` is the +middleware's responsibility. + +## Threaded servers + +Class loading is lazy. Under a threaded server (Puma, etc.), eager-load once at +boot so autoloading never happens across threads: + +```ruby +Petstore.eager_load! +``` + +## License + +`unlicense` diff --git a/samples/client/petstore/ruby-idiomatic/Rakefile b/samples/client/petstore/ruby-idiomatic/Rakefile new file mode 100644 index 000000000000..82bb534a7463 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec diff --git a/samples/client/petstore/ruby-idiomatic/bin/rspec b/samples/client/petstore/ruby-idiomatic/bin/rspec new file mode 100644 index 000000000000..93e191c2ff7e --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/bin/rspec @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/samples/client/petstore/ruby-idiomatic/bin/rubocop b/samples/client/petstore/ruby-idiomatic/bin/rubocop new file mode 100644 index 000000000000..d73598dc2283 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/bin/rubocop @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore.rb new file mode 100644 index 000000000000..19e492b7a84c --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +require 'erb' +require 'forwardable' +require 'json' +require 'time' + +require 'faraday' +require 'faraday/multipart' +require 'zeitwerk' + +module Petstore + class << self + attr_reader :loader + end + + @loader = Zeitwerk::Loader.for_gem + # The `api/` directory on disk is fixed regardless of the `apiNamespace` CliOption, + # but api.mustache only nests classes under an `Api` module when the wrapper is + # enabled (true). When it's disabled, tell Zeitwerk to collapse + # that directory so it doesn't expect a `Petstore::Api` namespace that the + # generated classes never actually define. + @loader.setup + + def self.eager_load! + @loader.eager_load + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/api/pet.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/pet.rb new file mode 100644 index 000000000000..02923c4cabee --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/pet.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +module Petstore + module Api + class Pet + def initialize(connection) + @connection = connection + end + + def bulk_update(pet:) + raise ArgumentError, 'pet is required' if pet.nil? + + @connection.call( + :PUT, + '/pet', + type: Petstore::Models::Pet, + auth: ['petstore_auth'], + body: pet + ) + end + + def create(pet:) + raise ArgumentError, 'pet is required' if pet.nil? + + @connection.call( + :POST, + '/pet', + type: Petstore::Models::Pet, + auth: ['petstore_auth'], + body: pet + ) + end + + def create_post(pet_id:, name: nil, status: nil) + raise ArgumentError, 'pet_id is required' if pet_id.nil? + + @connection.call( + :POST, + '/pet/{petId}' + .gsub('{petId}', ERB::Util.url_encode(pet_id.to_s)), + type: nil, + auth: ['petstore_auth'], + form: { 'name' => name, 'status' => status } + ) + end + + def delete(pet_id:, api_key: nil) + raise ArgumentError, 'pet_id is required' if pet_id.nil? + + @connection.call( + :DELETE, + '/pet/{petId}' + .gsub('{petId}', ERB::Util.url_encode(pet_id.to_s)), + type: nil, + auth: ['petstore_auth'], + headers: { 'api_key' => api_key } + ) + end + + def find_by_status(status:) + raise ArgumentError, 'status is required' if status.nil? + + @connection.call( + :GET, + '/pet/findByStatus', + type: [Petstore::Models::Pet], + auth: ['petstore_auth'], + query: { 'status' => status } + ) + end + + def find_by_tags(tags:) + raise ArgumentError, 'tags is required' if tags.nil? + + @connection.call( + :GET, + '/pet/findByTags', + type: [Petstore::Models::Pet], + auth: ['petstore_auth'], + query: { 'tags' => tags } + ) + end + + def get(pet_id:) + raise ArgumentError, 'pet_id is required' if pet_id.nil? + + @connection.call( + :GET, + '/pet/{petId}' + .gsub('{petId}', ERB::Util.url_encode(pet_id.to_s)), + type: Petstore::Models::Pet, + auth: ['api_key'] + ) + end + + def upload_image(pet_id:, additional_metadata: nil, file: nil) + raise ArgumentError, 'pet_id is required' if pet_id.nil? + + @connection.call( + :POST, + '/pet/{petId}/uploadImage' + .gsub('{petId}', ERB::Util.url_encode(pet_id.to_s)), + type: Petstore::Models::ApiResponse, + auth: ['petstore_auth'], + form: { 'additionalMetadata' => additional_metadata, 'file' => file } + ) + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store.rb new file mode 100644 index 000000000000..c72e12aeaf6b --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Petstore + module Api + class Store + def initialize(connection) + @connection = connection + end + + def inventory + @connection.call( + :GET, + '/store/inventory', + type: nil, + auth: ['api_key'] + ) + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store/order.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store/order.rb new file mode 100644 index 000000000000..e1f639ef3dea --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/store/order.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Petstore + module Api + class Store::Order + def initialize(connection) + @connection = connection + end + + def create(order:) + raise ArgumentError, 'order is required' if order.nil? + + @connection.call( + :POST, + '/store/order', + type: Petstore::Models::Order, + auth: [], + body: order + ) + end + + def delete(order_id:) + raise ArgumentError, 'order_id is required' if order_id.nil? + + @connection.call( + :DELETE, + '/store/order/{orderId}' + .gsub('{orderId}', ERB::Util.url_encode(order_id.to_s)), + type: nil, + auth: [] + ) + end + + def get(order_id:) + raise ArgumentError, 'order_id is required' if order_id.nil? + + @connection.call( + :GET, + '/store/order/{orderId}' + .gsub('{orderId}', ERB::Util.url_encode(order_id.to_s)), + type: Petstore::Models::Order, + auth: [] + ) + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/api/user.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/user.rb new file mode 100644 index 000000000000..ffffc27c3550 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/api/user.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module Petstore + module Api + class User + def initialize(connection) + @connection = connection + end + + def create(user:) + raise ArgumentError, 'user is required' if user.nil? + + @connection.call( + :POST, + '/user', + type: nil, + auth: ['api_key'], + body: user + ) + end + + def create_with_array(user:) + raise ArgumentError, 'user is required' if user.nil? + + @connection.call( + :POST, + '/user/createWithArray', + type: nil, + auth: ['api_key'], + body: user + ) + end + + def create_with_list(user:) + raise ArgumentError, 'user is required' if user.nil? + + @connection.call( + :POST, + '/user/createWithList', + type: nil, + auth: ['api_key'], + body: user + ) + end + + def delete(username:) + raise ArgumentError, 'username is required' if username.nil? + + @connection.call( + :DELETE, + '/user/{username}' + .gsub('{username}', ERB::Util.url_encode(username.to_s)), + type: nil, + auth: ['api_key'] + ) + end + + def get(username:) + raise ArgumentError, 'username is required' if username.nil? + + @connection.call( + :GET, + '/user/{username}' + .gsub('{username}', ERB::Util.url_encode(username.to_s)), + type: Petstore::Models::User, + auth: [] + ) + end + + def login(username:, password:) + raise ArgumentError, 'username is required' if username.nil? + raise ArgumentError, 'password is required' if password.nil? + + @connection.call( + :GET, + '/user/login', + type: nil, + auth: [], + query: { 'username' => username, 'password' => password } + ) + end + + def logout + @connection.call( + :GET, + '/user/logout', + type: nil, + auth: ['api_key'] + ) + end + + def update(username:, user:) + raise ArgumentError, 'username is required' if username.nil? + raise ArgumentError, 'user is required' if user.nil? + + @connection.call( + :PUT, + '/user/{username}' + .gsub('{username}', ERB::Util.url_encode(username.to_s)), + type: nil, + auth: ['api_key'], + body: user + ) + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/api_error.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/api_error.rb new file mode 100644 index 000000000000..eb50ab304cb4 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/api_error.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Petstore + class ApiError < StandardError + attr_reader :status, :headers, :body, :response + + def initialize(message = nil, status: nil, headers: nil, body: nil, response: nil) + @status = status + @headers = headers + @body = body + @response = response + super(message || "HTTP #{status}") + end + + def self.from(response) + new(status: response.status, headers: response.headers, body: response.body, response: response) + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/client.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/client.rb new file mode 100644 index 000000000000..9f2bc360ef68 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/client.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Petstore + class Client + attr_reader :configuration, :connection + + def initialize(base_url: nil, **options, &block) + @configuration = Configuration.new(base_url: base_url, **options, &block) + @connection = Connection.new(@configuration) + end + + def pet + @pet ||= Petstore::Api::Pet.new(@connection) + end + + def store + @store ||= Petstore::Api::Store.new(@connection) + end + + def user + @user ||= Petstore::Api::User.new(@connection) + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/configuration.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/configuration.rb new file mode 100644 index 000000000000..d83fb7235dd3 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/configuration.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module Petstore + class Configuration + attr_accessor :base_url, :timeout, :logger, :debugging, :query_array_encoding, :api_key + + def initialize(base_url: nil, **options) + @base_url = base_url || 'http://petstore.swagger.io/v2' + @timeout = 60 + @query_array_encoding = :repeat + @debugging = false + @middlewares = [] + options.each do |k, v| + raise ArgumentError, "unknown configuration option: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + yield self if block_given? + end + + def configure_faraday(conn) + # Order matters: :multipart / :url_encoded must run before :json so form calls + # (Connection#call `form:`) get encoded first -- Connection#call pins the + # Content-Type to "application/json" up front on non-form calls, so these two + # middlewares' own (weaker) content-type guards correctly no-op on JSON bodies. + conn.request :multipart + conn.request :url_encoded + conn.request :json + conn.response :json, content_type: /\bjson$/ + conn.options.timeout = timeout + conn.response :logger, logger if logger && debugging + @middlewares.each { |mw, mw_args, mw_block| conn.use(mw, *mw_args, &mw_block) } + conn.adapter Faraday.default_adapter + end + + # Applies authentication credentials to a single request's headers and query + # params. Called by Connection#call on EVERY request (not baked into the + # persistent Faraday connection at build time) so credential rotation -- + # token refresh, a new api_key -- takes effect on the very next call. + # `auth_names` are the security schemes the current operation actually declares (empty + # for `security: []` public endpoints); only those are applied, so credentials never + # leak to public endpoints nor stack conflicting Authorization headers. + # rubocop:disable Lint/UnusedMethodArgument -- headers/query/auth_names form the fixed + # per-request auth interface (Connection#call); a given generated client may exercise + # only some of them (e.g. no query-based key, or no auth method at all). + def apply_auth(headers, query, auth_names) + headers['api_key'] = api_key if api_key && auth_names.include?('api_key') + nil + end + # rubocop:enable Lint/UnusedMethodArgument + + # Register a Faraday middleware to run on every request, after the built-in + # request middleware (so it sees the serialized body and final URL) and just + # before the adapter. Use for request signing (OVH, AWS SigV4, ...). + def use(middleware, *args, &block) + @middlewares << [middleware, args, block] + self + end + + def encode_array(values) + case query_array_encoding + when :csv then values.join(',') + else values + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/connection.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/connection.rb new file mode 100644 index 000000000000..419de06b29f6 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/connection.rb @@ -0,0 +1,118 @@ +# frozen_string_literal: true + +module Petstore + # The single HTTP choke-point. Every operation goes through `call`. + class Connection + def initialize(configuration) + @configuration = configuration + # Force a trailing slash so a base_url that itself carries a path prefix + # (e.g. "https://api.ovh.com/1.0") is preserved: request paths are made + # relative (their leading slash is stripped in #call) and resolved against it. + base = configuration.base_url + base += '/' unless base.end_with?('/') + @faraday = Faraday.new(url: base) do |conn| + configuration.configure_faraday(conn) + end + end + + # `body` (JSON) and `form` (urlencoded/multipart) are mutually exclusive -- an + # operation has either a request body or form params, never both. + def call(method, path, type: nil, auth: [], query: {}, headers: {}, body: nil, form: nil) + # Faraday's `run_request` only accepts lowercase method symbols; api.mustache + # emits the readable uppercase form (e.g. `:GET`), so normalize it here. + method = method.to_s.downcase.to_sym + # Make the path relative so Faraday resolves it against the (slash-terminated) + # base_url without discarding any base path prefix. + path = path.sub(%r{\A/+}, '') + request_headers = merge_headers(headers) + request_query = query.compact.transform_keys(&:to_s) + # Only the auth schemes the operation actually declares are applied, so credentials + # never leak to endpoints with `security: []` nor stack conflicting Authorization + # headers on operations that accept only one of several schemes. + @configuration.apply_auth(request_headers, request_query, auth) + request_body = + if form + wrap_form(form) + else + # Pin the content type ourselves so the `:multipart`/`:url_encoded` request + # middlewares (registered ahead of `:json` in Configuration#configure_faraday + # so form calls can be encoded before `:json` sees them) do not mistake a + # plain JSON Hash/Array body for a form payload -- both only skip a request + # once its Content-Type is set to something other than what they handle. + request_headers['Content-Type'] ||= 'application/json' unless body.nil? + serialize_body(body) + end + + response = @faraday.run_request(method, path, request_body, request_headers) do |req| + req.params.update(encode_query(request_query)) + end + raise ApiError.from(response) unless response.success? + + Response.new(data: deserialize(response.body, type), status: response.status, headers: response.headers) + rescue Faraday::Error => e + # Ruby sets #cause automatically to `e` when raising inside a rescue block. + raise ApiError, e.message + end + + private + + def serialize_body(body) + return nil if body.nil? + + body.respond_to?(:to_body) ? body.to_body : body + end + + def merge_headers(headers) + headers.compact.transform_keys(&:to_s) + end + + def encode_query(query) + query.compact.each_with_object({}) do |(k, v), out| + out[k.to_s] = v.is_a?(Array) ? @configuration.encode_array(v) : v + end + end + + # Drops nil form values and wraps bare IO-like values (e.g. a plain `File.open(...)`) + # in a `Faraday::Multipart::FilePart` so the `:multipart` middleware's file + # detection (which looks for `:content_type`, not `:read`) can see them. Values + # that are already a FilePart/UploadIO (they respond to `:content_type`) or plain + # scalars pass through untouched; the `:multipart`/`:url_encoded` middlewares + # decide for themselves (based on whether any part looks like a file) which + # encoding to apply. + def wrap_form(form) + form.compact.transform_values do |v| + next v if !v.respond_to?(:read) || v.respond_to?(:content_type) + + Faraday::Multipart::FilePart.new(v, 'application/octet-stream') + end + end + + def deserialize(body, type) + return nil if body.nil? || body == '' + + # A successful response with a non-JSON body (plain text, HTML from a + # misbehaving proxy, ...) must not escape the single ApiError contract. + data = + if body.is_a?(String) + begin + JSON.parse(body) + rescue JSON::ParserError => e + raise ApiError, "invalid JSON in response body: #{e.message}" + end + else + body + end + return data if type.nil? + + if type.respond_to?(:from_hash) + type.from_hash(data) + elsif type.respond_to?(:build) + type.build(data) + elsif type.is_a?(Array) && type.first.respond_to?(:from_hash) + data.map { |el| type.first.from_hash(el) } + else + data + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/api_response.rb new file mode 100644 index 000000000000..712662402e25 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/api_response.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class ApiResponse + include Petstore::Serializable + include Petstore::Validations + + attribute :code, + type: 'Integer', + json_key: 'code', + required: false + + attribute :type, + type: 'String', + json_key: 'type', + required: false + + attribute :message, + type: 'String', + json_key: 'message', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/category.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/category.rb new file mode 100644 index 000000000000..b3c9268bec6d --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/category.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class Category + include Petstore::Serializable + include Petstore::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: false + + attribute :name, + type: 'String', + json_key: 'name', + required: false, + pattern: /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/ + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/order.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/order.rb new file mode 100644 index 000000000000..98aafef0318c --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/order.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class Order + include Petstore::Serializable + include Petstore::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: false + + attribute :pet_id, + type: 'Integer', + json_key: 'petId', + required: false + + attribute :quantity, + type: 'Integer', + json_key: 'quantity', + required: false + + attribute :ship_date, + type: 'Time', + json_key: 'shipDate', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false, + enum: ['placed', 'approved', 'delivered'] + + attribute :complete, + type: 'Boolean', + json_key: 'complete', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + @complete = false if @complete.nil? + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/pet.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/pet.rb new file mode 100644 index 000000000000..344e365b5125 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/pet.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class Pet + include Petstore::Serializable + include Petstore::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: false + + attribute :category, + type: 'Category', + json_key: 'category', + required: false + + attribute :name, + type: 'String', + json_key: 'name', + required: true + + attribute :photo_urls, + type: 'Array', + json_key: 'photoUrls', + required: true + + attribute :tags, + type: 'Array', + json_key: 'tags', + required: false + + attribute :status, + type: 'String', + json_key: 'status', + required: false, + enum: ['available', 'pending', 'sold'] + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/tag.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/tag.rb new file mode 100644 index 000000000000..952ec2c0525d --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/tag.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class Tag + include Petstore::Serializable + include Petstore::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: false + + attribute :name, + type: 'String', + json_key: 'name', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/models/user.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/user.rb new file mode 100644 index 000000000000..5ea677f27876 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/models/user.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# OpenAPI Petstore +# +# The version of the OpenAPI document: 1.0.0 +# Generated by OpenAPI Generator (https://openapi-generator.tech) + +module Petstore + module Models + class User + include Petstore::Serializable + include Petstore::Validations + + attribute :id, + type: 'Integer', + json_key: 'id', + required: false + + attribute :username, + type: 'String', + json_key: 'username', + required: false + + attribute :first_name, + type: 'String', + json_key: 'firstName', + required: false + + attribute :last_name, + type: 'String', + json_key: 'lastName', + required: false + + attribute :email, + type: 'String', + json_key: 'email', + required: false + + attribute :password, + type: 'String', + json_key: 'password', + required: false + + attribute :phone, + type: 'String', + json_key: 'phone', + required: false + + attribute :user_status, + type: 'Integer', + json_key: 'userStatus', + required: false + + def initialize(**attrs) + attrs.each do |k, v| + raise ArgumentError, "unknown attribute: #{k}" unless respond_to?("#{k}=") + + public_send("#{k}=", v) + end + raise ArgumentError, list_invalid_properties.join(', ') unless valid? + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/polymorphism.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/polymorphism.rb new file mode 100644 index 000000000000..8f18bf11fc31 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/polymorphism.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +module Petstore + # Runtime support for anyOf/oneOf candidate resolution. Casts raw + # deserialized data (Hash/Array/primitive) against a declared candidate + # type name and returns the matching value, or nil when it does not match. + # + # Candidate type names are plain OpenAPI-Generator Ruby type declarations + # (e.g. 'Integer', "Array", "Hash", or a bare model + # name resolved under Petstore::Models). This mirrors the type-name + # dispatch used by the stock `ruby` generator's `find_and_cast_into_type`, + # adapted to the idiomatic Models:: namespace and attribute DSL. + module Polymorphism + ARRAY_TYPE = /\AArray<(?.+)>\z/ + HASH_TYPE = /\AHash.+)>\z/ + + # Internal sentinel distinguishing "no candidate matched" from a + # genuinely null value that legitimately matched a nullable candidate + # (e.g. a nullable array/hash element, or a nullable model reference). + # `nil` alone is ambiguous for that purpose, so it cannot be reused here. + NO_MATCH = Object.new.freeze + private_constant :NO_MATCH + + # Public entry point used by generated anyOf/oneOf wrappers. Returns the + # matching value, or nil when no candidate matched. + def self.cast(type_name, data) + result = cast_raw(type_name, data) + result.equal?(NO_MATCH) ? nil : result + end + + def self.cast_raw(type_name, data) + case type_name + when 'Boolean' + [true, false].include?(data) ? data : NO_MATCH + when 'Integer' + data.is_a?(Integer) ? data : NO_MATCH + when 'Float' + data.is_a?(Numeric) ? data.to_f : NO_MATCH + when 'String' + data.is_a?(String) ? data : NO_MATCH + when 'Time' + cast_time(data) + when 'Object', 'Hash' + data.is_a?(Hash) ? data : NO_MATCH + when ARRAY_TYPE + cast_array(Regexp.last_match[:sub_type], data) + when HASH_TYPE + cast_hash(Regexp.last_match[:sub_type], data) + else + data.nil? ? nil : cast_model(type_name, data) + end + end + private_class_method :cast_raw + + def self.cast_time(data) + return NO_MATCH unless data.is_a?(String) + + Time.parse(data) + rescue ArgumentError, TypeError + NO_MATCH + end + private_class_method :cast_time + + def self.cast_array(sub_type, data) + return NO_MATCH unless data.is_a?(Array) + + cast_items = data.map { |item| cast_raw(sub_type, item) } + cast_items.any? { |item| item.equal?(NO_MATCH) } ? NO_MATCH : cast_items + end + private_class_method :cast_array + + def self.cast_hash(sub_type, data) + return NO_MATCH unless data.is_a?(Hash) + + cast_pairs = data.transform_values { |value| cast_raw(sub_type, value) } + cast_pairs.any? { |_k, v| v.equal?(NO_MATCH) } ? NO_MATCH : cast_pairs + end + private_class_method :cast_hash + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is: + # - a real model class (Serializable/Validations): responds to `from_hash` + # - an enum module: responds to class-level `valid?(value)` + # - a nested oneOf/anyOf wrapper module: responds to `build(data)` only + def self.cast_model(type_name, data) + return NO_MATCH unless Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + obj = const.from_hash(data) + obj.valid? ? obj : NO_MATCH + elsif const.respond_to?(:valid?) + const.valid?(data) ? data : NO_MATCH + elsif const.respond_to?(:build) + const.build(data) + else + NO_MATCH + end + # A non-matching candidate must not abort the whole anyOf/oneOf resolution: a wrong + # shape (Array where a Hash is expected, a nested build that raises, ...) simply means + # "this candidate does not match", so treat any resolution failure as NO_MATCH. + rescue NameError, TypeError, ArgumentError + # NameError already covers its subclass NoMethodError. + NO_MATCH + end + private_class_method :cast_model + + # Non-validating structural coercion used by `from_hash` deserialization. + # Unlike `cast`/`cast_raw` (which gate on `valid?` to pick the right + # anyOf/oneOf candidate), `coerce` never rejects data: it builds the best + # typed representation it can and falls back to returning the data + # unchanged when it cannot resolve a type. This ensures deserialization + # never silently drops a valid-but-incomplete nested object. + def self.coerce(type_name, data) + return nil if data.nil? + + case type_name + when 'Boolean', 'Integer', 'String', 'Object', 'Hash', nil + data + when 'Float' + data.is_a?(Numeric) ? data.to_f : data + when 'Time' + coerce_time(data) + when ARRAY_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Array) ? data.map { |item| coerce(sub_type, item) } : data + when HASH_TYPE + sub_type = Regexp.last_match[:sub_type] + data.is_a?(Hash) ? data.transform_values { |value| coerce(sub_type, value) } : data + else + coerce_model(type_name, data) + end + end + + def self.coerce_time(data) + return data unless data.is_a?(String) + + begin + Time.parse(data) + rescue ArgumentError, TypeError + data + end + end + private_class_method :coerce_time + + # Resolves a bare model name under Models:: and dispatches according to + # what kind of generated constant it is, without any `valid?` gating: + # - a real model class (Serializable/Validations): `from_hash` (recurses) + # - a nested oneOf/anyOf wrapper module: `build(data)` + # - an enum module: returns the raw value unchanged + # - anything unresolvable: returns the data unchanged + def self.coerce_model(type_name, data) + return data unless type_name.is_a?(String) && Models.const_defined?(type_name, false) + + const = Models.const_get(type_name, false) + if const.respond_to?(:from_hash) + const.from_hash(data) + elsif const.respond_to?(:build) + const.build(data) + else + data + end + rescue NameError + data + end + private_class_method :coerce_model + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/response.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/response.rb new file mode 100644 index 000000000000..c0509593791c --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/response.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Petstore + # Result of an operation. Delegates to `data` for ergonomic access while keeping + # status/headers available. Replaces the `_with_http_info` twin methods. + class Response + extend Forwardable + + attr_reader :data, :status, :headers + + def initialize(data:, status:, headers:) + @data = data + @status = status + @headers = headers + end + + def_delegators :data, :[], :each, :map, :to_a, :to_hash, :dig + + def to_h + data.respond_to?(:to_hash) ? data.to_hash : data + end + + def deconstruct_keys(_keys) + { data: data, status: status, headers: headers } + end + + def deconstruct + [data, status, headers] + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/serializable.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/serializable.rb new file mode 100644 index 000000000000..79d43f146a13 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/serializable.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module Petstore + # Shared serialization for all models. Models declare their attributes via the + # `attribute` DSL (see Validations); this reads the resulting attribute table. + module Serializable + def to_hash + result = self.class.openapi_attributes.each_with_object({}) do |(name, attr), hash| + value = public_send(name) + next if value.nil? && !attr[:required] + + hash[attr[:json_key]] = Serializable.serialize(value) + end + if respond_to?(:additional_properties) && additional_properties && !additional_properties.empty? + # A declared attribute always wins over an overflow key of the same name. + result.merge!(Serializable.serialize(additional_properties)) { |_key, declared, _extra| declared } + end + result + end + + def to_body + to_hash + end + + def to_json(*args) + to_hash.to_json(*args) + end + + def to_s + to_hash.to_s + end + + def ==(other) + other.is_a?(self.class) && to_hash == other.to_hash + end + alias eql? == + + def hash + to_hash.hash + end + + def self.serialize(value) + case value + when Array then value.map { |v| serialize(v) } + when Hash then value.transform_values { |v| serialize(v) } + else value.respond_to?(:to_hash) ? value.to_hash : value + end + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/validations.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/validations.rb new file mode 100644 index 000000000000..653a62291c3a --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/validations.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module Petstore + # Declarative attribute DSL. `attribute :name, type:, required:, enum:, ...` + # generates the accessor, registers the attribute in `openapi_attributes`, + # and stores the validation rules. Replaces the per-model EnumAttributeValidator. + module Validations + def self.included(base) + base.extend(ClassMethods) + end + + module ClassMethods + def openapi_attributes + @openapi_attributes ||= superclass.respond_to?(:openapi_attributes) ? superclass.openapi_attributes.dup : {} + end + + def attribute(name, type:, json_key: name.to_s, required: false, **rules) + openapi_attributes[name] = { type: type, json_key: json_key, required: required, rules: rules } + attr_accessor name + end + + # Deserialization/builder paths use `allocate` (not `new`) on purpose: they must + # stay resilient (a server response may legitimately omit fields the schema marks + # required, or drift from the spec), whereas the caller-facing `initialize` is + # strict and validating. Bypassing `initialize` keeps those two contracts separate. + def build(**attrs) + obj = allocate + attrs.each { |k, v| obj.public_send("#{k}=", v) } + obj + end + + def from_hash(hash) + obj = allocate + openapi_attributes.each do |name, attr| + next unless hash.key?(attr[:json_key]) + + obj.public_send("#{name}=", Petstore::Polymorphism.coerce(attr[:type], hash[attr[:json_key]])) + end + if obj.respond_to?(:additional_properties=) + known = openapi_attributes.values.map { |a| a[:json_key] } + obj.additional_properties = hash.except(*known) + end + obj + end + + def from_json(json) + from_hash(JSON.parse(json)) + end + end + + def list_invalid_properties + errors = [] + self.class.openapi_attributes.each do |name, attr| + errors.concat(validate_attribute(name, attr, public_send(name))) + end + errors + end + + def valid? + list_invalid_properties.empty? + end + + private + + def validate_attribute(name, attr, value) + out = [] + if attr[:required] && value.nil? + out << "invalid value for \"#{name}\", must be provided" + return out + end + return out if value.nil? + + rules = attr[:rules] + out << "invalid value for \"#{name}\", must be one of #{rules[:enum].inspect}" if rules[:enum] && !rules[:enum].include?(value) + out << "\"#{name}\" too long (max #{rules[:max_length]})" if rules[:max_length] && value.to_s.length > rules[:max_length] + out << "\"#{name}\" too short (min #{rules[:min_length]})" if rules[:min_length] && value.to_s.length < rules[:min_length] + # Guard the comparisons: `valid?` must stay a safe, exception-free query even when a + # caller assigns the wrong type (a String to a numeric field, a scalar to an array). + out << "\"#{name}\" must be <= #{rules[:maximum]}" if rules[:maximum] && value.is_a?(Numeric) && value > rules[:maximum] + out << "\"#{name}\" must be >= #{rules[:minimum]}" if rules[:minimum] && value.is_a?(Numeric) && value < rules[:minimum] + out << "\"#{name}\" too many items (max #{rules[:max_items]})" if rules[:max_items] && value.respond_to?(:length) && value.length > rules[:max_items] + out << "\"#{name}\" too few items (min #{rules[:min_items]})" if rules[:min_items] && value.respond_to?(:length) && value.length < rules[:min_items] + out << "\"#{name}\" does not match #{rules[:pattern]}" if rules[:pattern] && value !~ rules[:pattern] + out + end + end +end diff --git a/samples/client/petstore/ruby-idiomatic/lib/petstore/version.rb b/samples/client/petstore/ruby-idiomatic/lib/petstore/version.rb new file mode 100644 index 000000000000..a31ad05178f6 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/lib/petstore/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Petstore + VERSION = '1.0.0' +end diff --git a/samples/client/petstore/ruby-idiomatic/petstore.gemspec b/samples/client/petstore/ruby-idiomatic/petstore.gemspec new file mode 100644 index 000000000000..4e5ec51267c4 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/petstore.gemspec @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require_relative 'lib/petstore/version' + +Gem::Specification.new do |s| + s.name = 'petstore' + s.version = Petstore::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ['OpenAPI-Generator'] + s.email = [''] + s.homepage = 'https://openapitools.org' + s.summary = 'A Ruby client generated by openapi-generator' + s.description = 'A Ruby client generated by openapi-generator' + s.license = 'unlicense' + + s.required_ruby_version = '>= 3.0.0' + + s.files = Dir['LICENSE', 'README.md', 'lib/**/*.rb'] + + s.add_dependency 'faraday' + s.add_dependency 'faraday-multipart' + s.add_dependency 'zeitwerk' +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/api/pet_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/api/pet_spec.rb new file mode 100644 index 000000000000..903bfcb7cb1c --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/api/pet_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Api::Pet do + let(:client) { Petstore::Client.new(base_url: 'http://petstore.swagger.io/v2') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/api/store/order_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/api/store/order_spec.rb new file mode 100644 index 000000000000..f0c9bd4eca0e --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/api/store/order_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Api::Store::Order do + let(:client) { Petstore::Client.new(base_url: 'http://petstore.swagger.io/v2') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/api/store_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/api/store_spec.rb new file mode 100644 index 000000000000..cf79fbb9e70f --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/api/store_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Api::Store do + let(:client) { Petstore::Client.new(base_url: 'http://petstore.swagger.io/v2') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/api/user_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/api/user_spec.rb new file mode 100644 index 000000000000..015012ea3224 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/api/user_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Api::User do + let(:client) { Petstore::Client.new(base_url: 'http://petstore.swagger.io/v2') } + + it 'is reachable and shares the client connection' do + api = described_class.new(client.connection) + expect(api).to be_a(described_class) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/api_response_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/api_response_spec.rb new file mode 100644 index 000000000000..970eeb173ef9 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/api_response_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::ApiResponse do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/category_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/category_spec.rb new file mode 100644 index 000000000000..e10f9ab8745f --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/category_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::Category do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/order_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/order_spec.rb new file mode 100644 index 000000000000..e4b346c44e1e --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/order_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::Order do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/pet_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/pet_spec.rb new file mode 100644 index 000000000000..d0d51e4fb3df --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/pet_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::Pet do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/tag_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/tag_spec.rb new file mode 100644 index 000000000000..97f6b3a12e7d --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/tag_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::Tag do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/models/user_spec.rb b/samples/client/petstore/ruby-idiomatic/spec/models/user_spec.rb new file mode 100644 index 000000000000..efa6bbfe2823 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/models/user_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Petstore::Models::User do + # from_hash (deserialization path) builds without validating, so it works even for + # models with required fields -- unlike the strict, validating `new`. + it 'round-trips through JSON' do + instance = described_class.from_hash({}) + expect(described_class.from_json(instance.to_json)).to eq(instance) + end + + it 'reports missing required attributes' do + required = described_class.openapi_attributes.select { |_, a| a[:required] }.keys + instance = described_class.from_hash({}) + if required.any? + expect(instance.list_invalid_properties).not_to be_empty + else + expect(instance.list_invalid_properties).to be_empty + end + end + + it 'rejects unknown attributes' do + expect { described_class.new(this_is_not_an_attribute: true) }.to raise_error(ArgumentError) + end +end diff --git a/samples/client/petstore/ruby-idiomatic/spec/spec_helper.rb b/samples/client/petstore/ruby-idiomatic/spec/spec_helper.rb new file mode 100644 index 000000000000..74db795d7a56 --- /dev/null +++ b/samples/client/petstore/ruby-idiomatic/spec/spec_helper.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'simplecov' + +SimpleCov.start do + add_filter '/spec/' +end + +RSpec.configure do |config| + config.color = true + config.fail_fast = false + + config.order = :random + Kernel.srand config.seed + + config.expect_with :rspec do |c| + c.syntax = :expect + end + + # disable monkey patching + # see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode + config.disable_monkey_patching! + + config.raise_errors_for_deprecations! +end + +require 'petstore'