diff --git a/composer.json b/composer.json index ecccb80..cdbf0a9 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": "^8.3", - "saloonphp/saloon": "^4.0" + "saloonphp/saloon": "^3.0 || ^4.0" }, "require-dev": { "laravel/framework": "^11.0|^12.0", diff --git a/tests/Contract/OpenApiSchemaTest.php b/tests/Contract/OpenApiSchemaTest.php index 73f991e..daeb267 100644 --- a/tests/Contract/OpenApiSchemaTest.php +++ b/tests/Contract/OpenApiSchemaTest.php @@ -38,13 +38,21 @@ function getRequestSchema(array $spec, string $method, string $path): ?array return isset($body['$ref']) ? resolveSchema($spec, $body['$ref']) : $body; } -function specFields(array $schema): array +function specFields(?array $schema): array { + if ($schema === null) { + return []; + } + return array_keys($schema['properties'] ?? []); } -function specRequired(array $schema): array +function specRequired(?array $schema): array { + if ($schema === null) { + return []; + } + return $schema['required'] ?? []; } @@ -55,18 +63,16 @@ function specRequired(array $schema): array expect(specFields($schema))->toContain('vectors'); }); - it('SearchRequest has required vector and limit', function (): void { - $schema = getRequestSchema(loadSpec(), 'post', '/collections/{collection_name}/points/search'); + it('nearest-neighbor search lives on QueryRequest after /points/search retired', function (): void { + $schema = getRequestSchema(loadSpec(), 'post', '/collections/{collection_name}/points/query'); $fields = specFields($schema); - $required = specRequired($schema); - expect($fields)->toContain('vector') + expect($schema)->not->toBeNull() + ->and($fields)->toContain('query') ->and($fields)->toContain('limit') ->and($fields)->toContain('filter') ->and($fields)->toContain('with_payload') - ->and($fields)->toContain('with_vector') - ->and($required)->toContain('vector') - ->and($required)->toContain('limit'); + ->and($fields)->toContain('with_vector'); }); it('ScrollRequest accepts our fields', function (): void { @@ -176,13 +182,12 @@ function specRequired(array $schema): array expect($paths)->toContain('/collections/{collection_name}') ->and($paths)->toContain('/collections/{collection_name}/points') - ->and($paths)->toContain('/collections/{collection_name}/points/search') + ->and($paths)->toContain('/collections/{collection_name}/points/query') ->and($paths)->toContain('/collections/{collection_name}/points/scroll') ->and($paths)->toContain('/collections/{collection_name}/points/delete') ->and($paths)->toContain('/collections/{collection_name}/points/count') ->and($paths)->toContain('/collections/{collection_name}/points/payload') ->and($paths)->toContain('/collections/{collection_name}/index') - ->and($paths)->toContain('/collections/{collection_name}/points/query') ->and($paths)->toContain('/collections/aliases'); }); @@ -194,14 +199,13 @@ function specRequired(array $schema): array ->and($spec['paths']['/collections/{collection_name}'])->toHaveKey('delete') ->and($spec['paths']['/collections/{collection_name}/points'])->toHaveKey('put') ->and($spec['paths']['/collections/{collection_name}/points'])->toHaveKey('post') - ->and($spec['paths']['/collections/{collection_name}/points/search'])->toHaveKey('post') + ->and($spec['paths']['/collections/{collection_name}/points/query'])->toHaveKey('post') ->and($spec['paths']['/collections/{collection_name}/points/scroll'])->toHaveKey('post') ->and($spec['paths']['/collections/{collection_name}/points/delete'])->toHaveKey('post') ->and($spec['paths']['/collections/{collection_name}/points/count'])->toHaveKey('post') ->and($spec['paths']['/collections/{collection_name}/points/payload'])->toHaveKey('post') ->and($spec['paths']['/collections/{collection_name}/index'])->toHaveKey('put') ->and($spec['paths']['/collections/{collection_name}/index/{field_name}'])->toHaveKey('delete') - ->and($spec['paths']['/collections/{collection_name}/points/query'])->toHaveKey('post') ->and($spec['paths']['/collections/aliases'])->toHaveKey('post'); }); });