Commit 6015607
authored
Update OpenAPI Models for Namespace (#541)
# 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 maintained1 parent f44ca91 commit 6015607
File tree
7 files changed
+316
-8
lines changed- codegen
- pinecone
- core/openapi/db_data
- models
- model
- grpc
- openapi_support
7 files changed
+316
-8
lines changedSubmodule apis updated from bbad89b to d5ac931
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| 246 | + | |
243 | 247 | | |
244 | 248 | | |
245 | 249 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
111 | | - | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
157 | | - | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
247 | 251 | | |
248 | 252 | | |
249 | 253 | | |
250 | | - | |
| 254 | + | |
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
| |||
Lines changed: 270 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
0 commit comments