Code Monkey home page Code Monkey logo

Comments (4)

berngp avatar berngp commented on July 19, 2024 1

Hi @marceloverdijk , thanks for making the suggestions. I'm working on a PR for this since a team internally requires it, will keep you updated.

from dgs-codegen.

berngp avatar berngp commented on July 19, 2024 1

@marceloverdijk PR out #104

from dgs-codegen.

marceloverdijk avatar marceloverdijk commented on July 19, 2024

I would also like that :-)

In ConstantsGenerator currently the GraphQL definition name is simply upper cased like:

    private fun createConstantTypeBuilder(name: String): TypeSpec.Builder {
        return TypeSpec.classBuilder(name.toUpperCase())
            .addModifiers(Modifier.PUBLIC, Modifier.STATIC)
    }

This could be changed to e.g. (of course with a flag for backwards compatibility):

    private fun createConstantTypeBuilder(name: String): TypeSpec.Builder {
        return TypeSpec.classBuilder(name.replaceAll("(.*)([A-Z])", "$1_$2").toUpperCase())
            .addModifiers(Modifier.PUBLIC, Modifier.STATIC)
    }

This would result in: DGS_ARTIFACT_VERSION_IN_ENVIRONMENT

Some other examples:

  • IMDbMovie --> IMDB_MOVIE
  • G2AVoucher --> G2A_VOUCHER

from dgs-codegen.

marceloverdijk avatar marceloverdijk commented on July 19, 2024

Now only need to think of a good flag name; can't think of anything better than generateUnderscoreInConstantNames/useUnderscoreInConstantNames

@srinivasankavitha / @paulbakker Wdyt? As I could provide a PR for this.

from dgs-codegen.

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.