File tree Expand file tree Collapse file tree
pages/config-wizard/tabs/entities-tab Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,6 +248,15 @@ export interface IRelationship {
248248 'linking.target.fields' ?: string [ ] ;
249249}
250250
251+ /**
252+ * Field configuration for entity
253+ */
254+ export interface IFieldConfig {
255+ name : string ;
256+ description ?: string ;
257+ 'primary-key' ?: boolean ;
258+ }
259+
251260/**
252261 * Entity configuration
253262 */
@@ -260,6 +269,7 @@ export interface IEntityConfig {
260269 mcp ?: IEntityMcpConfig | boolean ;
261270 mappings ?: Record < string , string > ;
262271 relationships ?: Record < string , IRelationship > ;
272+ fields ?: IFieldConfig [ ] ;
263273}
264274
265275/**
Original file line number Diff line number Diff line change @@ -801,7 +801,7 @@ import { SchemaImporterService } from '../../../../services/schema-importer.serv
801801 </button>
802802 }
803803 <a
804- href="https://learn.microsoft.com/en-us/azure/data-api-builder/configuration/fields "
804+ href="https://learn.microsoft.com/en-us/azure/data-api-builder/mcp/how-to-add-descriptions "
805805 target="_blank"
806806 rel="noopener noreferrer"
807807 class="ms-2 text-decoration-none"
Original file line number Diff line number Diff line change @@ -227,6 +227,36 @@ export class ConfigBuilderService {
227227 config . mcp = entity . mcp ;
228228 }
229229
230+ // Add fields if columns have descriptions or are primary keys
231+ if ( entity . columns && entity . columns . length > 0 ) {
232+ const fields = entity . columns
233+ . map ( ( col ) => {
234+ const field : { name : string ; description ?: string ; 'primary-key' ?: boolean } = {
235+ name : col . name ,
236+ } ;
237+
238+ if ( col . description && col . description . trim ( ) ) {
239+ field . description = col . description . trim ( ) ;
240+ }
241+
242+ if ( col . isPrimaryKey ) {
243+ field [ 'primary-key' ] = true ;
244+ }
245+
246+ // Only include fields that have a description or are primary keys
247+ return col . description ?. trim ( ) || col . isPrimaryKey ? field : null ;
248+ } )
249+ . filter ( ( field ) => field !== null ) as Array < {
250+ name : string ;
251+ description ?: string ;
252+ 'primary-key' ?: boolean ;
253+ } > ;
254+
255+ if ( fields . length > 0 ) {
256+ config . fields = fields ;
257+ }
258+ }
259+
230260 return config ;
231261 }
232262
You can’t perform that action at this time.
0 commit comments