github4s icon indicating copy to clipboard operation
github4s copied to clipboard

Generate all endpoints

Open BenFradet opened this issue 5 years ago • 7 comments

This article got me thinking:

  • we might be able to scrape the documentation
  • generate an open api specification out of it
  • generate a client through mu
  • maybe generate implementations also

:thinking:

BenFradet avatar Apr 10 '20 13:04 BenFradet

or maybe bypass mu and openapi and do:

  • scrape the documentation
  • generate algebra
  • generate implementation
  • generate documentation

BenFradet avatar Apr 10 '20 13:04 BenFradet

The documentation does not provide return types, though. It's all well and good on a dynamic typing language like javascript, but it's a big missing piece for Scala.

dcsobral avatar Apr 10 '20 17:04 dcsobral

We might be able to infer them from a response though

BenFradet avatar Apr 10 '20 18:04 BenFradet

If in futur, we will generate all code of github4s. I think the lib ghostbuster91/sttp-openapi-generator is interested. sttp propose a interface with a logic similar to github4s, and sttp-openapi-generator generate idiomatic scala code.

But currently, sttp-openapi-generator can't still generate compilable code.

Generate all endpoints,this could allow reduce the time of developpement, debug, testing(if the generator is reliable). We can still after fix manually the typing issue. The idea seems great for me.

dev590t avatar Jul 31 '21 18:07 dev590t

Hello,

Just wondering, ever thought of using https://github.com/github/rest-api-description as a basis? It's in beta according to the README, but as far as I can see, it's pretty much in line with the actual API, This combined with https://github.com/guardrail-dev/sbt-guardrail could easily replace most of the codebase while extending the managed endpoints.

If there is any interest, I can start working on a PoC.

abestel avatar Sep 15 '21 09:09 abestel

Sounds really interesting, thanks @abestel !

juanpedromoreno avatar Sep 15 '21 14:09 juanpedromoreno

interessed for me @abestel

dev590t avatar Oct 21 '21 17:10 dev590t