Skip to content

add info segment about json schema validation of default values#1224

Open
janglad wants to merge 1 commit intoEffect-TS:mainfrom
janglad:json-schema-default-values-doc
Open

add info segment about json schema validation of default values#1224
janglad wants to merge 1 commit intoEffect-TS:mainfrom
janglad:json-schema-default-values-doc

Conversation

@janglad
Copy link
Copy Markdown

@janglad janglad commented Oct 6, 2025

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This really caught me off guard when using @effect/ai when adding a filter to my schema reduced the quality of my results by quite a bit because I unknowingly removed all examples values being sent to the LLM, especially since while this behaviour makes sense it differs from inspecting examples on the AST

import { JSONSchema, Schema } from "effect"

const schema = Schema.Trim.pipe(Schema.annotations({
  description: "my custom description",
  title: "my custom title",
  default: "",
  examples: ["a", "  b", "c"]
}))

console.log(schema.ast.annotations)
/*
...
{
  [Symbol(effect/annotation/Title)]: 'my custom title',
  [Symbol(effect/annotation/Description)]: 'my custom description',
  [Symbol(effect/annotation/Examples)]: [ 'a', '  b', 'c' ],
  [Symbol(effect/annotation/Default)]: ''
}
...
 */

const jsonSchema = JSONSchema.make(schema)
console.log(jsonSchema)
/*
...
{
  '$schema': 'http://json-schema.org/draft-07/schema#',
  type: 'string',
  description: 'my custom description',
  title: 'my custom title',
  default: '',
  examples: [ 'a', 'c' ]
}
...
*/

Related

  • Related Issue #
  • Closes #

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 6, 2025

@janglad is attempting to deploy a commit to the Effect Team on Vercel.

A member of the Team first needs to authorize it.

@IMax153 IMax153 requested a review from gcanti October 6, 2025 16:20
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.

1 participant