@@ -18,6 +18,7 @@ import Ajv from 'ajv';
1818import * as assert from 'assert' ;
1919import { afterEach , describe , it , mock } from 'node:test' ;
2020
21+ import { GENKIT_UI_METADATA } from '../src/metadata.js' ;
2122import { setGenkitRuntimeConfig } from '../src/config.js' ;
2223import {
2324 ValidationError ,
@@ -169,48 +170,48 @@ describe('toJsonSchema', () => {
169170describe ( 'annotateSchema()' , ( ) => {
170171 it ( 'should merge annotations into the JSON schema' , ( ) => {
171172 const schema = annotateSchema ( z . string ( ) , {
172- 'x-genkit-data-source' : 'my-action' ,
173+ [ GENKIT_UI_METADATA . DATA_SOURCE ] : 'my-action' ,
173174 } ) ;
174175
175176 const json = toJsonSchema ( { schema } ) ;
176- assert . strictEqual ( json [ 'x-genkit-data-source' ] , 'my-action' ) ;
177+ assert . strictEqual ( json [ GENKIT_UI_METADATA . DATA_SOURCE ] , 'my-action' ) ;
177178 } ) ;
178179
179180 it ( 'should merge annotations for nested fields' , ( ) => {
180181 const schema = z . object ( {
181182 field : annotateSchema ( z . string ( ) , {
182- 'x-genkit-data-source' : 'nested-action' ,
183+ [ GENKIT_UI_METADATA . DATA_SOURCE ] : 'nested-action' ,
183184 } ) ,
184185 } ) ;
185186
186187 const json = toJsonSchema ( { schema } ) ;
187188 assert . strictEqual (
188- json . properties . field [ 'x-genkit-data-source' ] ,
189+ json . properties . field [ GENKIT_UI_METADATA . DATA_SOURCE ] ,
189190 'nested-action'
190191 ) ;
191192 } ) ;
192193
193194 it ( 'should merge annotations for array items' , ( ) => {
194195 const schema = z . array (
195196 annotateSchema ( z . string ( ) , {
196- 'x-genkit-data-source' : 'array-action' ,
197+ [ GENKIT_UI_METADATA . DATA_SOURCE ] : 'array-action' ,
197198 } )
198199 ) ;
199200
200201 const json = toJsonSchema ( { schema } ) ;
201- assert . strictEqual ( json . items [ 'x-genkit-data-source' ] , 'array-action' ) ;
202+ assert . strictEqual ( json . items [ GENKIT_UI_METADATA . DATA_SOURCE ] , 'array-action' ) ;
202203 } ) ;
203204
204205 it ( 'should merge annotations for optional fields' , ( ) => {
205206 const schema = z . object ( {
206207 field : annotateSchema ( z . string ( ) , {
207- 'x-genkit-data-source' : 'optional-action' ,
208+ [ GENKIT_UI_METADATA . DATA_SOURCE ] : 'optional-action' ,
208209 } ) . optional ( ) ,
209210 } ) ;
210211
211212 const json = toJsonSchema ( { schema } ) ;
212213 assert . strictEqual (
213- json . properties . field [ 'x-genkit-data-source' ] ,
214+ json . properties . field [ GENKIT_UI_METADATA . DATA_SOURCE ] ,
214215 'optional-action'
215216 ) ;
216217 } ) ;
0 commit comments