Comments (8)
After some reasearch, it looks like kin-openapi is the most fitting library we could use.
from goyave.
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.
I'd love to help you with this if you have't already started.
from goyave.
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.
from goyave.
- 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.
from goyave.
https://github.com/go-goyave/openapi3
from goyave.
Related Issues (20)
- CORS options not working on subrouters
- Migrate from dgrijalva/jwt-go to golang-jwt/jwt
- Validating arrays of objects
- "exists" validation rule
- Validation "Required if" HOT 2
- Validation rules composition
- Validation date before/after now
- Instances HOT 8
- Allow raw SQL query in Paginator
- go-sqlmock integration
- Adapt framework to DB views
- Don't force test env in test suites
- HTTP cache implementation as middleware HOT 2
- Post-validation hook
- Validation context: access to request object
- Http Client for goyave HOT 6
- response.Error() doesn't take response status into account in debug mode
- Validation made for autocomplete HOT 3
- Exists/Unique validation rule panics when input type doesn't match database column type HOT 1
- Panic when parsing multipart form with an empty file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goyave.