Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #10088
Closed
Open
Issue created Aug 03, 2021 by Administrator@rootContributor

[REQ] [typescript-*] add flag to don't convertation some types

Created by: gormonn

Hello! I partially use your wonderful tool to generate types for redux-toolkit-query. More details can be found here: https://github.com/rtk-incubator/rtk-query-codegen/issues/63#issuecomment-879219548

However, when the API changes, I have to compare the new generated files with the old ones. For example, since Redux prefers to store serializable data, I need to rewrite the generated date to string types, and then I need to rewrite some functions that convert strings to dates. From:

interface Car {
  id: string;
  yearOfManufacture: Date;
}
function CarFromJSON(json: any): Car {
  return {
    id: json['id'],
    yearOfManufacture: new Date(json['year_of_manufacture']),
  };
}

To:

interface Car {
  id: string;
  yearOfManufacture: string;
}
function CarFromJSON(json: any): Car {
  return {
    id: json['id'],
    yearOfManufacture: json['year_of_manufacture'],
  };
}

So... With each new iteration, the number of models grows, and such differences between the generated types and the actual ones remain. This makes Diff very difficult.

What I suggest: Perhaps there is a way to make the generator behavior customizable? For example for data serializability.

Assignee
Assign to
Time tracking