cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CAP ODATA Annotations - Property Value Example

Cristian
Participant
556

Hi experts,

I am trying to add some annotations to my entity properties:

    @mandatory provider: String (60)
    @assert.notNull: false
    @description: 'Infrastructure provider';

I would like to add now an annotation for given a property example. Any idea how this can be done using annotation below?

@Core.Example

Many thanks!

View Entire Topic
evandropramos
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Cristian, how are you doing?
Please try the following:

@Core.Example : {
  $Type : 'Core.PrimitiveExampleValue',
  Value : '<your example here>',
}

You can also add a complex type if you need as follows:

@Core.Example: {
  $Type: 'Core.ComplexExampleValue', 
  Value: {
    myProperty: '<your example here for myProperty>'
  }
}

Regards,

Evandro

gregorw
SAP Mentor
SAP Mentor

You might also check the ExampleValue definition in the OData Standard Vocabulary.