I have been trying out the poem-openapi
Rust crate for a ChatGPT plugin backend, as an alternative to my familiar Python FastAPI stack. When I used it’s derive(Object)
on a struct and included that as the body of a POST endpoint, it generated an OpenAPI schema that had a paths section with an application/json; charset=utf-8
media type. Relevant poem-openapi
code. Example openapi json snippet:
{"paths": {
"/foo": {
"post": {
"requestBody": {
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/FooRequest"
}}}}}}},
components": {
"schemas": {
"FooRequest": {
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"type": "string",
"default": "."
}}}}}
}
When ChatGPT tried to POST to that endpoint with any body, it failed to send any traffic over the network and instead showed the response as “ERROR: UnrecognizedKwargsError: path”. That error has at least one thread of its own. Copying out the poem-openapi
generate OpenAPI spec and serving it out from a flat file, editing the content type to just be application/json
instead of application/json; charset=utf-8
, fixed the issue.
A google search for “openapi client generator application/json charset utf-8” does point to a few different bug issues, mostly resolved. Is this a bug in OpenAI / ChatGPT’s plugin client code?