Coder Social home page Coder Social logo

Handle other implementations about rules_openapi HOT 3 OPEN

meetup avatar meetup commented on June 15, 2024
Handle other implementations

from rules_openapi.

Comments (3)

softprops avatar softprops commented on June 15, 2024

This project is current based on swagger. I'm not familiar with go-swagger or what differentiates it from swagger. Swagger supports arbitrary programming languages and is extensible in allowing you to define your own code generators. We actually do this with our own scala client and server generators at Meetup.

Here is an example client generator

load(
    "@io_bazel_rules_openapi//openapi:openapi.bzl",
    "openapi_gen",
)

load(
    "@io_bazel_rules_scala//scala:scala.bzl",
    "scala_library",
)

# helpers for meetup classic's common case
_base_package = "com.meetup"
def openapi_client(svc):
    openapi_gen(
        name = "{svc}-client-src".format(svc=svc),
        api_package = "{base_package}.{svc}.api".format(base_package = _base_package, svc = svc),
        invoker_package = "{base_package}.{svc}".format(base_package = _base_package, svc = svc),
        language = "meetup-scala-client",
        model_package = "{base_package}.{svc}.model".format(base_package = _base_package, svc = svc),
        spec = "src/main/openapi/meetup-scala-client/{svc}.yaml".format(svc = svc),
        deps = [
            "@meetuplib//:meetup-scala-generator",
        ],
    )

    scala_library(
        name = "{svc}-client".format(svc=svc),
        srcs = ["{svc}-client-src".format(svc=svc)],
        deps = ["@meetuplib//:meetup-scala-gen-deps"],
        visibility = ["//visibility:public"],
    )

Can you elaborate a bit more on go-swagger and how it differs in goals from swagger proper?

from rules_openapi.

tony-scio avatar tony-scio commented on June 15, 2024

I'm not sure if this is exactly the OP's question, but I'd like to be able to use this rule to generate both typescript-fetch and go libraries (as supported by swagger-codegen -l ...). In other words:

openapi_gen(
    language = "go",
    # ...
)

But it seems like the openapi_gen rule always packages the generated files into a jar, which I don't think can be easily consumed by languages other than java/scala. Am I missing an obvious way to depend on and openapi_gen rule from another language?

from rules_openapi.

softprops avatar softprops commented on June 15, 2024

We've only implemented what we've needed, in our case jvm bundles. The underlying tool itself supports a number of languages. What would be the ideal archive type you'd be looking for?

I could help guide you on how to add support for other package types. The current format of is implemented here

from rules_openapi.

Related Issues (7)

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.