diff --git a/file-formats/csnm/README.md b/file-formats/csnm/README.md new file mode 100644 index 000000000..6996ea84e --- /dev/null +++ b/file-formats/csnm/README.md @@ -0,0 +1,6 @@ +# CSNM File Format + +File | Cardinality | Definition | Schema | Example +:--- | :--- | :--- | :--- | :--- +`.csnm.json` | 1 | [`zif_aff_csnm_v1.intf.abap`](./type/zif_aff_csnm_v1.intf.abap) | [`csnm-v1.json`](./csnm-v1.json) | [z_aff_example_csnm.csnm.json](./examples/z_aff_example_csnm.csnm.json) +`.csnm..csn` | 0...n | - | - | [z_aff_example_csnm.csnm.model_inferred.csn](./examples/z_aff_example_csnm.csnm.model_inferred.csn) diff --git a/file-formats/csnm/csnm-v1.json b/file-formats/csnm/csnm-v1.json new file mode 100644 index 000000000..9a7454e7d --- /dev/null +++ b/file-formats/csnm/csnm-v1.json @@ -0,0 +1,83 @@ +{ + "$comment": "This file is autogenerated, do not edit manually, see https://github.com/SAP/abap-file-formats for more information.", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/csnm/csnm-v1.json", + "title": "CSN Model Transport Object", + "description": "CSN model transport object", + "type": "object", + "properties": { + "formatVersion": { + "title": "Format Version", + "description": "Format version", + "type": "string", + "const": "1" + }, + "header": { + "title": "Header", + "description": "Header", + "type": "object", + "properties": { + "description": { + "title": "Description", + "description": "Description of the ABAP object", + "type": "string", + "maxLength": 60 + }, + "originalLanguage": { + "title": "Original Language", + "description": "Original language of the ABAP object", + "type": "string", + "minLength": 2, + "maxLength": 2, + "pattern": "^[a-z]+$" + }, + "abapLanguageVersion": { + "title": "ABAP Language Version", + "description": "ABAP language version", + "type": "string", + "enum": [ + "standard", + "cloudDevelopment" + ], + "enumTitles": [ + "Standard", + "ABAP Cloud Development" + ], + "enumDescriptions": [ + "Standard", + "ABAP cloud development" + ], + "default": "standard" + } + }, + "additionalProperties": false, + "required": [ + "description", + "originalLanguage" + ] + }, + "csnFiles": { + "title": "CSN Files", + "description": "CSN files", + "type": "array", + "items": { + "title": "CSN File", + "description": "CSN file", + "type": "object", + "properties": { + "file": { + "title": "File", + "description": "File", + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ + "formatVersion", + "header" + ] +} diff --git a/file-formats/csnm/examples/z_aff_example_csnm.csnm.json b/file-formats/csnm/examples/z_aff_example_csnm.csnm.json new file mode 100644 index 000000000..cd75ee52a --- /dev/null +++ b/file-formats/csnm/examples/z_aff_example_csnm.csnm.json @@ -0,0 +1,12 @@ +{ + "formatVersion": "1", + "header": { + "description": "Example CSN model for ABAP file formats", + "originalLanguage": "en" + }, + "csnFiles": [ + { + "file": "model_inferred.csn" + } + ] +} diff --git a/file-formats/csnm/examples/z_aff_example_csnm.csnm.model_inferred.csn b/file-formats/csnm/examples/z_aff_example_csnm.csnm.model_inferred.csn new file mode 100644 index 000000000..cb75bc8ec --- /dev/null +++ b/file-formats/csnm/examples/z_aff_example_csnm.csnm.model_inferred.csn @@ -0,0 +1,56 @@ +{ + "definitions": { + "Foo": { + "kind": "entity", + "elements": { + "name": { + "key": true, + "type": "cds.String" + }, + "vorname": { + "key": true, + "type": "cds.String" + } + } + }, + "Bar": { + "kind": "entity", + "projection": { + "from": { + "ref": [ + "Foo" + ] + }, + "columns": [ + { + "ref": [ + "name" + ], + "as": "Name" + }, + { + "ref": [ + "vorname" + ], + "as": "Vorname" + } + ] + }, + "elements": { + "Name": { + "key": true, + "type": "cds.String" + }, + "Vorname": { + "key": true, + "type": "cds.String" + } + } + } + }, + "meta": { + "creator": "CDS Compiler v3.3.2", + "flavor": "inferred" + }, + "$version": "2.0" +} diff --git a/file-formats/csnm/type/zif_aff_csnm_v1.intf.abap b/file-formats/csnm/type/zif_aff_csnm_v1.intf.abap new file mode 100644 index 000000000..31f330013 --- /dev/null +++ b/file-formats/csnm/type/zif_aff_csnm_v1.intf.abap @@ -0,0 +1,34 @@ +"! ABAP File Format for CSN Model Transport Object Generic Editor +INTERFACE zif_aff_csnm_v1 + PUBLIC. + + TYPES: + "!

CSN File

+ "! CSN file + BEGIN OF ty_csn_file, + "!

File

+ "! File + file TYPE string, + END OF ty_csn_file. + + "!

CSN Files

+ "! CSN files + TYPES ty_csn_files TYPE STANDARD TABLE OF ty_csn_file WITH DEFAULT KEY. + + TYPES: + "!

CSN Model Transport Object

+ "! CSN model transport object + BEGIN OF ty_main, + "!

Format Version

+ "! Format version + "! $required + format_version TYPE zif_aff_types_v1=>ty_format_version, + "!

Header

+ "! Header + "! $required + header TYPE zif_aff_types_v1=>ty_header_60_cloud, + "!

CSN Files

+ "! CSN files + csn_files TYPE ty_csn_files, + END OF ty_main. +ENDINTERFACE. diff --git a/file-formats/csnm/type/zif_aff_csnm_v1.intf.json b/file-formats/csnm/type/zif_aff_csnm_v1.intf.json new file mode 100644 index 000000000..b718ba5e3 --- /dev/null +++ b/file-formats/csnm/type/zif_aff_csnm_v1.intf.json @@ -0,0 +1,7 @@ +{ + "formatVersion": "1", + "header": { + "description": "CSN AFF type for CSNM repository object", + "originalLanguage": "en" + } +}