Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(swagger-zod): add newline into generated zod schema #750

Conversation

b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Copy link
Contributor

There are many times when I need to refer to the zod schema, but the existing generated code was written in one line and was not good. So, I added a newline to improve readability.

Before:

export const componentCreateProjectRequestSchema = z.object({"email": z.string(),"project": z.object({"channel": z.string().optional(),"member_ids": z.array(z.string()).optional(),"department": z.string(),"description": z.string().optional(),"name": z.string(),"type": z.string().optional()})});

After:

export const createProjectRequestSchema = z.object({
    "email": z.string(),
    "project": z.object({
        "channel": z.string().optional(),
        "member_ids": z.array(z.string()).optional(),
        "department": z.string(),
        "description": z.string().optional(),
        "name": z.string(),
        "type": z.string().optional()
    })
});

Copy link

changeset-bot bot commented Dec 26, 2023

⚠️ No Changeset found

Latest commit: 3ecc9fb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kubb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 26, 2023 3:33am

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3ecc9fb:

Sandbox Source
advanced-pet-store Configuration
faker-pet-store Configuration
msw-pet-store Configuration
msw-v2-pet-store Configuration
react-query-pet-store Configuration
react-query-v5-pet-store Configuration
typescript-pet-store Configuration
simple-single-pet-store Configuration
solid-query-pet-store Configuration
svelte-query-pet-store Configuration
swr-pet-store Configuration
vue-query-pet-store Configuration
vue-query-v5-pet-store Configuration
zod-pet-store Configuration
zodios-pet-store Configuration
client-pet-store Configuration

@stijnvanhulle
Copy link
Collaborator

Why not just use a formatter like prettier, biome, dprint, ...?

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Copy link
Contributor Author

Why not just use a formatter like prettier, biome, dprint, ...?

@stijnvanhulle I also think it's better to use this methods. Is there any code in this repository that I can refer to?

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Copy link
Contributor Author

@stijnvanhulle I found a way to solve it using hooks as shown below.

  hooks: {
    done: ['npx dprint fmt'],
  },

So I'll close this PR.

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs b6pzeusbc54tvhw5jgpyw8pwz2x6gs deleted the add-newline-for-generated-zod-schema branch December 30, 2023 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants