codegen-assets's Issues
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.
rename zeit to vercel, zeit is now vercel
Rename all Zeit string referrals to Vercel.
if an action returns a list of objects, codegen still returns an object
These are the bunch of cases where codegen does incorrect things:
- If the derived action returns an object but the parent operation returns a list, it causes runtime error.
- If an action returns a list, codegen still returns just an object
improve express codegen to remove routing
The codegen looks like:
app.post((req, res) => {
// hanler code
})
Most intuitive for any express developer to just copy and paste this in server.js
.
Update builder-kit/ actions codegen starter script that removes mutation keywords
Latest version of codegen with documentation is available at: nodejs-azure/actions-codegen.js. Use that as a base.
enable users to download/clone starter-kit for a particular framework only
Add a tester function and instructions to the builder-kit
Spec for builder kit is already in the documentation: https://github.com/hasura/codegen-assets/blob/master/builder-kit/README.md#run-the-sample-codegen
Add starter kit for nodejs azure
Go codegen struct JSON tags
The json serialization doesn't handle lowercase/underscored column names when serializing to JSON. The struct fields are missing json tags to convert into lowercase. This might not really be a problem when GraphQL camelcase naming conventions are used, but databases might use lowercase/underscores by default.
type AutoGenerated struct {
Name string `json:"name"`
}
https://github.com/hasura/codegen-assets/blob/master/builder-kit/src/languages-functional/go.ts#L25
request headers not forwarded to parent operation in derived actions
When an action is derived from a Hasura operation, the generated code does not send request headers while delegating to the parent operation.
Rename nodejs-azure -> nodejs-azure-function
Turns out nodejs-azure
is a separate product on azure.
accept a list of Hasura types so that graphql-code-generator does not error out
Actions support postgres scalars now (hasura/graphql-engine#4333).
This causes a problem in typescript codegen because graphql-code-generator expects the SDL to be complete in itself.
Currently we have a hack to make the codegen work. The SDL is parsed and the types not found in the SDL are manually added as scalars.
A better solution would be to take Hasura scalars as an argument for the code generator.
add automation for zipping and uploading the assets files before each merge
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 } );
}
update the READMEs of the starter-kits with elaborate instructions
destructure the request payload for better readability of the generated code
We can generate:
const {
input: { arg1, arg2 },
session_variables,
action: { name: actionName }
} = req.body;
Currently we just generate:
const { arg1, arg2 } = req.body.input;
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.