diff --git a/schemas/pa-yaml/v3.0/pa.schema.yaml b/schemas/pa-yaml/v3.0/pa.schema.yaml index de5be810..db48aab1 100644 --- a/schemas/pa-yaml/v3.0/pa.schema.yaml +++ b/schemas/pa-yaml/v3.0/pa.schema.yaml @@ -401,24 +401,41 @@ definitions: DataSource-name: $ref: "#/definitions/entity-name" - DataSource-Type: - enum: - - DataverseTable - DataSource-instance: type: object - required: [Type] + required: + - Type + additionalProperties: false properties: - Type: { $ref: "#/definitions/DataSource-Type" } + Type: + type: string + enum: + - Table + - Actions + ConnectorId: + type: string + Parameters: + type: object + additionalProperties: + type: string oneOf: - required: [Type] additionalProperties: false properties: Type: - const: DataverseTable - TableLogicalName: - type: string - minLength: 1 + const: Table + Parameters: + type: object + required: [TableLogicalName] + additionalProperties: false + properties: + TableLogicalName: + type: string + - required: [Type] + additionalProperties: false + properties: + Type: + const: Actions Properties-formula-map: description: >- diff --git a/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs b/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs index e4947956..e2891fc8 100644 --- a/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs +++ b/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs @@ -48,7 +48,7 @@ public void DeserializeExamplePaYamlApp(string path, int expectedAppPropertiesCo } [TestMethod] - [DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/DataSources1.pa.yaml")] + [DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml")] public void DeserializeExamplePaYamlDataSources(string path) { var paFileRoot = PaYamlSerializer.Deserialize(File.ReadAllText(path)); @@ -59,8 +59,16 @@ public void DeserializeExamplePaYamlDataSources(string path) paFileRoot.App.Should().BeNull(); paFileRoot.ComponentDefinitions.Should().BeNullOrEmpty(); paFileRoot.Screens.Should().BeNullOrEmpty(); - - paFileRoot.DataSources.Should().HaveCount(3); + paFileRoot.DataSources.Should().HaveCount(4); + paFileRoot.DataSources.Should().AllSatisfy(ds => ds.Value.ConnectorId.Should().BeNull()); + paFileRoot.DataSources.GetValue("DataverseActions").Type.Should().Be(DataSourceType.Actions); + + // Assert all DataSources except DataverseActions are of type Table + paFileRoot.DataSources + .Where(ds => ds.Name != "DataverseActions") + .Select(ds => ds.Value) + .Should() + .AllSatisfy(ds => ds.Type.Should().Be(DataSourceType.Table)); } [TestMethod] @@ -177,7 +185,7 @@ public void DeserializeDuplicateControlNamesShouldFail() [DataRow(@"_TestData/SchemaV3_0/FullSchemaUses/App.pa.yaml")] [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/DataSources1.pa.yaml")] + [DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml")] public void RoundTripFromYaml(string path) { var originalYaml = File.ReadAllText(path); diff --git a/src/Persistence/PaYaml/Models/SchemaV3/DataSourceInstance.cs b/src/Persistence/PaYaml/Models/SchemaV3/DataSourceInstance.cs index 561b83e9..d74f5165 100644 --- a/src/Persistence/PaYaml/Models/SchemaV3/DataSourceInstance.cs +++ b/src/Persistence/PaYaml/Models/SchemaV3/DataSourceInstance.cs @@ -14,5 +14,6 @@ public record DataSourceInstance { [YamlMember(DefaultValuesHandling = DefaultValuesHandling.Preserve)] public required DataSourceType Type { get; init; } + public string? ConnectorId { get; init; } public NamedObjectMapping? Parameters { get; init; } } diff --git a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/DataSources1.pa.yaml b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml similarity index 86% rename from src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/DataSources1.pa.yaml rename to src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml index 73a1c0a9..d72eb1ad 100644 --- a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/DataSources1.pa.yaml +++ b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/DataSources/Dataversedatasources1.pa.yaml @@ -11,3 +11,5 @@ DataSources: Type: Table Parameters: TableLogicalName: systemuser + DataverseActions: + Type: Actions diff --git a/src/schemas/pa-yaml/v3.0/pa.schema.yaml b/src/schemas/pa-yaml/v3.0/pa.schema.yaml index 03b7842f..22196089 100644 --- a/src/schemas/pa-yaml/v3.0/pa.schema.yaml +++ b/src/schemas/pa-yaml/v3.0/pa.schema.yaml @@ -435,24 +435,41 @@ definitions: DataSource-name: $ref: "#/definitions/entity-name" - DataSource-Type: - enum: - - DataverseTable - DataSource-instance: type: object - required: [Type] + required: + - Type + additionalProperties: false properties: - Type: { $ref: "#/definitions/DataSource-Type" } + Type: + type: string + enum: + - Table + - Actions + ConnectorId: + type: string + Parameters: + type: object + additionalProperties: + type: string oneOf: - required: [Type] additionalProperties: false properties: Type: - const: DataverseTable - TableLogicalName: - type: string - minLength: 1 + const: Table + Parameters: + type: object + required: [TableLogicalName] + additionalProperties: false + properties: + TableLogicalName: + type: string + - required: [Type] + additionalProperties: false + properties: + Type: + const: Actions Properties-formula-map: description: >-