Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving JsonSchemas into this repo #613

Merged
merged 52 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0010a6d
Allowing additional props (#7)
lorang92 Nov 18, 2020
b8f73df
Added missing trigger field (#8)
lorang92 Nov 24, 2020
d43d620
Config for excludeFromPdf (#9)
tba76 Nov 24, 2020
e7b88f8
Added summary component definitions (#11)
nkylstad Jan 4, 2021
9fc10d5
Added validate page + pages as trigger enum (#12)
lorang92 Jan 4, 2021
3f56010
Added missing properties for layoutSettings json-schema (#14)
lorang92 Jan 20, 2021
8e4c93a
Feature/5233 message widget (#15)
nkylstad Jan 20, 2021
a7f5d8f
feature/4497-json-schema-cdn (#6)
lorang92 Nov 16, 2020
f2accde
Added LabelSettings to layout schema (#23)
SandGrainOne Feb 3, 2021
f69e9e8
Added grid prop to json-schema (#26)
lorang92 Feb 17, 2021
df24e16
Added new trigger + triggers on page level on json schemas (#29)
lorang92 Mar 9, 2021
e2e3d04
Added new trigger + triggers on page level on json schemas (#29)
lorang92 Mar 9, 2021
5b79ae6
Changed example to be consistent with docs (#34)
lorang92 Mar 23, 2021
74be7ac
add group edit property to layout schema (#38)
nkylstad May 21, 2021
11bd2bb
Add formatting property for input component. (#39)
nkylstad May 21, 2021
b9f6250
feature/4497-json-schema-cdn (#6)
lorang92 Nov 16, 2020
316a59d
Add formatting property for input component. (#39)
nkylstad May 21, 2021
eaf88b0
Add JsonSchema for Input field text alignment (#55)
ivarne Oct 9, 2021
5ec05fa
Add JSON schema pattern for layout.id (#54)
ivarne Oct 10, 2021
1619c9f
Specify that groupComponents.children, needs to be unique (#62)
ivarne Nov 1, 2021
5d12cf6
Added image in schema-validator (#63)
FTLems Nov 2, 2021
8f9335d
Add explanation of the keyword 'today' (#64)
DanRJ Nov 8, 2021
92f46a6
Added tableHeaders to json schema (#68)
lorang92 Nov 12, 2021
7910cde
Added Json schema for labelGrid (#56)
ivarne Nov 29, 2021
a8d19cc
Add typings for "Header" component (#70)
ivarne Dec 8, 2021
d05d1f7
Added instantiation button to schema (#74)
lorang92 Dec 14, 2021
7dccc08
feat: allow h2, h3, h4 as values for header size (#77)
haakemon Dec 17, 2021
6aa7d51
added new prop to group (#78)
lorang92 Dec 22, 2021
aefa09c
fix: update documentation to specify correct default value fot timest…
haakemon Feb 6, 2022
a3ef457
Fix typo in layout.schema.v1.json (#87)
ivarne Mar 2, 2022
b13b1f8
added info about secure options (#86)
lorang92 Mar 21, 2022
1b26710
feat: add navigation bar (#84)
haakemon Mar 21, 2022
ae800e8
feat: add information about row/column layout for radio and checkboxe…
haakemon Mar 31, 2022
76bd568
6479: Add fileuploadwithtag (#91)
lorang92 Mar 31, 2022
39ba71c
added missing type (#94)
lorang92 Apr 18, 2022
f343df8
added option source to json schema (#92)
lorang92 Apr 18, 2022
261eef4
utvidet layoutSettings til å inneholde hideCloseButton og showLanguag…
May 6, 2022
75ffa1c
Renamed the schema-description from showLanguageDropdown to showLangu…
May 11, 2022
44f8aef
feat: add schema definition for Panel component (#100)
haakemon Jun 16, 2022
5083f51
Adding layout schema support for the new saveWhileTyping property (#104)
olemartinorg Jul 12, 2022
be3deac
PrintButton in schema (#101)
mjulstein Jul 12, 2022
a69a42a
feat: group panel schema (#105)
lorang92 Jul 13, 2022
815f64d
Bringing the json schema in sync with the definitions in app-frontend…
olemartinorg Aug 4, 2022
df1355a
added likert component to layout schema (#107)
nkylstad Aug 4, 2022
41a35ce
feat: added multiple select (#110)
lorang92 Oct 3, 2022
8b0d247
update summary component schema (#109)
nkylstad Oct 3, 2022
204bc76
add alertOnDelete to layout schema (#113)
Magnusrm Oct 20, 2022
95bab7c
Added layoutset schema (#17)
TheTechArch Jan 22, 2021
d6a50f0
Added trigger for single-row-validation
bjosttveit Nov 2, 2022
5c87a63
Moving most of the complexity of release scripting into a bash script…
Nov 2, 2022
9ea4022
Fixing formatting in the layout-sets schema
Nov 2, 2022
57f0c6c
Adding schema-copy to cdn
Nov 2, 2022
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
149 changes: 149 additions & 0 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/usr/bin/env bash

set -e
set -u

PRE_RELEASE=no
COMMIT=no

while [[ $# -gt 0 ]]; do
case $1 in
--cdn)
PATH_TO_CDN=$(realpath "$2")
shift # pop option
shift # pop value
;;
--frontend)
PATH_TO_FRONTEND=$(realpath "$2")
shift # pop option
shift # pop value
;;
--pre-release)
PRE_RELEASE=yes
shift # pop option
;;
--commit)
COMMIT=yes
shift # pop option
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
echo "Unknown argument $1"
exit 1
;;
esac
done

SOURCE=src/altinn-app-frontend/dist
TARGET=toolkits/altinn-app-frontend

if ! test -d "$PATH_TO_CDN" || ! test -d "$PATH_TO_CDN/$TARGET"; then
echo "Unable to find $PATH_TO_CDN/$TARGET"
echo "Make sure path to CDN has been passed with --cdn <path>"
exit 1
fi
if ! test -d "$PATH_TO_FRONTEND" || ! test -d "$PATH_TO_FRONTEND/$SOURCE"; then
echo "Unable to find $PATH_TO_FRONTEND/$SOURCE (did you run yarn build first?)"
echo "Make sure path to CDN has been passed with --frontend <path>"
exit 1
fi

SOURCE_SCHEMAS="$PATH_TO_FRONTEND/schemas"
TARGET_SCHEMAS="$PATH_TO_CDN/schemas"

SOURCE="$PATH_TO_FRONTEND/$SOURCE"
TARGET="$PATH_TO_CDN/$TARGET"

echo "-------------------------------------"
echo "Source: $SOURCE"
echo "Target: $TARGET"
echo "Pre-release: $PRE_RELEASE (toggle with --pre-release)"
echo "Commit: $COMMIT (toggle with --commit)"
echo "-------------------------------------"

CURRENT_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null)
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ })
APP_FULL=${CURRENT_VERSION:1}
APP_MAJOR=${CURRENT_VERSION_PARTS[0]:1}
APP_MAJOR_MINOR=${CURRENT_VERSION_PARTS[0]:1}.${CURRENT_VERSION_PARTS[1]}
AUTHOR_FULL=$(git log -1 | grep Author)
AUTHOR_NAME=$(git log -1 | grep Author | cut -d' ' -f2)
AUTHOR_EMAIL=$(git log -1 | grep Author | cut -d' ' -f3 | cut -d'<' -f2 | cut -d'>' -f1)
COMMIT_ID=$(git rev-parse HEAD~0)

echo "Full version: $APP_FULL"
echo "Major version: $APP_MAJOR"
echo "Major + minor: $APP_MAJOR_MINOR"
echo "Latest author: $AUTHOR_FULL"
echo "Author name: $AUTHOR_NAME"
echo "Author email: $AUTHOR_EMAIL"
echo "Commit ID: $COMMIT_ID"
echo "-------------------------------------"

COMMIT_FILE=$(mktemp --suffix=-cdn-commit)
{
echo "$AUTHOR_FULL updated altinn-app-frontend to $APP_FULL"
echo "based on commit https://github.com/Altinn/app-frontend-react/commit/$COMMIT_ID"
git log -1 | grep -Ev "commit|Author|Date"
} >> "$COMMIT_FILE"

echo "CDN commit message:"
echo
cat "$COMMIT_FILE"
echo "-------------------------------------"
echo "Files to be copied:"
echo
ls -1 $SOURCE/*
echo "-------------------------------------"
echo "Log:"
echo

# Needed in order for git commands to work
cd "$TARGET"

if [[ "$PRE_RELEASE" == "no" ]]; then
echo " * Copying Major version"
test -e "$TARGET/$APP_MAJOR" && git rm -r "$TARGET/$APP_MAJOR"
mkdir -p "$TARGET/$APP_MAJOR"
cp -fr $SOURCE/* "$TARGET/$APP_MAJOR/"
echo " * Copying Minor version"
test -e "$TARGET/$APP_MAJOR_MINOR" && git rm -r "$TARGET/$APP_MAJOR_MINOR"
mkdir -p "$TARGET/$APP_MAJOR_MINOR"
cp -fr $SOURCE/* "$TARGET/$APP_MAJOR_MINOR/"

echo " * Copying schemas"
cp -prv $SOURCE_SCHEMAS/* "$TARGET_SCHEMAS/"
else
echo " * Copying Major version (skipped using --pre-release)"
echo " * Copying Minor version (skipped using --pre-release)"
echo " * Copying schemas (skipped using --pre-release)"
fi

echo " * Copying Patch version"
test -e "$TARGET/$APP_FULL" && git rm -r "$TARGET/$APP_FULL"
mkdir -p "$TARGET/$APP_FULL"
cp -fr $SOURCE/* "$TARGET/$APP_FULL/"

echo " * Updating index.json"
ls -1 | \
grep --perl-regexp '^[\d\.]+(-[a-z0-9.]+)?$' | \
sort --version-sort | \
jq --raw-input --slurp 'split("\n") | map(select(. != ""))' > index.json

cd ../..

echo " * Staged for commit:"
git add .
git status --short

if [[ "$COMMIT" == "yes" ]]; then
echo " * Committing changes"
git commit --author="$AUTHOR_NAME <$AUTHOR_EMAIL>" -F "$COMMIT_FILE"
else
echo " * Skipping commit (toggle with --commit)"
fi

echo "-------------------------------------"
61 changes: 7 additions & 54 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,16 @@ jobs:
token: ${{secrets.ALTINN_CDN_TOKEN}}
path: cdn

- name: Prepare version number
id: prepare
- name: Run release script
working-directory: app-frontend
run: |
echo Clone, copy, commit and push to Altinn-CDN
CURRENT_VERSION=`git describe --abbrev=0 --tags 2>/dev/null`
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ })
echo ::set-output name=APP_FULL::${CURRENT_VERSION:1}
echo ::set-output name=APP_MAJOR::${CURRENT_VERSION_PARTS[0]:1}
echo ::set-output name=APP_MAJOR_MINOR::${CURRENT_VERSION_PARTS[0]:1}.${CURRENT_VERSION_PARTS[1]}
echo ::set-output name=AUTHOR_FULL::$(git log -1 | grep Author)
echo ::set-output name=AUTHOR_NAME::$(git log -1 | grep Author | cut -d' ' -f2)
echo ::set-output name=AUTHOR_EMAIL::$(git log -1 | grep Author | cut -d' ' -f3 | cut -d'<' -f2 | cut -d'>' -f1)
echo ::set-output name=COMMIT_ID::$(git rev-parse HEAD~0)
git log -1 | grep -Ev "commit|Author|Date" > ./../commitmsg.txt

- name: Copy version
working-directory: cdn
if: "!github.event.release.prerelease"
run: |
echo altinn-app-frontend version: ${{ steps.prepare.outputs.APP_FULL }}
echo Copy Major Version
test -e toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR }} && git rm -r toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR }}
mkdir -p toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR }}
cp -fr ../app-frontend/src/altinn-app-frontend/dist/* toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR }}/
echo Copy Minor Version
test -e toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR_MINOR }} && git rm -r toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR_MINOR }}
mkdir -p toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR_MINOR }}
cp -fr ../app-frontend/src/altinn-app-frontend/dist/* toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_MAJOR_MINOR }}/
echo Copy Patch
test -e toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }} && git rm -r toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}
mkdir -p toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}
cp -fr ../app-frontend/src/altinn-app-frontend/dist/* toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}/
run: bash .github/scripts/release.sh --frontend . --cdn ../cdn --commit

- name: Copy version (pre-release)
working-directory: cdn
- name: Run release script (pre-release)
working-directory: app-frontend
if: "github.event.release.prerelease"
run: |
echo altinn-app-frontend version: ${{ steps.prepare.outputs.APP_FULL }}
echo Copy Patch
test -e toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }} && git rm -r toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}
mkdir -p toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}
cp -fr ../app-frontend/src/altinn-app-frontend/dist/* toolkits/altinn-app-frontend/${{ steps.prepare.outputs.APP_FULL }}/
run: bash .github/scripts/release.sh --frontend . --cdn ../cdn --commit --pre-release

- name: Copy patch version and commit to CDN
- name: Push to CDN
working-directory: cdn
run: |
echo altinn-app-frontend version: ${{ steps.prepare.outputs.APP_FULL }}
cd toolkits/altinn-app-frontend
ls -1 | grep --perl-regexp '^[\d\.]+(-[a-z0-9.]+)?$' | sort --version-sort | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' > index.json
cd ../..
git config --global user.email "${{ steps.prepare.outputs.AUTHOR_EMAIL }}"
git config --global user.name "${{ steps.prepare.outputs.AUTHOR_NAME }}"
git add .
echo "${{ steps.prepare.outputs.AUTHOR_FULL }} updated altinn-app-frontend to ${{ steps.prepare.outputs.APP_FULL }}" > ./../commit1.txt
echo "based on commit https://github.com/Altinn/app-frontend-react/commit/${{ steps.prepare.outputs.COMMIT_ID }}" > ./../commit2.txt
cat ./../commit1.txt ./../commit2.txt ./../commitmsg.txt > ./../commit.txt
cat ./../commit.txt
git commit -F ./../commit.txt
git push
run: git push
99 changes: 99 additions & 0 deletions schemas/json/component/number-format.schema.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"$id": "https://altinncdn.no/schemas/json/component/number-format.schema.v1.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Input number formatting",
"description": "Schema that describes the options that can be configured for number formatting on an `input` component, based on react-number-format package. For complete list of available options, see https://github.com/s-yadav/react-number-format#props",
"type": "object",
"additionalProperties": true,
"properties": {
"allowedDecimalSeparators": {
"title": "Allowed decimal separators",
"description": "Characters which when pressed result in a decimal separator. When missing, decimalSeparator and '.' are used",
"type": "array",
"items": {
"type": "string",
"maxLength": 1
},
"examples": [[",", ".", "/"]]
},
"allowEmptyFormatting": {
"title": "Allow empty formatting",
"description": "Apply formatting to empty inputs",
"type": "boolean",
"default": false
},
"allowLeadingZeros": {
"title": "Allow leading zeros",
"description": "Allow leading zeros at beginning of number",
"type": "boolean",
"default": false
},
"allowNegative": {
"title": "Allow negative",
"description": "Allow negative numbers (Only when format option is not provided)",
"type": "boolean",
"default": true
},
"decimalScale": {
"title": "Decimal scale",
"description": "If defined it limits to given decimal scale.",
"type": "number",
"examples": [1, 2, 3]
},
"decimalSeparator": {
"title": "Decimal separator",
"description": "Support decimal point on a number. Single character string.",
"type": "string",
"maxLength": 1,
"default": "."
},
"fixedDecimalScale": {
"title": "Fixed decimal scale",
"description": "Used together with decimalScale. If true it adds 0s to match given decimal scale.",
"type": "boolean",
"default": false
},
"format": {
"title": "Format",
"description": "Format given as hash string, to allow number input in place of hash.",
"type": "string",
"examples": ["### ### ###", "+47 ### ## ###", "##-##-##-##"]
},
"mask": {
"title": "Mask",
"description": "Mask to show in place of non-entered values",
"type": "string",
"examples": ["_"],
"default": " "
},
"prefix": {
"title": "Prefix",
"description": "Add a prefix before the number",
"type": "string",
"examples": ["$", "kr", "-", "(+47) "]
},
"suffix": {
"title": "Suffix",
"description": "Add a suffix after the number",
"type": "string",
"examples": ["%", "kr", "kg"]
},
"thousandSeparator": {
"title": "Thousand separator",
"description": "Add thousand separators on number. Single character string or boolean true (true is default to ,)",
"type": ["string", "boolean"],
"maxLength": 1,
"examples": [true, ",", "."]
}
},
"allOf": [{
"if": {
"properties": { "fixedDecimalScale": { "const": true } },
"required": ["fixedDecimalScale"]
},
"then": {
"required": ["decimalScale"]
}
}
]
}
47 changes: 47 additions & 0 deletions schemas/json/layout/layout-sets.schema.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$id": "https://altinncdn.no/schemas/json/layout/layout-sets.schema.v1.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Altinn layout sets",
"description": "Schema that describes the different layout sets for an Altinn application and when to use them",
"type": "object",
"additionalProperties": true,
"properties": {
"sets": {
"type": "array",
"items": {
"$ref": "#/definitions/layoutset"
}
},
"definitions": {
"layoutset": {
"type": "object",
"additionalProperties": false,
"description": "Settings regarding a specific layoutset",
"properties": {
"id": {
"type": "string",
"title": "id",
"description": "The layoutset ID. Must be unique within a given application."
},
"type": {
"type": "string",
"title": "dataType",
"description": "The datatype to use this layoyut."
},
"tasks": {
"$ref": "#/definitions/tasks"
}
}
},
"tasks": {
"additionalProperties": false,
"description": "An array specifying which task to use a layoutset",
"type": "array",
"items": {
"description": "A layoutSet name, for instance 'Form1'",
"type": "string"
}
}
}
}
}
Loading