Code Monkey home page Code Monkey logo

codegen-assets's Introduction

Codegens for Hasura

This repo contains a list of codegens for Hasura (CLI & Console). This repo also contains a builder-kit for building your own codegen.

What is codegen?

Codegen for Hasura generates working boilerplate code in your language/framework for action handlers (currently, we may do more in the future!).

Using a codegen

To use Hasura codegen, head to the Hasura docs. It can be used via the CLI or the console.

Building a codegen

To build and publish a codegen for your favourite language and framework (thank you ❤️!) head to the builder-kit docs!

codegen-assets's People

Contributors

arjunyel avatar coco98 avatar dependabot[bot] avatar elimisteve avatar gavinray97 avatar mehtavishwa30 avatar nandorholozsnyak avatar wawhal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codegen-assets's Issues

return upstream error code to the client

The codegen for error handling looks like this:

if (errors) {
    return res.status(400).json(errors[0])
}

This doesn't send the code received in the errors[0].extensions object and only sends the message. Ideally the codegen should send back the error code as it is to the client.

The updated error handling would look like this:

if (errors) {
    return res.status(400).json( { code: errors[0].extensions.code, message: errors[0].message } );
}

Java Spring Boot - Code generation does not contain setters for fields

When the Java Spring Boot code generator is being used, it does not create setters for the different fields in the classes. With that it is basically unusable, but of course devs can extend it if they want.

It would be better to have proper getter/setters for the fields in the different classes.

Example:

RestController looks fine:

package my_action;

    import java.util.List;

    import org.springframework.web.bind.annotation.PathVariable;
    import org.springframework.web.bind.annotation.PostMapping;
    import org.springframework.web.bind.annotation.RequestBody;
    import org.springframework.web.bind.annotation.RestController;

    @RestController
    class ActionController {
    @PostMapping("/getOrders")
    OrderQueryOutput handler(@RequestBody getOrdersArgs actionArgs) {
        // logic
    }
}

Generated classes not:

public class OrderQueryOutput {
  private Iterable<Order> _orders;
  public Iterable<Order> getorders() { return this._orders; }
}

public class Order {
  private String _orderId;
  public String getorderId() { return this._orderId; }
}

public class Query {
  private OrderQueryOutput _getOrders;
  public OrderQueryOutput getgetOrders() { return this._getOrders; }
}

public class getOrdersArgs {
  private ZonedDateTime _fromDate;
  public ZonedDateTime getfromDate() { return this._fromDate; }
  
  private ZonedDateTime _toDate;
  public ZonedDateTime gettoDate() { return this._toDate; }
}

The name of the class that is being used for the incoming parameters are also strange, but can work.

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.