-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODS-5418] Remove DescriptorIds from descriptor resource payloads (#868)
Co-authored-by: Geoffrey McElhanon <[email protected]>
- Loading branch information
1 parent
b72f5bd
commit 9f01dce
Showing
61 changed files
with
2,139 additions
and
13,472 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
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
40 changes: 40 additions & 0 deletions
40
Application/EdFi.Ods.Common/Models/Definitions/Transformers/PriorDescriptorIdRemover.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,40 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using EdFi.Ods.Common.Conventions; | ||
using EdFi.Ods.Common.Models.Domain; | ||
|
||
namespace EdFi.Ods.Common.Models.Definitions.Transformers; | ||
|
||
/// <summary> | ||
/// Implements a transformer that removes the PriorDescriptorId property from the edfi.Descriptor entity's definition | ||
/// to prevent any artifacts from being generated or rendered for it. This class should be removed once the property | ||
/// has been removed from the source ApiModel.json file generated by MetaEd. | ||
/// </summary> | ||
public class PriorDescriptorIdRemover : IDomainModelDefinitionsTransformer | ||
{ | ||
public IEnumerable<DomainModelDefinitions> TransformDefinitions(IEnumerable<DomainModelDefinitions> definitions) | ||
{ | ||
foreach (DomainModelDefinitions domainModelDefinitions in definitions) | ||
{ | ||
// Look for the edfi.Descriptor entity definition | ||
var entityDefinition = domainModelDefinitions.EntityDefinitions?.FirstOrDefault( | ||
ed => new FullName(ed.Schema, ed.Name) == EdFiConventions.DescriptorFullName); | ||
|
||
if (entityDefinition != null) | ||
{ | ||
// Remove the PriorDescriptorId property | ||
entityDefinition.LocallyDefinedProperties = | ||
entityDefinition.LocallyDefinedProperties | ||
.Where(p => p.PropertyName != "PriorDescriptorId") | ||
.ToArray(); | ||
} | ||
|
||
yield return domainModelDefinitions; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.