Skip to content

Commit 1bf9a7b

Browse files
authored
Add meta.document.name and .namespace (#105)
* Add meta.document.name and .namespace Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Bump version to 1.0.7 Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Update description Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Run prettier Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Update example Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Undo version bump Signed-off-by: Simon Heimler <simon.heimler@sap.com> * Undo version bump in changelog Signed-off-by: Simon Heimler <simon.heimler@sap.com> --------- Signed-off-by: Simon Heimler <simon.heimler@sap.com>
1 parent f7a1ffe commit 1bf9a7b

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ For a roadmap including expected timeline, please refer to [ROADMAP.md](./ROADMA
1212

1313
### Added
1414

15+
- Added `meta.document.name` to give the overall document a machine-readable name
16+
- Added `meta.document.namespace` to give the overall document a globally unique namespace
1517
- Allow `cds.Decimal` to be used as a key, indicated via `key` boolean
1618

1719
## [1.0.6]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"lint:staged": "lint-staged",
3535
"eslint": "eslint . --fix",
3636
"eslint:ci": "eslint .",
37+
"format": "npm run prettier",
3738
"prettier": "prettier --write \"**/*.{json,yml,yaml,md}\"",
3839
"prettier:ci": "prettier --check \"**/*.{json,yml,yaml,md}\"",
3940
"test": "npm run build && npm run test:unit",

spec/v1/CSN-Interop-Effective.schema.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,26 @@ definitions:
167167
description: |-
168168
Metadata that describes the document (and what it represents) itself.
169169
properties:
170+
name:
171+
type: string
172+
maxLength: 255
173+
description: |-
174+
Machine readable technical name / local ID of the CSN document.
175+
Together with `meta.document.namespace` and `meta.document.version` it uniquely identifies the CSN document at a given version.
176+
177+
MUST NOT contain linebreaks.
178+
MUST be unique across all CSN documents in the same `meta.document.namespace`.
179+
pattern: '^([a-zA-Z0-9._\-]+)$'
180+
181+
namespace:
182+
type: string
183+
maxLength: 36
184+
description: |-
185+
Globally unique namespace of the CSN document.
186+
Together with `meta.document.name` and `meta.document.version` it uniquely identifies the CSN document at a given version.
187+
188+
MUST be a valid, registered [ORD namespace](https://open-resource-discovery.github.io/specification/spec-v1#namespaces) with at least two fragments.
189+
pattern: "^[a-z0-9]+(?:[.][a-z0-9]+){1,}$"
170190
version:
171191
type: string
172192
description: |-
@@ -188,6 +208,7 @@ definitions:
188208
Human readable documentation that describes the overall CSN document.
189209
190210
SHOULD be provided and interpreted as [CommonMark](https://spec.commonmark.org/) (Markdown).
211+
191212
additionalProperties: false
192213

193214
MetaFeatures:

spec/v1/examples/airline.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"document": {
77
"version": "1.2.3",
88
"title": "Airline (Example)",
9+
"name": "Airline",
10+
"namespace": "sap.xref",
911
"doc": "This CSN example document shows how the airline example is expressed with a CDS **Service** exposing the entities through an API."
1012
},
1113
"features": {

src/generated/spec-v1/schemas/csn-interop-effective.schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@
128128
"type": "object",
129129
"description": "Metadata that describes the document (and what it represents) itself.",
130130
"properties": {
131+
"name": {
132+
"type": "string",
133+
"maxLength": 255,
134+
"description": "Machine readable technical name / local ID of the CSN document.\nTogether with `meta.document.namespace` and `meta.document.version` it uniquely identifies the CSN document at a given version.\n\nMUST NOT contain linebreaks.\nMUST be unique across all CSN documents in the same `meta.document.namespace`.",
135+
"pattern": "^([a-zA-Z0-9._\\-]+)$"
136+
},
137+
"namespace": {
138+
"type": "string",
139+
"maxLength": 36,
140+
"description": "Globally unique namespace of the CSN document.\nTogether with `meta.document.name` and `meta.document.version` it uniquely identifies the CSN document at a given version.\n\nMUST be a valid, registered [ORD namespace](https://open-resource-discovery.github.io/specification/spec-v1#namespaces) with at least two fragments.",
141+
"pattern": "^[a-z0-9]+(?:[.][a-z0-9]+){1,}$"
142+
},
131143
"version": {
132144
"type": "string",
133145
"description": "The version of the CSN document / the described model itself (not the specification).\n\nWe RECOMMEND to use the [SemVer](https://semver.org/) standard.",

src/generated/spec-v1/types/csn-interop-effective.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,21 @@ export interface Meta {
442442
* Metadata that describes the document (and what it represents) itself.
443443
*/
444444
export interface DocumentMetadata {
445+
/**
446+
* Machine readable technical name / local ID of the CSN document.
447+
* Together with `meta.document.namespace` and `meta.document.version` it uniquely identifies the CSN document at a given version.
448+
*
449+
* MUST NOT contain linebreaks.
450+
* MUST be unique across all CSN documents in the same `meta.document.namespace`.
451+
*/
452+
name?: string;
453+
/**
454+
* Globally unique namespace of the CSN document.
455+
* Together with `meta.document.name` and `meta.document.version` it uniquely identifies the CSN document at a given version.
456+
*
457+
* MUST be a valid, registered [ORD namespace](https://open-resource-discovery.github.io/specification/spec-v1#namespaces) with at least two fragments.
458+
*/
459+
namespace?: string;
445460
/**
446461
* The version of the CSN document / the described model itself (not the specification).
447462
*

0 commit comments

Comments
 (0)