Open vlmduy opened 2 years ago
Hi! We would like to contribute and solve this issue. I think we can easily solve this and upload a PR, but we need guidance on how the generator code and the *.mustache
templates work. Can someone explain this real quick for us?
Thanks in advance, Axians Spain Development Team
Here are the docs on our mustache template library: https://github.com/spullara/mustache.java Here are some docs on how mustache is used: http://mustache.github.io/mustache.5.html Please read through the FastAPI generator here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java#L130 It processes the openapi spec file in Java and renders the mustache templates into python code. The PythonFastAPIServerCodegen templates are here: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/python-fastapi
In order to contribute you would:
./mvnw clean package
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh
I encountered the same issue, has it been fixed ?
Nope. Enums are fully working in python-experimental
though, how about trying it?
Or would you like to file a PR fixing python-fastapi
?
One can see enums working in python-experimental
in these references:
class EnumWith0DoesNotMatchFalse(
_SchemaEnumMaker(
enum_value_to_name={
0: "POSITIVE_0",
}
),
NumberSchema
):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
@classmethod
@property
def POSITIVE_0(cls):
return cls(0)
@spacether python
(prior python-experimental
) is a client generator while python-fastapi
is a server generator, so it's complicated to use one in place of the other.
Yup they are for different use cases
Bug Report Checklist
Description
openapi-generator-cli -g python-fastapi generator cannot generate the valid enum class.
openapi-generator version
5.2.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs