Skip to content

Commit

Permalink
Add files for CSNM
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbelenki authored Sep 22, 2023
1 parent 95f02af commit a4673fa
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 0 deletions.
Binary file added file-formats/csnm/.DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions file-formats/csnm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CSNM File Format

File | Cardinality | Definition | Schema | Example
:--- | :--- | :--- | :--- | :---
`<name>.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_abcd.csnm.json](./examples/z_aff_example_abcd.csnm.json)
91 changes: 91 additions & 0 deletions file-formats/csnm/csnm-v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"$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"
]
},
"generalInformation": {
"title": "General Information",
"description": "General Information",
"type": "object",
"properties": {
"csnFileNames": {
"title": "CSN File Names",
"description": "CSN file name",
"type": "array",
"items": {
"title": "CSN File",
"description": "CSN file",
"type": "object",
"properties": {
"name": {
"title": "CSN File Name",
"description": "CSN file name",
"type": "string"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": [
"formatVersion",
"header"
]
}
18 changes: 18 additions & 0 deletions file-formats/csnm/example/z_aff_example_csnm.csnm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{

Check failure on line 1 in file-formats/csnm/example/z_aff_example_csnm.csnm.json

View check run for this annotation

abaplint / abaplint

Unknown object type, currently not supported in abaplint, open issue on github

https://rules.abaplint.org/parser_error
"formatVersion": "1",
"header": {
"abapLanguageVersion": "standard"
"description": "Example CSN model for ABAP file formats",
"originalLanguage": "en"
},
"generalInformation": {
"csnFileNames": [
{
"name": "model_parsed.csn"
},
{
"name": "model_inferred.csn"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
56 changes: 56 additions & 0 deletions file-formats/csnm/example/z_aff_example_csnm.csnm.model_parsed.csn
Original file line number Diff line number Diff line change
@@ -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"
}
45 changes: 45 additions & 0 deletions file-formats/csnm/type/zif_aff_csnm_v1.intf.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"! ABAP File Format for CSN Model Transport Object Generic Editor
"!
"! As very first solution, one CSN file could be enough
INTERFACE zif_aff_csnm_v1
PUBLIC.

TYPES:
"! <p class="shorttext">CSN File</p>
"! CSN file
BEGIN OF ty_csn_file,
"! <p class="shorttext">CSN File Name</p>
"! CSN file name
name TYPE string,
END OF ty_csn_file.

"! <p class="shorttext">CSN Files</p>
"! CSN files
TYPES ty_csn_file_names TYPE STANDARD TABLE OF ty_csn_file WITH DEFAULT KEY.

TYPES:
"! <p class="shorttext">General Information</p>
"! General information
BEGIN OF ty_general_information,
"! <p class="shorttext">CSN File Names</p>
"! CSN file name
csn_file_names TYPE ty_csn_file_names,
END OF ty_general_information.

TYPES:
"! <p class="shorttext">CSN Model Transport Object</p>
"! CSN model transport object
BEGIN OF ty_main,
"! <p class="shorttext">Format Version</p>
"! Format version
"! $required
format_version TYPE zif_aff_types_v1=>ty_format_version,
"! <p class="shorttext">Header</p>
"! Header
"! $required
header TYPE zif_aff_types_v1=>ty_header_60_cloud,
"! <p class="shorttext">General Information</p>
"! General Information
general_information TYPE ty_general_information,
END OF ty_main.
ENDINTERFACE.
7 changes: 7 additions & 0 deletions file-formats/csnm/type/zif_aff_csnm_v1.intf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"formatVersion": "1",
"header": {
"description": "CSN AFF type for CSNM repository object",
"originalLanguage": "en"
}
}

0 comments on commit a4673fa

Please sign in to comment.