Comments (2)
Good point about the complex spec features (oneOf
, anyOf
, etc), I didn't think about that. Thankfully, I can leverage another Go library that has some of these parts already implemented.
I think for the time being, I'm going to write a small Python script using https://github.com/Dorthu/openapi3 to generate a template, and then fill in the blanks for anything too complicated. Once I have something working, I'm happy to share a Gist.
from huma.
@srilman thanks for the question! Unfortunately that isn't possible at the moment. Huma does not generate anything from OpenAPI specs itself. It would be possible to create a template for other code generators that spits out Go code using Huma, but I don't think that exists at the moment. As a side note, it's also a bit complicated because Huma supports most but not all of the OpenAPI features, and some OpenAPI documents can be written in a way that makes it hard to generate sane Go code (for example using oneOf
/anyOf
/not
or complex branching, constants, etc).
Anyway I'd be happy if someone wants to build this, otherwise you may just have to manually convert it to Go code for the time being.
from huma.
Related Issues (20)
- Unexported Fields in Schemas are Not Considered for Schema Generation HOT 2
- Any sample code to get http.Request.RemoteAddr in huma.context
- The validation of format:"email" is not perfect. HOT 3
- The default error response field value in openapi docs is "DEFAULT" HOT 2
- Support multiple query parameters with the same name HOT 3
- Accessing validation results in the request pipeline HOT 1
- Need to explicitly call PrecomputeMessages() when using custom RequestBody HOT 1
- tag readOnly:"true" does not seem to work on object types HOT 2
- empty array will be send out as null HOT 2
- Question about 'required by default' HOT 5
- Adding openapi command still emits router config HOT 2
- Accessing file name and file size in `multipart/form-data` request HOT 1
- Data race when consuming input RawBody HOT 1
- Routing groups in Go 1.22 HOT 2
- Discussion: How best to catch and log 500s? HOT 1
- Panic on Validation Phase of custom `time.Time` Type HOT 1
- Does readOnly actually do any validation? HOT 1
- Setting headers in error response always appends HOT 1
- fmt.Println message: warning: unable to set write deadline HOT 1
- Panic on write with very large response body bricks server for some time as response body is logged to standard output 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 huma.