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

added support for namemaps on control properties #725

Closed
wants to merge 3 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public void DeserializeDuplicateControlNamesShouldFail()
[DataRow(@"_TestData/SchemaV3_0/FullSchemaUses/Screens-general-controls.pa.yaml")]
[DataRow(@"_TestData/SchemaV3_0/FullSchemaUses/Screens-with-components.pa.yaml")]
[DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml")]
[DataRow(@"_TestData/SchemaV3_0/Examples/Src/Controls/control-with-namemap.pa.yaml")]
public void RoundTripFromYaml(string path)
{
var originalYaml = File.ReadAllText(path);
Expand Down
2 changes: 2 additions & 0 deletions src/Persistence/PaYaml/Models/SchemaV3/ControlInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ public ControlInstance(string controlType)

public NamedObjectMapping<PFxExpressionYaml>? Properties { get; init; }

public NamedObjectMapping<NamedObjectMapping<string>>? PropertiesNameMaps { get; init; }

public NamedObjectSequence<ControlInstance>? Children { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Screens:
Screen1:
Children:
- Dropdown1:
Control: Classic/DropDown
Properties:
Items: |-
=[{Id: 1, Title: "Item 1", Desc: "desc1"}, {Id: 2, Title: "Item 2", Desc: "desc2"}, {Id: 3, Title: "Item 3", Desc: "desc3"}]
PropertiesNameMaps:
Copy link
Contributor

Choose a reason for hiding this comment

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

another proposal would be to just use NameMaps, we can probably elide the 'Properties' prefix. But lets wait for a review on the schema before changing the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PropertiesNameMaps makes it clear that we're referring to additional metadata to enrich existing properties

Copy link
Contributor

Choose a reason for hiding this comment

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

Open this file in VS Code. You'll see there are some squigglies due to this property not existing in the schema.
Whenever changing the schema, we should update the schema file here: src\schemas\pa-yaml\v3.0\pa.schema.yaml

I can talk with you offline how best to test changes in your inner-dev-loop.

After updating that file sufficiently, then you run src\schemas\publish.cmd so it compiles and updates the final file at schemas\pa-yaml\v3.0\pa.schema.yaml.

Items:
Value: Title
Loading