Skip to content

Commit

Permalink
Added publish.ps1 script to start building the final schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
joem-msft committed May 8, 2024
1 parent 77a1af2 commit 205aed2
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 176 deletions.
100 changes: 1 addition & 99 deletions schemas/pa-yaml/v3.0/pa.schema.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Unfortunately, it also seems to make it so that schema cache doesn't get updated if the schema file updates.
# WORKAROUND: Close the VSCode window and reopen.
#
# How to add snippets for use in VS Code: https://code.visualstudio.com/docs/languages/json#_define-snippets-in-json-schemas

$schema: http://json-schema.org/draft-07/schema#
$id: http://powerapps.com/schemas/pa-yaml/v3.0/pa.schema
title: Microsoft Power Apps schema for app source yaml files (v3.0).
Expand Down Expand Up @@ -39,7 +34,6 @@ definitions:
additionalProperties: false
properties:
Properties: { $ref: "#/definitions/Properties-formula-map" }
# NOTE: App children is removed for now until the design for the AppHost controls is completed

Screens-name-instance-map:
description: |-
Expand Down Expand Up @@ -80,8 +74,6 @@ definitions:
$ref: "#/definitions/Control-instance"
defaultSnippets:
- label: Add Control
# Note: In order to get intellisense for the Control property, we can't use the ${1} in the
# default value for ${2} as vscode will put the intellisense for the first reference of the replacement.
body:
'${2:Control1}':
Control: ${1:Label}
Expand Down Expand Up @@ -123,9 +115,6 @@ definitions:
ControlTypeId-pattern:
$comment: Defines reusable schema for validating the pattern allowed for control type identifiers.
type: string
# The value of this identifier takes the format:
# ( <invariantFamily> '/' )? <invariantName>
# Where the set of allowed characters is limited.
pattern: |-
^([A-Z][a-zA-Z0-9]*/)?[A-Z][a-zA-Z0-9]*$
Expand All @@ -150,9 +139,6 @@ definitions:
- $ref: "#/definitions/ControlTypeId-Component"
- $ref: "#/definitions/ControlTypeId-CodeComponent"

# TODO: Imlpement a way that some controls may define a limited subset of child control types
# e.g. The 'Form' control's children must be of type 'TypedDataCard':
# - $ref: "#/definitions/ControlTypeId-TypedDataCard"

ControlTypeId-Component:
description: |-
Expand All @@ -176,69 +162,7 @@ definitions:
$ref: "#/definitions/ControlTypeId-oneOf-3P-types"

ControlTypeId-1P-controls-enum:
# TODO: Generate these enum values from the latest version of controls available in the template store that have reached Preview.
enum:
- AddMedia
- Attachments
- Audio
- Button
- Camera
- CheckBox
- Circle
- ComboBox
- DatePicker
- DropDown
- Form
- TypedDataCard
- DataCard
- Gallery
- GroupContainer
- Icon
- Image
- Label
- ListBox
- Microphone
- PDFViewer
- PowerBI
- Radio
- Rating
- Rectangle
- Slider
- StreamVideo
- TextInput
- Timer
- Toggle
- Video
- FluentV8/Button
- FluentV8/CheckBox
- FluentV8/ComboBox
- FluentV8/DatePicker
- FluentV8/Label
- FluentV8/Radio
- FluentV8/Rating
- FluentV8/Slider
- FluentV8/TextBox
- FluentV8/Toggle
- FluentV9/Badge
- FluentV9/Button
- FluentV9/CheckBox
- FluentV9/ComboBox
- FluentV9/DatePicker
- FluentV9/DropDown
- FluentV9/Header
- FluentV9/InfoButton
- FluentV9/Link
- FluentV9/NumberInput
- FluentV9/Progress
- FluentV9/Radio
- FluentV9/Slider
- FluentV9/Spinner
- FluentV9/StreamVideo
- FluentV9/TabList
- FluentV9/Text
- FluentV9/TextInput
- FluentV9/Toggle
- FluentV9/Grid
true

Control-variant-name:
description: The variant of a control template being instantiated.
Expand Down Expand Up @@ -268,7 +192,6 @@ definitions:
ComponentLibraryUniqueName: { $ref: "#/definitions/ComponentLibrary-unique-name" }
ComponentName: { $ref: "#/definitions/ComponentDefinition-name" }
Properties: true
# Note: Component instances do not support Variants or Children.
- if:
properties:
Control: { $ref: "#/definitions/ControlTypeId-CodeComponent" }
Expand All @@ -279,15 +202,12 @@ definitions:
Control: true
ComponentName: { $ref: "#/definitions/CodeComponent-name" }
Properties: true
# Note: CodeComponent instances do not support Variants or Children.
else:
# Expected to be a built-in control library template
additionalProperties: false
properties:
Control: true
Variant: { $ref: "#/definitions/Control-variant-name" }
Properties: true
# Depending on the ControlTypeId, it may or may not actually support Groups
Groups: { $ref: "#/definitions/Groups-of-controls" }
Children: { $ref: "#/definitions/Children-Control-instance-sequence" }

Expand Down Expand Up @@ -323,7 +243,6 @@ definitions:
The unique name of the Code Component (aka PCF control) as it occurs in Dataverse.
The format is: <publisher-prefix> '_' <JS-Namespace> '.' <JS-ClassName>
type: string
# TODO: The JS regex pattern doesn't easily support unicode chars which are valid JS identifiers.
pattern: |-
^([a-z][a-z0-9]{1,7})_([a-zA-Z0-9]\.)+[a-zA-Z0-9]+*$
Expand Down Expand Up @@ -353,7 +272,6 @@ definitions:
- $ref: "#/definitions/Properties-formula-map"
- propertyNames:
examples:
# These are the known properties for a component definition, but others may be allowed in the future, along with those defined by custom Output properties.
- ContentLanguage
- ChildTabPriority
- EnableChildFocus
Expand Down Expand Up @@ -391,7 +309,6 @@ definitions:
- const: Action
description: A property that represents an action.
DisplayName:
# TODO: This property will get removed from the document
description: DEPRECATED. This is not used anywhere and will be removed.
type: string
Description:
Expand Down Expand Up @@ -484,17 +401,6 @@ definitions:
The unique name of the component library within Dataverse.
It has the form "{PublisherPrefix}_{ComponentLibraryName}".
type: string
# Dataverse Publisher Prefix:
# - must be 2 to 8 characters long, can only consist of alpha-numerics, must start with a letter.
# AppName Specification (owned by PPUX service):
# - SaveAsDialog.tsx#onSave() : https://dev.azure.com/msazure/OneAgile/_git/PowerApps-Client?path=/src/AppMagic/powerapps-client/packages/powerapps-authoring/src/components/SaveDialog/SaveAsDialog.tsx&version=GBmaster&_a=contents
# - maxLength: 64
# - isValidAppName : https://dev.azure.com/msazure/OneAgile/_git/PowerApps-Client?path=/src/AppMagic/powerapps-client/packages/powerapps-authoring/src/components/Backstage/AppSettings/BasicAppSettings/Common.ts
# - First char must be non-whitespace char. i.e. \S
# - Must contain at least one non-whitespace char. i.e. \S
# - StringUtility.ts#isValidFileName
# - Must contain at least one non-whitespace char. i.e. \S
# - Must not contain an invalid filename char. i.e. const invalidFileNameChars = '*".?:\\<>|/';
pattern: |-
^([a-z][a-z0-9]{1,7})_(\S.{0,63})$
not:
Expand All @@ -515,7 +421,6 @@ definitions:
$ref: "#/definitions/pfx-formula"

entity-name:
# aka: DName
description: The base requirements for a named entity in an app.
type: string

Expand All @@ -542,8 +447,6 @@ definitions:
pfx-function-parameter-name:
description: The name of a Power Fx function parameter.
type: string
# TODO: Add `pattern` with correct char set
# pattern: "^[a-zA-Z0-9_]+$"

pfx-function-return-type:
oneOf:
Expand All @@ -568,7 +471,6 @@ definitions:

pfx-formula:
oneOf:
# Note: The first item of a 'oneOf' will be used for error message when none match. So we make sure our default preferred normalization is first.
- type: string
pattern: ^=.*
- type: 'null'
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Unfortunately, it also seems to make it so that schema cache doesn't get updated if the schema file updates.
# WORKAROUND: Close the VSCode window and reopen.
#
# How to add snippets for use in VS Code: https://code.visualstudio.com/docs/languages/json#_define-snippets-in-json-schemas

$schema: http://json-schema.org/draft-07/schema#
$id: http://powerapps.com/schemas/pa-yaml/v3.0/ControlTypeId-1P-controls-enum.schema
description: >-
The schema object representing the enum of ControlTypeIds for the current version of the controls library.
enum:
- AddMedia
- Attachments
- Audio
- Button
- Camera
- CheckBox
- Circle
- ComboBox
- DatePicker
- DropDown
- Form
- TypedDataCard
- DataCard
- Gallery
- GroupContainer
- Icon
- Image
- Label
- ListBox
- Microphone
- PDFViewer
- PowerBI
- Radio
- Rating
- Rectangle
- Slider
- StreamVideo
- TextInput
- Timer
- Toggle
- Video
- FluentV8/Button
- FluentV8/CheckBox
- FluentV8/ComboBox
- FluentV8/DatePicker
- FluentV8/Label
- FluentV8/Radio
- FluentV8/Rating
- FluentV8/Slider
- FluentV8/TextBox
- FluentV8/Toggle
- FluentV9/Badge
- FluentV9/Button
- FluentV9/CheckBox
- FluentV9/ComboBox
- FluentV9/DatePicker
- FluentV9/DropDown
- FluentV9/Header
- FluentV9/InfoButton
- FluentV9/Link
- FluentV9/NumberInput
- FluentV9/Progress
- FluentV9/Radio
- FluentV9/Slider
- FluentV9/Spinner
- FluentV9/StreamVideo
- FluentV9/TabList
- FluentV9/Text
- FluentV9/TextInput
- FluentV9/Toggle
- FluentV9/Grid
67 changes: 4 additions & 63 deletions src/schemas/pa-yaml/v3.0/pa.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,69 +176,10 @@ definitions:
$ref: "#/definitions/ControlTypeId-oneOf-3P-types"

ControlTypeId-1P-controls-enum:
# TODO: Generate these enum values from the latest version of controls available in the template store that have reached Preview.
enum:
- AddMedia
- Attachments
- Audio
- Button
- Camera
- CheckBox
- Circle
- ComboBox
- DatePicker
- DropDown
- Form
- TypedDataCard
- DataCard
- Gallery
- GroupContainer
- Icon
- Image
- Label
- ListBox
- Microphone
- PDFViewer
- PowerBI
- Radio
- Rating
- Rectangle
- Slider
- StreamVideo
- TextInput
- Timer
- Toggle
- Video
- FluentV8/Button
- FluentV8/CheckBox
- FluentV8/ComboBox
- FluentV8/DatePicker
- FluentV8/Label
- FluentV8/Radio
- FluentV8/Rating
- FluentV8/Slider
- FluentV8/TextBox
- FluentV8/Toggle
- FluentV9/Badge
- FluentV9/Button
- FluentV9/CheckBox
- FluentV9/ComboBox
- FluentV9/DatePicker
- FluentV9/DropDown
- FluentV9/Header
- FluentV9/InfoButton
- FluentV9/Link
- FluentV9/NumberInput
- FluentV9/Progress
- FluentV9/Radio
- FluentV9/Slider
- FluentV9/Spinner
- FluentV9/StreamVideo
- FluentV9/TabList
- FluentV9/Text
- FluentV9/TextInput
- FluentV9/Toggle
- FluentV9/Grid
# [schema-build-remove-next-line]
$ref: "ControlLibraryVDev/ControlTypeId-1P-controls-enum.schema.yaml"
# [schema-build-uncomment-next-line]
#true

Control-variant-name:
description: The variant of a control template being instantiated.
Expand Down
15 changes: 1 addition & 14 deletions src/schemas/publish.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
:: SETLOCAL will also autoreset the current directory
@SETLOCAL
@CD %~dp0

@SET _RepoRoot=%~dp0..\..\
@SET _SchemasDistRoot=%_RepoRoot%schemas\


:: TODO: Instead of a straight copy, we should remove yaml comments; only keeping '$comment'
:: TODO: We MAY want to also publish the *.schema.json files too.
@ECHO Copying pa-yaml/v3.0 ...
@RMDIR /S /Q "%_SchemasDistRoot%pa-yaml\v3.0\"
@MKDIR "%_SchemasDistRoot%pa-yaml\v3.0\"
@COPY pa-yaml\v3.0\pa.schema.yaml "%_SchemasDistRoot%pa-yaml\v3.0\"
@pwsh.exe -executionpolicy bypass -file %~dp0publish.ps1
Loading

0 comments on commit 205aed2

Please sign in to comment.