@sap/cds-dk
Version:
Command line client and development toolkit for the SAP Cloud Application Programming Model
354 lines (345 loc) • 16.5 kB
JavaScript
module.exports = {
title: "JSON schema for CDS-DK configuration",
$schema: "https://json-schema.org/draft-07/schema",
description: "Build overlay",
$defs: {
cdsRoot: {
properties: {
// declaration for schema node for cds plugins contributing cds configuration
schema: {
type: "object",
default: {},
description: "Schema declaration for cds plugins contributing cds configuration",
additionalProperties: false,
properties: {
cds: {
type: "object",
default: {},
description: "Containing json schema declarations for root level entries under cds node.",
patternProperties: {
// new keyword must start with word character or opening brackets
"^[\\[\\(\\w].*": {
$ref: "https://json-schema.org/draft-07/schema"
}
}
},
buildTaskType: {
type: "object",
default: {},
additionalProperties: false,
required: ["name"],
properties: {
name: {
type: "string",
minLength: 1,
description: "The name of the build task type."
},
description: {
type: "string",
description: "The description of the build task type."
}
}
},
databaseType: {
type: "object",
default: {},
additionalProperties: false,
required: ["name"],
properties: {
name: {
type: "string",
minLength: 1,
description: "The name of the database type."
},
description: {
type: "string",
description: "The description of the database type."
}
}
}
}
},
// build specific schema
build: {
type: "object",
default: {},
description: "Customize CDS build settings.",
additionalProperties: true,
patternProperties: {
'\\[.+\\]': {
default: {},
description: 'Generic build profile',
$ref: '#/$defs/cdsRoot/properties/build'
}
},
properties: {
target: {
type: "string",
description: "Specify the folder which contains generated build results. Defaults to './gen'.",
format: "uri-reference"
},
tasks: {
type: "array",
description: "Control which tasks 'cds build' will execute on your project modules. This is a typical task configuration: '\"tasks\": [{ \"for\": \"hana\"}];",
uniqueItems: true,
default: [
{}
],
items: {
type: "object",
additionalProperties: true,
patternProperties: {
'\\[.+\\]': {
default: {},
description: 'Generic tasks profile',
$ref: '#/$defs/cdsRoot/properties/build/properties/tasks/items'
}
},
properties: {
dest: {
type: "string",
description: "Optional: Define the destination folder for this build task, relative to build target folder. \nFor example: Destination defined as 'custom' results in an output written to 'gen/custom'.",
format: "uri-reference"
},
src: {
type: "string",
description: "Optional: Prefer defining 'cds.env.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
format: "uri-reference"
},
for: {
type: "string",
description: "Define the target technology for this build task.",
minLength: 1,
$ref: "#/$defs/buildTaskType"
},
options: {
type: "object",
description: "Optional: Set target technology specific options for this build task.",
additionalProperties: true,
properties: {
model: {
$ref: "#/$defs/foldersStringArray"
}
}
}
}
}
}
}
},
import: {
type: "object",
description: "Set CDS import configurations.",
additionalProperties: false,
properties: {
as: {
type: "string",
description: "Converts the input file into one of these supported formats: cds, csn or json.",
$ref: "#/$defs/importOptions/as"
},
from: {
type: "string",
description: "Imports the model from the one of the given options: edmx, openapi or asyncapi.",
$ref: "#/$defs/importOptions/from"
},
force: {
type: "boolean",
description: "Forcefully overwrites the contents in the CDS file and updates the checksum",
},
no_save: {
type: "boolean",
description: "Skips updating ./package.json.",
},
out: {
type: "string",
description: "Output file written to the specified location."
},
dry: {
type: "boolean",
description: "Writes the converted csn to stdout only.",
},
keepNamespace: {
type: "boolean",
description: "Keeps the original namespace from the edmx content instead of using the filename by default.",
default: false
},
includeNamespaces: {
type: "string",
description: "Imports only entities matching to the given list of namespaces."
}
}
},
export: {
type: "object",
description: "Customize cds compile settings",
additionalProperties: false,
properties: {
asyncapi: {
type: "object",
description: "AsyncAPI settings for cds compile",
additionalProperties: false,
properties: {
application_namespace: {
type: "string",
description: "The registered namespace of the application"
},
merged: {
type: "object",
description: "properties that needs to be there when merged option is used",
additionalProperties: false,
properties: {
title: {
type: "string",
description: "Title to be used for merged doc"
},
version: {
type: "string",
description: "Version to be used for merged doc"
},
short_text: {
type: "string",
description: "Short decription of the AsyncAPIs"
},
description: {
type: "string",
description: "Description to be used for the merged doc"
}
}
},
event_spec_version: {
type: "string",
description: "Mentions the version of AsyncAPI spec"
},
event_source: {
type: "string",
description: "Event source information",
default: "{region}/{applicationNamespace}/{instanceId}",
},
event_source_params: {
type: "object",
description: "Parameters related to the source of event",
default: {
region: "the region",
applicationNamespace: "the namespace",
instanceId: "the instance id"
},
additionalProperties: false,
properties: {
region: {
type: "string",
description: "The regional context of the application"
},
applicationNamespace: {
type: "string",
description: "The registered namespace of the application"
},
instanceId: {
type: "string",
description: "The instance id (tenant, installation, ...) of the application."
}
}
},
event_characteristics: {
type: "object",
description: "The characteristics defined for events",
additionalProperties: true
}
}
}
}
},
// deploy specific schema
deploy: {
type: "object",
default: {},
description: "Customize 'cds deploy' settings.",
additionalProperties: true,
patternProperties: {
'\\[.+\\]': {
default: {},
description: 'Generic deploy profile',
$ref: '#/$defs/cdsRoot/properties/deploy'
}
},
properties: {
no_save: {
type: "boolean",
description: "Do / don't update configuration in package.json.",
default: true
}
}
}
}
},
buildTaskType: {
enum: /**@type { const } */ ([
"nodejs",
"java",
"hana",
"mtx-sidecar",
"mtx-extension",
"mtx",
"helm"
]),
enumDescriptions: [
"Node.js build plugin",
"Java build plugin",
"SAP HANA build plugin",
"MTX sidecar build plugin",
"MTX extension build plugin",
"MTX build plugin",
"Helm chart build plugin"
]
},
foldersStringArray: {
oneOf: [
{
type: "string",
format: "uri-reference"
},
{
type: "array",
uniqueItems: true,
items: {
type: "string",
format: "uri-reference"
}
}
]
},
importOptions: {
from: {
oneOf: [
{
const: "asyncapi",
description: "AsyncAPI specification"
},
{
const: "edmx",
description: "OData specification"
},
{
const: "openapi",
description: "OpenAPI specification"
}
]
},
as: {
oneOf: [
{
const: "cds",
description: "Converts the input file into cds format"
},
{
const: "csn",
description: "Converts the input file into csn format"
},
{
const: "json",
description: "Converts the input file into json format"
}
]
}
}
}
}