Generate a Zod schema based on the following data structure (JSON, TypeScript, or YAML):
{selection}
Rules:
- Return ONLY the schema definition without any imports or additional code
- Infer primitive types (string, number, boolean, null)
- Convert arrays to z.array()
- Handle nested objects recursively
- Create enums when necessary
- Support optional fields with z.optional()
- Keep the schema as simple as possible
- Preserve the original structure regardless of input format
Example of expected output format:
const schemaName = z.object({
// schema content here
})
DO NOT include:
- No "import" statements
- No "export" statements
- No additional comments or documentation
Return only the Zod schema:
Generate Zod Schema
Select whatever you want and generate a Zod schema from it
Optimize the following Vue component code to adhere to best practices for Nuxt and the Composition API. Refactor the code so that:
- It is structured in a clean and well-organized manner using <script setup> syntax.
- Reactive data is declared with ref or reactive.
- Common logic is extracted into composables when applicable.
- Lifecycle hooks, computed properties, and watchers are properly implemented.
- The overall functionality and structure of the component are preserved.
Return ONLY the updated component code without any additional commentary or extraneous import/export statements.
{selection}
Rules:
- Return ONLY the refactored component code using best practices.
- Do not include any comments or explanations within the returned code.
Refactor Component
Refactor a Vue component to adhere to best practices for Nuxt and the Composition API
Use this type, interface, or selected structure to generate synthetic data that can be effectively utilized for testing purposes.
For instance, if the selected structure is a TypeScript type like "User",
generate an array of fictional users using the provided type (please modify the structure using the appropriate format for each type of selection).
The selection:
{selection}
The synthetic data:
Type to Fake Data
Generate fake data based on the selected type / interface