[BUG][OCaml] Generating matrix.org client-server API fails with an exception
Created by: eras
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue?
Not minimal (by far), but complete.
-
Have you validated the input using an OpenAPI validator (example)?
Yes.
-
What's the version of OpenAPI Generator used?
openapi-generator-cli-4.1.0-20190729.024538-72.jar
-
Have you search for related issues/PRs?
Such a new feature doesn't seem to have a lot of mentions..
-
What's the actual output vs expected output?
No exception expected; expected an enums.ml
file referenced from other files.
Description
java -jar openapi-generator-cli-4.1.0-20190729.024538-72.jar generate -g ocaml -i https://matrix.org/docs/api/client-server/json/api-docs.json -o ocaml
fails with an uncaught exception
Exception: Unreferenced enum image/jpeg,image/png
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1111)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:968)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:526)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:921)
at org.openapitools.codegen.cmd.Generate.run(Generate.java:399)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
Caused by: java.lang.IllegalArgumentException: Unreferenced enum image/jpeg,image/png
at org.openapitools.codegen.languages.OCamlClientCodegen.toEnumName(OCamlClientCodegen.java:718)
at org.openapitools.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:2227)
at org.openapitools.codegen.DefaultCodegen.addHeaders(DefaultCodegen.java:3510)
at org.openapitools.codegen.DefaultCodegen.fromResponse(DefaultCodegen.java:2836)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:2551)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1045)
... 5 more
enums.ml file is not generated, which seems to be quite an important module.
openapi-generator version
4.1.0-20190729.024538-72
It's a very new feature.
OpenAPI declaration file content or url
https://matrix.org/docs/api/client-server/json/api-docs.json
Command line used for generation
java -jar openapi-generator-cli-4.1.0-20190729.024538-72.jar generate -g ocaml -i https://matrix.org/docs/api/client-server/json/api-docs.json -o ocaml
Steps to reproduce
java -jar openapi-generator-cli-4.1.0-20190729.024538-72.jar generate -g ocaml -i https://matrix.org/docs/api/client-server/json/api-docs.json -o ocaml
Getting a bit repetitive here I guess :).
Related issues/PRs
#1159 (closed) is the bug for introducing the OCaml support; #3446 actually merged the support in. So it seems @cgensoul is the guy here :).
Suggest a fix
No suggestions, didn't look at the code.
Thanks for writing the support though, it's bound to simplify the task of creating OCaml Matrix bindings :).