GithubHelp home page GithubHelp logo

OpenAPI generator about goyave HOT 8 CLOSED

go-goyave avatar go-goyave commented on June 25, 2024
OpenAPI generator

from goyave.

Comments (8)

System-Glitch avatar System-Glitch commented on June 25, 2024 1

After some reasearch, it looks like kin-openapi is the most fitting library we could use.

from goyave.

System-Glitch avatar System-Glitch commented on June 25, 2024

I had a few ideas to make this feature:

  • Make it build-in (it would be implemented in a new openapi.go file at the root of the project, to be able to access unexported fields)
  • A lot of information can be retrieved simply by reading the route definition and its validation rules.
  • The route description can be retrieved using handler comments and godoc.
  • The hardest part is not mandatory: getting information about the responses.
  • Adding an optional (nullable) struct to the Route struct, containing OpenAPI information that can be added manually, such as potential responses, examples, etc.
  • OR adding this information in the handler's comments (using annotation-like syntax like Beego does for example)
    • The go/ast package could be used for comment extraction
  • For ease of use, it could be integrated into the CLI utility that is being developed.

from goyave.

njr8392 avatar njr8392 commented on June 25, 2024

I'd love to help you with this if you have't already started.

from goyave.

System-Glitch avatar System-Glitch commented on June 25, 2024

Hello @njr8392 ! Thank you very much for your help ! I haven't started this feature yet. Don't hesitate to contact me (via email, telegram or discord) if you have any question or if you need guidance.

from goyave.

njr8392 avatar njr8392 commented on June 25, 2024

from goyave.

System-Glitch avatar System-Glitch commented on June 25, 2024
  • If possible, that would make more sense to me if this was a separate project. I don't want applications in production to waste memory usage holding information needed for the OpenAPI spec generation. Ideally, this is something that we could use in the future CLI app. If it is not possible to get the data you need from outside, we can add an accessor to the Router struct which will copy the route slice.
  • Routes should always be defined in a http/route/route.go file so use this as default, but make it so it is possible to optionally give a path to the file.
  • Prefer the go/ast package over godoc. Using godoc would be quite hacky.
  • I would like to get as much information as possible automatically, but I also want the developer to be able to override and/or complete it. I think Beego's approach with annotations is quite neat. You can take inspiration from it.
  • The goal is to turn a Router struct into an OpenAPI specification.

from goyave.

njr8392 avatar njr8392 commented on June 25, 2024

from goyave.

System-Glitch avatar System-Glitch commented on June 25, 2024

https://github.com/go-goyave/openapi3

from goyave.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.