# zod

Published articles for zod.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## LangChain: Structured Output with JavaScript

DevFeed: [LangChain: Structured Output with JavaScript](<https://devfeed.tech/articles/langchain-structured-output-with-javascript-18945.md>)

Original publisher: [Read original article](<https://www.robinwieruch.de/langchain-javascript-structured/>)

Author: Robin Wieruch

Published: 2025-01-27T06:52:46Z

Content type: tutorial

Language: en

Sources: [Robin Wieruch](<https://devfeed.tech/sources/robin-wieruch.md>)

Topics: [LangChain](<https://devfeed.tech/topics/langchain.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>), [Next.js](<https://devfeed.tech/topics/next-js.md>), [React](<https://devfeed.tech/topics/react.md>), [API](<https://devfeed.tech/topics/api.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [OpenAI](<https://devfeed.tech/topics/openai.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [langchain](<https://devfeed.tech/tags/langchain.md>), [langchain-javascript-structured-output](<https://devfeed.tech/tags/langchain-javascript-structured-output.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [react](<https://devfeed.tech/tags/react.md>), [schema](<https://devfeed.tech/tags/schema.md>), [structured-output](<https://devfeed.tech/tags/structured-output.md>), [validation](<https://devfeed.tech/tags/validation.md>), [zod](<https://devfeed.tech/tags/zod.md>)

### AI overview

This tutorial demonstrates how to build structured-output responses with LangChain in JavaScript. It uses Next.js and React for the application, the OpenAI API for chatbot responses, and Zod to define and validate a shared schema between the backend and frontend.

### Source excerpt

How to: Structured Output in JavaScript with LangChain. A step by step example on how to use structured data in JavaScript with LangChain ...

## React and FormData

DevFeed: [React and FormData](<https://devfeed.tech/articles/react-and-formdata-18961.md>)

Original publisher: [Read original article](<https://www.robinwieruch.de/react-form-data/>)

Author: Robin Wieruch

Published: 2024-11-11T04:50:46Z

Content type: tutorial

Language: en

Sources: [Robin Wieruch](<https://devfeed.tech/sources/robin-wieruch.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [Forms](<https://devfeed.tech/topics/forms.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [HTML](<https://devfeed.tech/topics/html.md>), [Raycast extension](<https://devfeed.tech/topics/raycast-extension.md>)

Tags: [errors](<https://devfeed.tech/tags/errors.md>), [forms](<https://devfeed.tech/tags/forms.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [library](<https://devfeed.tech/tags/library.md>), [react](<https://devfeed.tech/tags/react.md>), [react-form-data](<https://devfeed.tech/tags/react-form-data.md>), [schema](<https://devfeed.tech/tags/schema.md>), [server](<https://devfeed.tech/tags/server.md>), [validation](<https://devfeed.tech/tags/validation.md>), [zod](<https://devfeed.tech/tags/zod.md>)

### AI overview

This tutorial explains how to convert React FormData into a JavaScript object when submitting forms with actions. It covers concise conversion, destructuring, Zod typing and validation, and correctly handling multiple values with the same key, including checkbox and select inputs.

### Source excerpt

Learn how to handle FormData in React when submitting it with a (Server) Action to the server ...

## AWS API Gateway's Request Validation: Navigating the Quirks

DevFeed: [AWS API Gateway's Request Validation: Navigating the Quirks](<https://devfeed.tech/articles/aws-api-gateway-s-request-validation-navigating-the-quirks-23894.md>)

Original publisher: [Read original article](<https://medium.com/smg-real-estate/aws-api-gateways-request-validation-navigating-the-quirks-38285cb0a1c1?source=rss----2186e5b9bd8f---4>)

Author: Thomas Klein

Published: 2024-08-09T12:07:11Z

Content type: tutorial

Language: en

Sources: [Homegate Engineering Blog - Medium](<https://devfeed.tech/sources/homegate-engineering-blog-medium.md>)

Topics: [Amazon API Gateway](<https://devfeed.tech/topics/amazon-api-gateway.md>), [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [API](<https://devfeed.tech/topics/api.md>), [gateway](<https://devfeed.tech/topics/gateway.md>), [JSON Schema](<https://devfeed.tech/topics/json-schema.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [enum](<https://devfeed.tech/topics/enum.md>), [HTTP](<https://devfeed.tech/topics/http.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [api-gateway](<https://devfeed.tech/tags/api-gateway.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-api-gateway](<https://devfeed.tech/tags/aws-api-gateway.md>), [aws-lambda](<https://devfeed.tech/tags/aws-lambda.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gateway](<https://devfeed.tech/tags/gateway.md>), [handler](<https://devfeed.tech/tags/handler.md>), [http](<https://devfeed.tech/tags/http.md>), [json](<https://devfeed.tech/tags/json.md>), [json-schema](<https://devfeed.tech/tags/json-schema.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [middy](<https://devfeed.tech/tags/middy.md>), [tests](<https://devfeed.tech/tags/tests.md>), [type-safety](<https://devfeed.tech/tags/type-safety.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [validation](<https://devfeed.tech/tags/validation.md>), [zod](<https://devfeed.tech/tags/zod.md>)

### AI overview

This tutorial examines AWS API Gateway request validation. It explains that query-parameter presence is checked, but enum values may not be enforced, while POST and PUT payloads are validated with JSON Schema Draft 4. It also discusses generic error messages and TypeScript-based validation approaches.

### Source excerpt

AWS API Gateway's request validation follows a specific set of rules that developers should be aware of when setting up their APIs. While it offers some validation features, it's important to understand its scope and limitations. Let's examine how it works with a common API configuration: parameters: - name: offerType in: query required: true description: RENT or BUY schema: type: string enum: - RENT - BUY With this configuration, API Gateway diligently checks for the presence of the query parameter, returning an HTTP 400 error if it's missing. However, it falls short when it comes to validating the actual value. Surprisingly, it would accept "KERMIT" without batting an eye, despite the clear enum specification. This behavior, while documented, can be a source of frustration for developers expecting more comprehensive validation. Interestingly, API Gateway shows more validation prowess with POST and PUT requests. It validates request payloads using JSON Schema Draft 4, demonstrating a somewhat inconsistent approach to input validation across different HTTP methods. Even when it does catch an error, API Gateway's feedback is less than illuminating. Instead of specific error details, you're met with a generic {"message": "Invalid request body"}. For more information, you'll need to dig into the associated log streams, which isn't ideal for surfacing error details in API responses. Example output in AWS console from a failed request validation when a body request validator is setup. API Gateway's validation is handy, but it leaves a lot to be desired. Developers often need to add extra checks for a truly robust API. While API Gateway supports various integrations and Lambda languages, let's focus on TypeScript. TypeScript's strong typing and runtime checks can catch issues early, sparing your users from cryptic error messages. Let's explore how to use this to make your API smarter and your users happier. Option 1: DIY Validation (AKA The "I've Got Trust Issues" Approac