Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Nov 14, 2025

Update OpenAPI Models for Namespace

Summary

This PR updates the codebase to align with the latest OpenAPI specification changes for namespace-related models. The API specification has been updated to:

  • Add total_count field to ListNamespacesResponse
  • Replace total_count field in NamespaceDescription with indexed_fields field

The wrapper code has been updated to properly parse and populate these new fields when using the gRPC client.

Changes

Code Generator Updates

  • Updated codegen/apis submodule to latest commit (bbad89bd51d792534a9ba06a44ed1f2259f7f89f)

  • Updated pinecone/core/openapi/db_data/model/list_namespaces_response.py:

    • Added total_count (int) field to ListNamespacesResponse
    • Field represents the total number of namespaces in the index matching the prefix
  • Updated pinecone/core/openapi/db_data/model/namespace_description.py:

    • Removed total_count field (moved to ListNamespacesResponse)
    • Added indexed_fields field of type NamespaceDescriptionIndexedFields
    • Field contains a list of all indexed metadata fields in the namespace
  • Added new model pinecone/core/openapi/db_data/model/namespace_description_indexed_fields.py:

    • New model class NamespaceDescriptionIndexedFields with fields property (list of strings)
    • Represents the indexed metadata fields for a namespace
  • Updated pinecone/core/openapi/db_data/models/__init__.py:

    • Added export for NamespaceDescriptionIndexedFields
  • Updated pinecone/openapi_support/api_version.py:

    • Updated API version SHA to reflect latest specification

Wrapper Code Updates

  • Updated pinecone/grpc/utils.py:
    • parse_list_namespaces_response function:

      • Now extracts total_count from gRPC response (totalCount in JSON)
      • Extracts indexedFields for each namespace in the list
      • Creates NamespaceDescriptionIndexedFields objects when present
      • Includes both fields when constructing ListNamespacesResponse
    • parse_namespace_description function:

      • Now extracts indexedFields from gRPC response (if present)
      • Creates NamespaceDescriptionIndexedFields object with the fields array
      • Includes indexed_fields when constructing NamespaceDescription
    • Added import for NamespaceDescriptionIndexedFields model

Technical Details

Field Changes

  1. ListNamespacesResponse.total_count (new):

    • Type: int
    • Optional: Yes
    • Description: The total number of namespaces in the index matching the prefix
    • Source: Extracted from totalCount in gRPC JSON response
  2. NamespaceDescription.indexed_fields (new):

    • Type: NamespaceDescriptionIndexedFields
    • Optional: Yes
    • Description: A list of all indexed metadata fields in the namespace
    • Source: Extracted from indexedFields.fields in gRPC JSON response
  3. NamespaceDescription.total_count (removed):

    • This field has been moved to ListNamespacesResponse where it is more semantically appropriate

Backward Compatibility

  • All new fields are optional, so existing code will continue to work
  • Existing tests should continue to pass as they only check required fields
  • The gRPC parsing functions handle missing fields gracefully by setting them to None

Testing

  • Type checking with mypy passes for updated files
  • Existing integration tests should continue to work (they only verify required fields)
  • The parsing functions handle optional fields correctly when they are absent from responses

Notes

  • REST API clients will automatically receive these fields when the API returns them (handled by OpenAPI models)
  • gRPC clients now properly parse and populate these fields from protobuf responses
  • Both total_count and indexed_fields are optional fields, so backward compatibility is maintained

@jhamon jhamon marked this pull request as ready for review November 14, 2025 21:22
@jhamon jhamon merged commit 6015607 into release-candidate/2025-10 Nov 14, 2025
27 checks passed
@jhamon jhamon deleted the jhamon/update-spec branch November 14, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants