Giter VIP home page Giter VIP logo

Comments (7)

moltar avatar moltar commented on August 9, 2024 1

It is not a problem that it will not match, because I will convert the responses too to match camelCase.

from dtsgenerator.

horiuchi avatar horiuchi commented on August 9, 2024

@moltar Thank you for using this!

That can convert type name to use the dtsgenerator as a library.
https://github.com/horiuchi/dtsgenerator#usage-for-library

from dtsgenerator.

moltar avatar moltar commented on August 9, 2024

Thank you for replying so quickly!

I saw that type renames are possible via library.

But my use case is to rename the property names, not types.

E.g.

Interface foo {
some_prop: string
}

To

Interface foo {
someProp: string
}

Sent with GitHawk

from dtsgenerator.

horiuchi avatar horiuchi commented on August 9, 2024

Oh sorry, I'm mistaken.

But in a normal case, we use it for converting the API response or request definition to TypeScript definition.
If it changes the property name, the TypeScript definition may not fit together API's JSON.

Do you want it in any situation?

from dtsgenerator.

adriengibrat avatar adriengibrat commented on August 9, 2024

Did you consider to align naming convention between API producer & consumer?
It would be a great move, IMHO ;)

from dtsgenerator.

amoshydra avatar amoshydra commented on August 9, 2024

Off-topic:

Did you consider to align naming convention between API producer & consumer?
It would be a great move, IMHO ;)

I am curious how is this usually done, especially when API producer and consumer are written in different languages that following different casing convention. Do you still try to set a casing convention between API producer and consumer?


In our situation producer (our API server) is written in ruby (which uses snake_case), whereas consumer uses JS/TS (camelCase). Trying to use a foreign casing will often trigger our linter.

Most of our consumer will do a snake_case --> camelCase in the response, and camelCase --> snake_case in the request.

from dtsgenerator.

horiuchi avatar horiuchi commented on August 9, 2024

It is now possible to convert property names using the plugin's post process.
Please consider it.

from dtsgenerator.

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.