-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the OpenAPI spec to just follow the readme.io convention #2
Comments
Created a PR, feel free to merge it, or don't! |
Ha! How about that! I'll dig in ASAP. Thank you for flagging! |
of course! |
also looking at my late-night PR - didn't mean to tread on you with the pyproject.yml author, was just mindlessly punching through the configuration list while using |
Of course! I didn't read anything at all into it. Thank you for this (excellent) suggestion! I will dig in today. |
@nikhilshinday @sigpwned just a heads up, there might be a reason the OpenAPI spec is not public just yet. I am seeing a ton of inconsistencies between the spec and the actual API responses. Some examples:
ExampleHere is the OpenAPI spec for JSON Spec
"indexMeta": {
"type": "object",
"properties": {
"database": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"dimension": {
"type": "string"
},
"index_type": {
"type": "string",
"deprecated": true
},
"metric": {
"type": "string"
},
"pods": {
"type": "integer"
},
"replicas": {
"type": "integer"
},
"shards": {
"type": "integer"
},
"pod_type": {
"type": "string"
},
"index_config": {
"oneOf": [
{
"$ref": "#/components/schemas/ApproximatedConfig"
}
]
},
"metadata_config": {
"type": "object"
},
"status": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"state": {
"type": "string",
"enum": [
"Initializing",
"ScalingUp",
"ScalingDown",
"Terminating",
"Ready",
"InitializationFailed"
]
}
}
}
}
}
}
},
Now compare that with the response you get when querying a newly created index: curl --request GET \
--url https://controller.us-west1-gcp-free.pinecone.io/databases/xyz \
--header 'Api-Key: *****-*****' \
--header 'accept: application/json' {
"database": {
"name": "xyz",
"metric": "cosine",
"dimension": 1536,
"replicas": 1,
"shards": 1,
"pods": 1
},
"status": {
"waiting": [],
"crashed": [],
"host": "xyz-e795e37.svc.us-west1-gcp-free.pinecone.io",
"port": 433,
"state": "Ready",
"ready": true
}
}
There are several other examples, but this one was particularly egregious and wasted a ton of time. TakeawayAll of this has basically made it impossible for me to generate any sort of reliable client via the OpenAPI spec, or even by relying on the docs. In short, the docs are out of sync with the actual responses being returned from the Pinecone API. Its actually quite bad. I have resorted to simply hand coding a client by inspecting the actual responses from the API. |
@sigpwned FWIW, I took your hand coded yaml spec in this repo, converted it to json via the online swagger editor, and used that to generate a client. Testing it now. In general, it seems to work much better, although I still see some inconsistencies that I just hand modified in the JSON spec. You captured some of the issues I described above - namely that |
This is great work! If you see any specific issues in this spec, please let me know and/or open a PR. Obviously, I'd love to keep this as up-to-date as possible! And @nikhilshinday, it looks like it's best not to use the "official" OpenAPI spec for now, since it's inaccurate. But thank you for finding it, and I'll keep an eye on it! If and when an official release happens, I'll do one last release here and point folks at the official version. |
Hey @sigpwned! thanks for doing this. While browsing the documentation for pinecone, I realized that the official OpenAPI spec is loaded onto the page at runtime. There are two sections:
and if you click into either, you'll see a request that looks something like:
![Screen Shot 2023-04-18 at 11 50 25 PM](https://user-images.githubusercontent.com/6282970/232962467-4c0385c6-c509-4b41-9e9b-7471943975f5.png)
where
reference/<slug>
refers to the endpoint that's being selected in the sub-menu.When you look at the JSON body, it has an openapi definition embedded in it!
![Screen Shot 2023-04-18 at 11 52 28 PM](https://user-images.githubusercontent.com/6282970/232962689-74aa2a10-55b9-4eb9-9840-e5aad2b36715.png)
![Screen Shot 2023-04-18 at 11 53 05 PM](https://user-images.githubusercontent.com/6282970/232962750-8a2dee90-0ec3-4ed6-ba00-af4bd3e6e6a0.png)
and the paths in that definition:
When you click on any of the endpoints in the second sub-menu, the OpenAPI definition changes (probably because the authorization scoping is at the project-level rather than the index-level).
Effectively, all you have to do to keep this up-to-date is run:
The text was updated successfully, but these errors were encountered: