Skip to content

Commit

Permalink
Merge branch 'main' into feature/translation-using-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
albertmink authored Nov 24, 2023
2 parents 2d6b6c1 + a11a09f commit f494c38
Show file tree
Hide file tree
Showing 82 changed files with 3,515 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/editorconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
lint-editorconfig:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Lint for editorconfig violations
name: Check indentation, EOL, EOF, ...
steps:
- name: Checkout the repository
uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion docs/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ string | string |
c | string | `"maxLength": <length of character field>`
i | integer | `"minimum": -2147483648, "maximum": 2147483647`
n | string | `"maxLength": <length of character field>, "pattern": "^[0-9]+$"`
p | number | `"minimum": <minimum value>, "maximum": <maximum value>, "multipleOf": <e.g., 0.01 for 2 decimals>`
p | number | `"minimum": <minimum value>, "maximum": <maximum value>
abap_bool | boolean |
sy-langu | string | `"minLength": 2, "maxLength": 2, "pattern": "^[a-z]+$"`
table | array | if the table has unique keys, `"uniqueItems": true` is added to the schema; hashed tables are not supported
Expand Down Expand Up @@ -136,6 +136,7 @@ The annotation
"! $multipleOf value
```
ensures that values of a component described by this ABAP Doc comment can only be a multiple of the provided value.
Note that it can only be used for integers.

### Required Fields
If a field is to be declared as "required" in the JSON Schema, the annotation
Expand Down
16 changes: 8 additions & 8 deletions docs/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The mapping of objects to file names follows the pattern
```
with the mandatory elements object_name, object_type and file_extension.
Namespaces are converted into brackets, for instance `/NMSPC/CL_OBJECT` becomes `(nmspc)cl_object`.
For every objects there is a file `<object_name>.<object_type>.json`, referred to as metadata file with content such as description text, original language and other (non-redundant) metadata.

### Object Name and Type
The object name (R3TR) and object type are derived from the object itself, as stored in the ABAP object directory (aka TADIR).
Expand All @@ -34,29 +35,28 @@ E.g., for function module FUNCTION_EXISTS in function group SUNI, the file name

### Content Type
If an object needs multiple files which are not represented by transport objects, the content type is used to differentiate between the different file types.
Examples for classes are the test-classes or text elements:
```
cl_oo_clif_source.clas.abap
cl_oo_clif_source.clas.testclasses.abap
cl_oo_clif_source.clas.texts.en.properties
```

### Language
Files with language-specific content (such as translatable texts) also have an identifier for the language in the filename to distinguish between the different translations.
The language of the texts is encoded by the element `language` following [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
```
cl_oo_clif_source.clas.texts.en.properties
cl_oo_clif_source.clas.texts.de.properties
cl_oo_clif_source.clas.texts.fr.properties
```
For property files, no language is added, even if they contain translatable texts.
These files are stored in the original language of the object and the original language is specified in the property file itself.
For the text elements of classes, this language will be the original language (provided by the metadata file).


## File Extensions

ABAP file formats define three file types:
ABAP file formats define the file types:
* **`.abap`** stores ABAP source code as plain text
* **`.acds`** stores source code of ABAP Core Data Services (CDS) as plain text
* **`.json`** stores content of form-based editors or properties of objects, such as `originalLanguage`, `abapLanguageVersion` and others.
Details are found in [JSON Files in ABAP File Formats](./json.md)
* **`.properties`** stores translation relevant text elements as plain text
* **`.properties`** stores text elements as plain text


## Formatting Conventions
Expand Down
5 changes: 5 additions & 0 deletions file-formats/cdbo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CDBO File Format

File | Cardinality | Definition | Schema | Example
:--- | :--- | :--- | :--- | :---
`<name>.cdbo.json` | 1 | [`zif_aff_cdbo_v1.intf.abap`](./type/zif_aff_cdbo_v1.intf.abap) | [`cdbo-v1.json`](./cdbo-v1.json) | [`zcdb_adt_test.cdbo.json`](./examples/zcdb_adt_test.cdbo.json)
148 changes: 148 additions & 0 deletions file-formats/cdbo/cdbo-v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"$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/cdbo/cdbo-v1.json",
"title": "Customer Data Browser Object",
"description": "Customer Data Browser 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",
"keyUser",
"cloudDevelopment"
],
"enumTitles": [
"Standard",
"ABAP for Key Users",
"ABAP Cloud Development"
],
"enumDescriptions": [
"Standard",
"ABAP for key user extensibility",
"ABAP cloud development"
],
"default": "standard"
}
},
"additionalProperties": false,
"required": [
"description",
"originalLanguage"
]
},
"generalInformation": {
"title": "General Information",
"description": "General information",
"type": "object",
"properties": {
"objectType": {
"title": "Object Type",
"description": "Object type",
"type": "string",
"enum": [
"TABL",
"DDLS"
],
"enumTitles": [
"Table",
"Data Definition"
],
"enumDescriptions": [
"Table",
"CDS data definition"
]
},
"objectName": {
"title": "Object Name",
"description": "Object name",
"type": "string",
"maxLength": 40
}
},
"additionalProperties": false,
"required": [
"objectType",
"objectName"
]
},
"fields": {
"title": "Fields",
"description": "Fields",
"type": "array",
"items": {
"title": "Field Details",
"description": "Field details",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "Name",
"type": "string",
"maxLength": 30
},
"nature": {
"title": "Nature",
"description": "Nature",
"type": "string",
"enum": [
"general",
"sensitive",
"nonBusinessInformation"
],
"enumTitles": [
"General Information (No Sensitive Personal Information)",
"Sensitive Personal Information",
"Non Business Information"
],
"enumDescriptions": [
"General fields that do not contain sensitive personal information",
"Sensitive personal information fields including key fields",
"Non business information"
]
}
},
"additionalProperties": false,
"required": [
"name",
"nature"
]
}
}
},
"additionalProperties": false,
"required": [
"formatVersion",
"header",
"generalInformation",
"fields"
]
}
25 changes: 25 additions & 0 deletions file-formats/cdbo/examples/zcdb_adt_test.cdbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"formatVersion": "1",
"header": {
"description": "CDBO on ADT Testing",
"originalLanguage": "en"
},
"generalInformation": {
"objectType": "TABL",
"objectName": "ZCDB_ADT_TEST"
},
"fields": [
{
"name": "MANDT",
"nature": "general"
},
{
"name": "TIME",
"nature": "general"
},
{
"name": "DATUM",
"nature": "general"
}
]
}
97 changes: 97 additions & 0 deletions file-formats/cdbo/type/zif_aff_cdbo_v1.intf.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
INTERFACE zif_aff_cdbo_v1
PUBLIC.
"! <p class="shorttext">Object Type</p>
"! Object type
"! $values {@link zif_aff_cdbo_v1.data:co_object_type}
TYPES ty_object_type TYPE c LENGTH 2.

CONSTANTS:
"! <p class="shorttext">Object Type</p>
"! Object type
BEGIN OF co_object_type,
"! <p class="shorttext">Table</p>
"! Table
"! $enumValue 'TABL'
tabl TYPE ty_object_type VALUE '01',
"! <p class="shorttext">Data Definition</p>
"! CDS data definition
"! $enumValue 'DDLS'
ddls TYPE ty_object_type VALUE '02',
END OF co_object_type.

"! <p class="shorttext">Field Nature</p>
"! Nature of the field
"! $values {@link zif_aff_cdbo_v1.data:co_field_nature}
TYPES ty_field_nature TYPE c LENGTH 2.

CONSTANTS:
"! <p class="shorttext">Field Nature</p>
"! Nature of the field
BEGIN OF co_field_nature,
"! <p class="shorttext">General Information (No Sensitive Personal Information)</p>
"! General fields that do not contain sensitive personal information
general TYPE ty_field_nature VALUE 'GE',
"! <p class="shorttext">Sensitive Personal Information</p>
"! Sensitive personal information fields including key fields
sensitive TYPE ty_field_nature VALUE 'SP',
"! <p class="shorttext">Non Business Information</p>
"! Non business information
non_business_information TYPE ty_field_nature VALUE 'NB',
END OF co_field_nature.

TYPES:
"! <p class="shorttext">Field Details</p>
"! Field details
BEGIN OF ty_field,
"! <p class="shorttext">Name</p>
"! Name
"! $required
name TYPE c LENGTH 30,
"! <p class="shorttext">Nature</p>
"! Nature
"! $required
nature TYPE ty_field_nature,
END OF ty_field.

TYPES:
"! <p class="shorttext">Fields Details</p>
"! Fields details
ty_fields TYPE STANDARD TABLE OF ty_field WITH DEFAULT KEY.

TYPES:
"! <p class="shorttext">General Information</p>
"! General information
BEGIN OF ty_general_information,
"! <p class="shorttext">Object Type</p>
"! Object type
"! $required
object_type TYPE ty_object_type,
"! <p class="shorttext">Object Name</p>
"! Object name
"! $required
object_name TYPE c LENGTH 40,
END OF ty_general_information.

TYPES:
"! <p class="shorttext">Customer Data Browser Object</p>
"! Customer Data Browser 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,
"! <p class="shorttext">General Information</p>
"! General information
"! $required
general_information TYPE ty_general_information,
"! <p class="shorttext">Fields</p>
"! Fields
"! $required
fields TYPE ty_fields,
END OF ty_main.

ENDINTERFACE.
7 changes: 7 additions & 0 deletions file-formats/cdbo/type/zif_aff_cdbo_v1.intf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"formatVersion": "1",
"header": {
"description": "Interface with CDBO AFF Type",
"originalLanguage": "en"
}
}
3 changes: 1 addition & 2 deletions file-formats/chkv/chkv-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
"name": {
"title": "Parameter Name",
"description": "The parameter name",
"type": "string",
"maxLength": 30
"type": "string"
},
"value": {
"title": "Parameter Value",
Expand Down
2 changes: 1 addition & 1 deletion file-formats/chkv/type/zif_aff_chkv_v1.intf.abap
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ INTERFACE zif_aff_chkv_v1
"! <p class="shorttext">Parameter Name</p>
"! The parameter name
"! $required
name TYPE zif_aff_types_v1=>ty_object_name_30,
name TYPE string,
"! <p class="shorttext">Parameter Value</p>
"! The value of the parameter
value TYPE string,
Expand Down
6 changes: 6 additions & 0 deletions file-formats/cota/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# COTA File Format


File | Cardinality | Definition | Schema | Example
:--- | :--- | :--- | :--- | :---
`<name>.cota.json` | 1 | [`zif_aff_cota_v1.intf.abap`](./type/zif_aff_cota_v1.intf.abap) | [`cota-v1.json`](./cota-v1.json)
Loading

0 comments on commit f494c38

Please sign in to comment.