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

Updated DataSources schema to add ConnectorId and update the schema definition. #716

Merged
merged 7 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
37 changes: 27 additions & 10 deletions schemas/pa-yaml/v3.0/pa.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
nullable: true
jamevaalet marked this conversation as resolved.
Show resolved Hide resolved
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
additionalProperties: false
properties:
TableLogicalName:
jamevaalet marked this conversation as resolved.
Show resolved Hide resolved
type: string
- required: [Type]
additionalProperties: false
properties:
Type:
const: Actions

Properties-formula-map:
description: >-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

[TestMethod]
[DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/DataSources1.pa.yaml")]
[DataRow(@"_TestData/SchemaV3_0/Examples/Src/DataSources/DataverseDataSources.pa.yaml")]
public void DeserializeExamplePaYamlDataSources(string path)
{
var paFileRoot = PaYamlSerializer.Deserialize<PaModule>(File.ReadAllText(path));
Expand All @@ -60,7 +60,17 @@
paFileRoot.ComponentDefinitions.Should().BeNullOrEmpty();
paFileRoot.Screens.Should().BeNullOrEmpty();

paFileRoot.DataSources.Should().HaveCount(3);
paFileRoot.DataSources.Should().HaveCount(4);

Check failure on line 63 in src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 63 in src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

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]
Expand Down Expand Up @@ -177,7 +187,7 @@
[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/DataverseDataSources.pa.yaml")]
public void RoundTripFromYaml(string path)
{
var originalYaml = File.ReadAllText(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public record DataSourceInstance
{
[YamlMember(DefaultValuesHandling = DefaultValuesHandling.Preserve)]
public required DataSourceType Type { get; init; }
public string? ConnectorId { get; init; }
public NamedObjectMapping<string>? Parameters { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ DataSources:
Type: Table
Parameters:
TableLogicalName: systemuser
DataverseActions:
Type: Actions
37 changes: 27 additions & 10 deletions src/schemas/pa-yaml/v3.0/pa.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -435,24 +435,41 @@ definitions:
DataSource-name:
jamevaalet marked this conversation as resolved.
Show resolved Hide resolved
$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
nullable: true
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
additionalProperties: false
properties:
TableLogicalName:
type: string
- required: [Type]
additionalProperties: false
properties:
Type:
const: Actions

Properties-formula-map:
description: >-
Expand Down
Loading