Skip to content

add option to omit validation keywords#254

Open
devanshi00 wants to merge 2 commits into
accordproject:mainfrom
devanshi00:main
Open

add option to omit validation keywords#254
devanshi00 wants to merge 2 commits into
accordproject:mainfrom
devanshi00:main

Conversation

@devanshi00

Copy link
Copy Markdown

Closes #253

Changes

  • Added an optional omitValidators parameter to JSONSchemaVisitor, defaulting to false to preserve existing behavior.

  • Updated getFieldOrScalarDeclarationValidatorsForSchema() to skip emitting validator-derived JSON Schema keywords when omitValidators is enabled.

  • Added JSDoc documentation for the new parameter and its effect on generated schemas.

  • Covered all validator-derived keywords emitted by the visitor, including:

    • pattern
    • format (uuid, date-time)
    • minLength
    • maxLength
    • minimum
    • maximum
    • exclusiveMinimum
    • exclusiveMaximum
    • multipleOf

Flags

  • Default behavior is unchanged; validator keywords continue to be emitted unless explicitly disabled.
  • Intended to improve compatibility with strict LLM structured-output APIs such as OpenAI and Anthropic, which reject these validation keywords.

Screenshots or Video

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commit messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

Signed-off-by: “Devanshi <117909426+devanshi00@users.noreply.github.com>

@DianaLease DianaLease left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but can you fix this lint errors?

/Users/runner/work/concerto-codegen/concerto-codegen/lib/codegen/fromcto/jsonschema/jsonschemavisitor.js
Error:   406:42  error  Trailing spaces not allowed  no-trailing-spaces
Error:   486:54  error  Trailing spaces not allowed  no-trailing-spaces
Error:   622:60  error  Trailing spaces not allowed  no-trailing-spaces

Signed-off-by: “Devanshi <117909426+devanshi00@users.noreply.github.com>
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.

JSONSchemaVisitor: add option to omit validation keywords for strict structured-output consumers

2 participants