GithubHelp home page GithubHelp logo

Comments (2)

srilman avatar srilman commented on June 13, 2024 1

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.

danielgtaylor avatar danielgtaylor commented on June 13, 2024

@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)

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.