Skip to content
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

Trying to generate ocaml for jhipster rest #6

Open
flefevre opened this issue Oct 11, 2018 · 4 comments
Open

Trying to generate ocaml for jhipster rest #6

flefevre opened this issue Oct 11, 2018 · 4 comments

Comments

@flefevre
Copy link

I have tried your excellent ocaml generator for swagger with a Jhipster application 1, which is commonly used for java developer. My goal was to be able to make a bridge between java rest service and ocaml.
Nevertheless, I didn't succeed, they were problems of generation. The REST api is fully functional but no way to generate the code. And as a newbie in ocaml, no way also to understand how to create a snipped of code to query for instance the "/api/web3jv/get-admin-web-3-j-version" rest service.

swagger.full.txt

I have tried to remove the

"produces": [ "*/*" ],

by

"produces": [ "application/json" ],

and also suppress the

"type": "object",

but I am not sure how to do it?
I would appreciate your help.

@andrenth
Copy link
Owner

It seems to be dying initially on the empty contact and license objects in the info object (I'm not sure if that's legal), and it looks like there's a bug in the handling of objects, where the properties field is ignored and the additionalProperties field is considered required, but shouldn't be (?).

I haven't been using OCaml for work recently, so I'll have to be honest and say I don't know when I'll have time to try to fix this, but I'll gladly merge a PR if you want to try your hand at it.

@flefevre
Copy link
Author

Hello,
I have tried again with your advices. it works a little. I have removed the unfilled properties, and make the small changes i have proposed befored.
Nevertheless as i am a newbie in ocaml, I do not know how to write a minimal ocaml code to query the rest api through the generated code.

will you be able to tell how to write the minimal ocaml code to query

` module Web3jv : sig

  module Get_web_3_j_version : sig

    val request_path_template : unit -> string

    val get : Uri.t -> (string, string) result Lwt.t
  end

end

`

swagger.json.txt

kubecaml.ml.txt

ocamlswagger.zip

@andrenth
Copy link
Owner

Have you had a look at the kubecaml examples?

@rdavison
Copy link

rdavison commented Nov 6, 2018

@flefevre : Perhaps you can try using utop to help you navigate the generated code. In your project directory, you can run dune utop, or perhaps dune utop -p kubecaml (replace with the name of the package that you are developing). Then you can interactively browse the generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants