-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Axios removed from js client #348
Conversation
@gustawdaniel this is really cool! thanks for doing this. We are currently using codegen for the base typescript types based on the OpenAPI spec from FastAPI. https://github.com/chroma-core/chroma/blob/main/clients/js/package.json#L40 To fully land this, we would want to move this over from Would you be willing to take a look at that? |
I fixed this problem OpenAPITools/openapi-generator#3869 now see
or
but I hope I will fix it. |
why
instead of simpler
What is problem now: We have schema This problem was reported here OpenAPITools/openapi-generator#2845 (comment) There is support table for https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/typescript-fetch.md and we can see that there is our openapi schema "loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
}, and generated not correct code
for axios I see this code generated
|
Options
|
I tried karlvr/openapi-generator-plus#41 main problem:
|
Finally I replaced
by
but i have to patch it now because your schema is incorrect. In openapi.json there are
that are not correct openapi schema. The OpenAPI schema you provided appears to be incomplete. Specifically, the "schema" object within the "application/json" content object is empty, which means that the response body will not contain any data. If the response body should be empty, the schema object should be omitted entirely. However, if the response should contain data, you will need to define the schema to describe the structure of the data that will be returned. Here is an example of a valid OpenAPI schema for a response with a JSON body:
In this example, the schema object defines an object with a single property "version" which is a string with an example value of "1.0.0". |
@jeffchuber there are details of all fixes that have to made in openapi.json https://www.diffchecker.com/OtKP9Ogd/ potentially there can be better models than null. I added null because without it |
@jeffchuber I finished but think that these operations sed -i 's/"schema": {}/"schema": {"type": "object"}/g' openapi.json
sed -i 's/"items": {}/"items": { "type": "object" }/g' openapi.json
sed -i -e 's/"title": "Collection Name"/"title": "Collection Name","type": "string"/g' openapi.json need to be considered as fixing not fully covered schema, and they should be removed in future when schema will be fully and correctly described. On the other hand
is relatively low cost of usage quite good typescript fetch generator
|
@gustawdaniel thanks for all of this! will pull down and take a look tonight |
@gustawdaniel mostly reviewed this - thanks for doing all of this. will wrap up today |
closing in favor of #409 |
As suggested in #254 I replaced axios by fetch