Skip to content

Commit

Permalink
[CSNM] Add new object type CSNM (#557)
Browse files Browse the repository at this point in the history
* Add files for CSNM

* Fix abaplint errors

* Fix errors

* Fix folder name

* Update file-formats/csnm/README.md

Co-authored-by: Albert Mink <[email protected]>

* Update file-formats/csnm/examples/z_aff_example_csnm.csnm.json

Co-authored-by: Albert Mink <[email protected]>

* Fix lint errors

* Delete file-formats/csnm/.DS_Store

* Remove unneccessary comment from abap interface

* Update file-formats/csnm/examples/z_aff_example_csnm.csnm.json

Co-authored-by: Michael Schneider <[email protected]>

* Update file-formats/csnm/examples/z_aff_example_csnm.csnm.json

Co-authored-by: Michael Schneider <[email protected]>

* Ajust AFF (general information node is deleted)

* Adjust doc comment on the ABAP interface

* Adjust title and description

* Update file-formats/csnm/type/zif_aff_csnm_v1.intf.abap

Co-authored-by: Katharina Wurz <[email protected]>

* Update file-formats/csnm/type/zif_aff_csnm_v1.intf.abap

Co-authored-by: Katharina Wurz <[email protected]>

* Update file-formats/csnm/type/zif_aff_csnm_v1.intf.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Adjust schema

* Implementation of requested changes

---------

Co-authored-by: Albert Mink <[email protected]>
Co-authored-by: Michael Schneider <[email protected]>
Co-authored-by: Katharina Wurz <[email protected]>
Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 4, 2023
1 parent e3fea79 commit b184301
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 0 deletions.
6 changes: 6 additions & 0 deletions file-formats/csnm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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_csnm.csnm.json](./examples/z_aff_example_csnm.csnm.json)
`<name>.csnm.<csnfilename>.csn` | 0...n | - | - | [z_aff_example_csnm.csnm.model_inferred.csn](./examples/z_aff_example_csnm.csnm.model_inferred.csn)
83 changes: 83 additions & 0 deletions file-formats/csnm/csnm-v1.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
12 changes: 12 additions & 0 deletions file-formats/csnm/examples/z_aff_example_csnm.csnm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"formatVersion": "1",
"header": {
"description": "Example CSN model for ABAP file formats",
"originalLanguage": "en"
},
"csnFiles": [
{
"file": "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"
}
34 changes: 34 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,34 @@
"! ABAP File Format for CSN Model Transport Object Generic Editor
INTERFACE zif_aff_csnm_v1
PUBLIC.

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

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

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">CSN Files</p>
"! CSN files
csn_files TYPE ty_csn_files,
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 b184301

Please sign in to comment.