-
Notifications
You must be signed in to change notification settings - Fork 8
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
enum generation #37
Comments
Thanks for reporting. From what I see, model fields that are enums (e.g. here and here are generated correctly like here and here. However for enums in API parameters like here and here the required validations are not generated. I have added an entry in the TODO section for enum improvements. PRs are welcome! |
As additional information, we are using extended specification from here https://github.com/openai/chatgpt-retrieval-plugin/blob/main/.well-known/openapi.yaml#L41C1-L41C6 As for now, we replaced |
Hi @rssdev10, I gave the specs a try with the latest version of openapi-generator, and I see the if !isdefined(@__MODULE__, :Source)
const Source = String
else
@warn("Skipping redefinition of Source to String")
end While that's not complete (lacks validations for the enum values), but it is not incorrect as it seems to have been in some earlier version of the generator. Maybe updating the openapi-generator version would help in this case. Serialization and deserializations do not throw errors. julia> using OpenAPI, JSON
julia> include("src/OpenAPIRetrievalPluginClient.jl")
Main.OpenAPIRetrievalPluginClient
julia> meta = OpenAPIRetrievalPluginClient.DocumentChunkMetadata(; source="file");
julia> # serialization
julia> meta
{
"source": "file"
}
julia> # de-serialization
julia> meta2 = OpenAPI.from_json(OpenAPIRetrievalPluginClient.DocumentChunkMetadata, JSON.parse("{\"source\":\"chat\"}"))
{
"source": "chat"
} I would still keep this issue open though, to track the issue that validations for enums are not generated properly. |
Probably wrong generation of the enum type.
Expectation is to have
and an equivalent code in Python
But in fact we have:
And de-serialization is working for the code only:
The text was updated successfully, but these errors were encountered: