Skip to content

Support generating types only #2255

@Georgegriff

Description

@Georgegriff

Use case: We want all the runtime code checked into the repo, we want to be able to review this code for breakages.
But for types we feel like that's less necessary and can't generate at npm install time/in CI

You can kind of do it like this:

  react_query: {
    input: {
      target: "./schema.json",
    },
    output: {
      mode: "tags-split",
      target: "generated/schema.ts",
      schemas: "generated/types",
      client: "react-query",
      prettier: true,
      },
    },
  },
  types_only: {
    input: {
      target: "./schema.json",
    },
    output: {
      mode: "tags-split",
      schemas: "internal/generated/types",
      target: "internal/generated/types/file.ts",
    },
  },

And then run the appropriate configs in scripts

The only issue this generates a default http client too, its not a deal breaker it just leads to un-used code

Happy to hear if there are better ways of achieving this, or suggestions on how to implement and i could look at PR, unless its not something orval is interested in

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions