question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client-side code generation

See original GitHub issue

Is your feature request related to a problem? Please describe. Currently, the main purpose of the plugin is to generate server-side code (POJOs and interfaces). The idea is to add support of client-side classes generation. This will allow users to build a GraphQL request.

Describe the solution you’d like Schema example:

type Mutation {
    newBike(bikeInput: BikeInput!): Bike
}

input BikeInput {
    type: BikeType!
    brand: String!
    size: String!
    price: BigDecimal
}

type Bike {
    id: ID
    type: BikeType
    brand: String
    size: String
    price: BigDecimal
    addedDateTime: DateTime
}

Generated class:

public class NewBikeMutationRequest {
    private BikeInput bikeInput;
    //getters/setters
}

public class BikeInputTO {
    private BikeTypeTO type;
    private String brand;
    private String size;
    private String price;

    public BikeInputTO() { }

    //getters/setters

The end-user will then use these classes to build the request and response projection (open question for now). So that it will be serialized to the following request string:

mutation newBike {
  newBike(bike: {
    type: ROAD,
    brand: "LOL",
    size: "Big",
    year: 2019,
    price: "123.45"
  }) {
    id
    addedDateTime
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joffrey-bioncommented, Apr 3, 2020

I was not able to find a solution for client-side code generation in Java.

Yes, I was actually mentioning code generators in general. The one I heard about was for Swift I think.

The idea of this feature would be:

  1. Define the projection of the response object (which fields to fetch)
  2. Properly serialize the request.

Oh OK, so you want to build client queries in Java directly? That could be a way too, I just felt like the idea of this library was to go schema-first, so I expected a query-first solution here. But that implies parsing queries. I don’t know if the library you’re using can do this.

0reactions
kobylynskyicommented, Apr 11, 2020

@JustinBlandford This feature is available in plugin version 1.6.0.

Please feel free to open an issue in this project or feature request if you have any suggestions/ideas. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tutorial & Sample] How to use OData Client Code Generator ...
[Tutorial & Sample] How to use OData Client Code Generator to generate client-side proxy class ; Start Visual Studio, from the TOOLS menu,...
Read more >
How to Generate Client Code Based on Defined Tables
Login to Backendless Console, select your app and click the Code Generation icon. Select the client-side environment you will be working ...
Read more >
API Code & Client Generator | Swagger Codegen
Codegen simplifies your build process by generating server stubs and client SDKs for any API defined with the OpenAPI specification. Download Codegen today....
Read more >
Generate client side code using Swagger Codegen
Swagger codegen is the tool that we are going to use for generating client side code. You can simple download swagger codegen from...
Read more >
Flexible Client-side QR Code Generator - CSS Script
Just another flexible, customizable, client-side QR code generator built using pure JavaScript. Also supports Java, Python, Rust, C, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found