cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to enable custom annotations for CDS Language Support extension?

pepl
Active Participant
0 Kudos
148

Hi!

I'd like to extend my CAP model with more assotiations ( which I'll use in my custom code ). 

For example something like this:

using { projects } from './projects';

@abap.ddic.table: ZPROJECTS
annotate projects with {
     @ABAP.ddic: {
        dataElement: {
            domain: {
                name: 'ZPROJECT_ID',
                description: 'Project Id',
                dataType: CHAR,
                length: 32                
            }
        }
    }
    id;

Is there a way to register a custom schema within the extension, that's how it will also see my new annotations and will enable code suggestions or enforce schema validations?

Thanks!

View Entire Topic
pepl
Active Participant
0 Kudos

Hi @catano  Peter

So i have a crazy idea to support deployment of CAP model to ABAP,

For that purpose I'd like to compile abapgit / gcts artifacts instead of hdbtable/hdbview.

I find it important to have a dedicated files with annotations.

So i do not need these annotations to be presented in the Odata metadata. Instead I would prefer if not.

What I'm going to do is to load this model with cds.load( ) and write an own compiler of abap files, which we can deploy later using  corresponding tools ( abapGit or gCTS ).

However to generate ABAP DDIC artifacts we need to have certain attributes such as 

- table name and its properties

- data element name and its properties

- domain name

and more..

If it works - I see how CAP would save hours of our work for data modeling. Especially with supported by AI which is text-based

pepl
Active Participant
0 Kudos
However this annotation structure can be quite structured since we have different objects and their properties. So I think about ability to design those types with typescript and somehow attach them to CDS extension ( even via compiled files like json schemas ) that's how the extension would be aware of my extension types.
catano
Active Participant
0 Kudos

Hi @pepl,

I see, that seems to be a good idea.

So you imagine something like cds deploy --to abap, right? I'm not familiar with the structure and data content of abapgit / gcts files, but I'm quite sure that a deterministic mapping could be created for cap schema -> abapgit / gcts. I'm not sure if it is possible to add such thing without modifing the cds library itself, but knowing that exact mapping the conversion is possible, and I can imagine a VSCode extension to do such task.

Regards, Peter

pepl
Active Participant
0 Kudos
I think for the beginning CDs compile —to abapGit is already enough. But currently the scope is not even about the CLI but more like a tooling. I’m curious how to make the extension aware of custom annotations