-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ComponentDefinition OM (#736)
- replaced parameter `IsRequired` keyword with `IsOptional`. To ensure smaller serialized yaml. - `PaYamlPropertyDataType` consolidated to replace `PFxDataType` and `PFxFunctionReturnType` to move validation to compiler which will simplify compiler implementation. - change serialized order of `Parameters` to occur last. `NamedObjectCollectionExtensions.EmptyToNull` extension methods. - updated schema documentation - Add additional examples of custom properties
- Loading branch information
Showing
13 changed files
with
225 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Persistence/PaYaml/Models/NamedObjectCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace Microsoft.PowerPlatform.PowerApps.Persistence.PaYaml.Models; | ||
|
||
public static class NamedObjectCollectionExtensions | ||
{ | ||
public static NamedObjectMapping<TValue>? EmptyToNull<TValue>(this NamedObjectMapping<TValue>? collection) | ||
where TValue : notnull | ||
{ | ||
return collection?.Count == 0 ? null : collection; | ||
} | ||
|
||
public static NamedObjectSequence<TValue>? EmptyToNull<TValue>(this NamedObjectSequence<TValue>? collection) | ||
where TValue : notnull | ||
{ | ||
return collection?.Count == 0 ? null : collection; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
src/Persistence/PaYaml/Models/PowerFx/PFxFunctionParameter.cs
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/Persistence/PaYaml/Models/PowerFx/PFxFunctionReturnType.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
...ence/PaYaml/Models/PowerFx/PFxDataType.cs → ...Models/SchemaV3/PaYamlPropertyDataType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/schemas-tests/pa-yaml/v3.0/Examples/Src/Components/InputProperties-Default.pa.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ComponentDefinitions: | ||
MyHeaderComponent: | ||
DefinitionType: CanvasComponent | ||
Description: A component with input properties. | ||
CustomProperties: | ||
MyTextProp1: | ||
PropertyKind: Input | ||
DisplayName: App Title | ||
Description: The title of the App | ||
RaiseOnReset: true | ||
DataType: Text | ||
Default: ="Text" | ||
|
||
MyNumberProp1: | ||
PropertyKind: Input | ||
DataType: Number | ||
Default: =100 | ||
|
||
MyInputFunc1: | ||
PropertyKind: InputFunction | ||
ReturnType: Number | ||
Default: =lhs + rhs | ||
|
||
OnMyEvent1: | ||
PropertyKind: Event | ||
ReturnType: None | ||
# default for void is no formula | ||
Default: = | ||
|
||
Properties: | ||
Fill: =Color.Azure | ||
# Note: Custom input properties do not get any rules stored here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/schemas-tests/pa-yaml/v3.0/Examples/Src/Components/OutputProperties.pa.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
ComponentDefinitions: | ||
MyHeaderComponent: | ||
DefinitionType: CanvasComponent | ||
Description: A component with input properties. | ||
CustomProperties: | ||
MyTextProp1: | ||
PropertyKind: Output | ||
DisplayName: App Title | ||
Description: The title of the App | ||
DataType: Text | ||
|
||
MyNumberProp1: | ||
PropertyKind: Output | ||
DataType: Number | ||
|
||
MyOutputFunc1: | ||
PropertyKind: OutputFunction | ||
ReturnType: Number | ||
Parameters: | ||
- lhs: | ||
DataType: Number | ||
Default: =100 | ||
- rhs: | ||
IsOptional: true | ||
DataType: Number | ||
Default: =1 | ||
|
||
DoMyAction1: | ||
PropertyKind: Action | ||
ReturnType: None | ||
Parameters: | ||
- newValue: | ||
DataType: Number | ||
Default: =100 | ||
- reason: | ||
IsOptional: true | ||
DataType: Text | ||
Default: ="Text" | ||
|
||
# Note: Custom output properties have their rules stored here | ||
# because they are internal implementation details of each instance. | ||
Properties: | ||
DoMyAction1: = | ||
Fill: =Color.Azure | ||
MyNumberProp1: =100 | ||
MyOutputFunc1: =lhs + rhs | ||
MyTextProp1: ="Text" |
Oops, something went wrong.