Skip to content

Latest commit

 

History

History
128 lines (73 loc) · 7.28 KB

maintaining-annotations-with-language-server-6fc93f8.md

File metadata and controls

128 lines (73 loc) · 7.28 KB

Maintaining Annotations with Language Server

Maintaining OData annotations in .cds files is accelerated by the SAP Fiori tools - CDS OData Language Server comprised in SAP CDS Language Support plugin. It assists you with adding and editing OData annotations in CDS syntax with:

  • Code completion for annotations applied to entities and entity elements
  • Validation against the OData vocabularies and project metadata
  • Navigation to the referenced annotations
  • Quick view of vocabulary information
  • Internationalization (i18n) support for language-dependent strings

SeeCAP CDS and Serving Fiori UIs: Adding Fiori Annotation for more information about CDS OData Language Server.

Note:

The SAP Business Application Studio SAP Fiori dev space doesn’t include the CDS OData Language Server extension.

Maintaining OData annotations in annotation.xml files is accelerated by the XML annotation language server extension of SAP Fiori tools. It assists you with adding and editing OData annotations in XML syntax with the code completion, validation, and other assisting features, same as CDS OData Language Server in CAP CDS files. To get this assistance, just open the local annotation file in the code editor. You can either open local annotation file from Service Modeler or single/double-click on the local annotation file of your project: /webapp/annotations/<filename>.xml.

Using XML Annotation Language Server

Prerequisites

To maintain the annotations using XML annotation language server features, project needs to meet the following criteria:

  • OData service

    Your project contains the local copy of service metadata. The path to this copy is provided in the SAP OData vocabularies manifest.json file as a local Uri.

    Note:

    The local copies of the metadata and back-end annotations are used for code completion and diagnostics in local annotation file, it’s important that it stays in sync with the service metadata state in back end. It is not synced automatically with the metadata on the back-end system. You can sync the local copy of the service metadata with the back end. For more information, see Syncing Annotations.

    The metadata of the OData serviceSAP OData must include one or multiple edm:Schema\ definitions within the edmx:DataServices\ element.

    According to the OData CSDL, your metadata file must contain a single EntityContainer.

    Note:

    The namespace of the OData service should not contain / (slashes). The OData specification requires namespaces to consist of one or more SimpleIdentifiers separated by dots. Slashes aren’t supported. A SimpleIdentifier must start with a letter or underscore, followed by a maximum of 127 letters, underscores, and digits.

  • Local Annotation File

    Your project contains at least one valid annotation XML file that includes the < /edmx:DataServices/Schema> node and references to the metadata. The metadata namespace must match that of the metadata file.

    Note:

    If your project does not contain an annotation.xml file or you need more than one, you can create a new annotation file automatically registered in manifest.json. For more information, see Visualizing Annotations with Service Modeler.

  • manifest.json file

    Your project contains a manifest.json file with the following information:

    • Uri and localUri of the OData service
    • List of OData annotation sources
    • @i18n model with the uri to the i18n.properties file

    Note:

    All paths used in annotation file are relative to the location of the manifest.json file.

    Note:

    For more information on how to maintain the configuration in the manifest.json file, see Visualizing Annotations with Service Modeler.

Supported Vocabularies

The XML annotation language server is based on the official OASIS vocabularies and https://github.com/SAP/odata-vocabularies (OData version 4.0) The following vocabularies are supported:

OData org

SAP

OData

For more information about OData:

Limitations

  • Annotations directly embedded in the metadata are not supported.

  • Dynamic expressions are not supported.