Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ mocha.json

#cypress video folder
cypress/videos

# vscode settings folder
.vscode/
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.21.0] - 2026-03-03

### Changed

- Fix schema outletsRequestDynamicContextResponse_v1_schema to apply draft-06 and draft-07 JSON validation standards
- Enhance schema getFeatureFlagRequest_v1_schema to support array next to object as correct request payload
- Add unit test to make sure that all schemas are valid and follow draft-04, draft-06 and draft-07 JSON validation standards (besides outletsRequestDynamicContextResponse_v1_schema)
- outletsRequestDynamicContextResponse_v1_schema has an optional array property called "plugins", which contains objects with an optional array property called "sandboxPolicies". Draft-04 does not support this "optional array" inside "optional array", while draft-06 and draft-07 do.
- Enhance model OutletsRequestContextResponse and OutletsRequestDynamicContextResponse by defining property plugin(s) better
- Update typescript version to avoid warnings during execution of unit tests

## [1.20.0] - 2024-10-10

### Added
Expand Down
6 changes: 6 additions & 0 deletions docs/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ where:
details describing validation error. It is up to consuming application which additional information
include in this property.

**Important:** All schemas within fsm-shell support the following JSON Schema standards [^1]:
- draft-06
- draft-07

[^1]: Currently, most of the schemas within fsm-shell support also the JSON Schema standard draft-04. However, future schemas may no longer support draft-04. Therefore, we recommend using an external JSON Schema validation library that supports the JSON Schema standards draft-06 and/or draft-07.

## Enabling validation

To enable validation the consumer of fsm-shell library should call `setValidator` method on ShellSdk instance.
Expand Down
5 changes: 3 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

// "resolveJsonModule": true is required to load json files in tests, e.g. meta schemas (see schemas.spec.ts)
const tsconfig = {
"compilerOptions": {
"lib": [
"es2015",
"dom"
]
],
"resolveJsonModule": true
},
"reports": {
"html": "coverage",
Expand Down
14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fsm-shell",
"version": "1.20.0",
"version": "1.21.0",
"description": "client library for FSM shell",
"main": "release/fsm-shell-client.js",
"module": "release/fsm-shell-client.es.js",
Expand Down Expand Up @@ -38,6 +38,7 @@
"@types/jasmine": "^3.5.12",
"@types/jasminewd2": "^2.0.8",
"@types/sinon": "^9.0.4",
"ajv": "~6.12.6",
"copyfiles": "^2.3.0",
"coveralls": "^3.1.0",
"cypress": "^4.12.1",
Expand Down Expand Up @@ -69,7 +70,7 @@
"start-server-and-test": "^1.12.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "~3.1.6"
"typescript": "~3.9.10"
},
"dependencies": {},
"husky": {
Expand Down
12 changes: 11 additions & 1 deletion src/models/outlets/outlets-request-context-response.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ export interface OutletsRequestContextResponse {
target?: string;
isRootNodeHttps?: boolean;
isConfigurationMode: boolean;
plugin?: any;
plugin?: PluginForOutlet;
isPreviewActive: boolean;
}

interface PluginForOutlet {
name: string;
url: string;
optimalHeight?: string;
useShellSDK?: boolean;
isActive: boolean;
sandboxPolicies?: string[];
assignmentId?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ export interface OutletsRequestDynamicContextResponse {
isRootNodeHttps?: boolean;
isConfigurationMode?: boolean;
areDynamicOutletsEnabled?: boolean;
plugins?: any[];
plugins?: PluginForDynamicOutlet[];
isPreviewActive: boolean;
}

interface PluginForDynamicOutlet {
name: string;
url: string;
optimalHeight?: string;
useShellSDK?: boolean;
isActive: boolean;
sandboxPolicies?: string[];
assignmentId: string;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
export const getFeatureFlagRequest_v1_schema = {
type: 'object',
properties: {
key: {
type: 'string',
},
defaultValue: {
type: 'boolean',
},
$defs: {
payload: {
type: 'object',
properties: {
key: {
type: 'string'
},
defaultValue: {
type: 'boolean'
}
},
required: ['key', 'defaultValue']
}
},
required: ['key', 'defaultValue'],
anyOf: [
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe using it here { $ref: '#/$defs/payload' }, instead of duplicating the definition?

$ref: '#/$defs/payload'
},
{
type: 'array',
items: {
$ref: '#/$defs/payload'
}
}
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,36 @@ export const outletsRequestContextResponse_v1_schema = {
isPreviewActive: {
type: 'boolean',
},
plugin: {},
plugin: {
type: 'object',
properties: {
name: {
type: 'string'
},
url: {
type: 'string'
},
optimalHeight: {
type: 'string'
},
useShellSDK: {
type: 'boolean'
},
isActive: {
type: 'boolean'
},
sandboxPolicies: {
type: 'array',
items: {
type: 'string'
}
},
assignmentId: {
type: 'string'
}
},
required: ['name', 'url', 'isActive']
},
},
required: ['isConfigurationMode'],
};
Original file line number Diff line number Diff line change
@@ -1,22 +1,59 @@
export const outletsRequestDynamicContextResponse_v1_schema = {
$defs: {
plugin: {
type: 'object',
properties: {
name: {
type: 'string'
},
url: {
type: 'string'
},
optimalHeight: {
type: 'string'
},
useShellSDK: {
type: 'boolean'
},
isActive: {
type: 'boolean'
},
sandboxPolicies: {
type: 'array',
items: {
type: 'string'
}
},
assignmentId: {
type: 'string'
}
},
required: ['name', 'url', 'isActive', 'assignmentId']
}
},
type: 'object',
properties: {
target: {
type: 'string',
type: 'string'
},
isRootNodeHttps: {
type: 'boolean',
type: 'boolean'
},
isConfigurationMode: {
type: 'boolean',
type: 'boolean'
},
areDynamicOutletsEnabled: {
type: 'boolean',
type: 'boolean'
},
isPreviewActive: {
type: 'boolean',
type: 'boolean'
},
plugins: [],
plugins: {
type: 'array',
items: {
$ref: '#/$defs/plugin'
}
}
},
required: [],
required: []
};
Loading
Loading