-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mxe auto-gen):Support aspect modeled as typeref when auto-genera…
…ting MXE (#150)
- Loading branch information
1 parent
660bea2
commit 9d15edb
Showing
8 changed files
with
182 additions
and
19 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...data-annotations-lib/src/main/java/com/linkedin/metadata/annotations/AlwaysAllowList.java
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package com.linkedin.metadata.annotations; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import com.linkedin.data.schema.RecordDataSchema; | ||
import com.linkedin.data.schema.DataSchema; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
@VisibleForTesting | ||
public class AlwaysAllowList implements GmaEntitiesAnnotationAllowList { | ||
@Override | ||
public void check(@Nonnull RecordDataSchema schema, @Nonnull AspectAnnotation aspectAnnotation) { | ||
public void check(@Nonnull DataSchema schema, @Nonnull AspectAnnotation aspectAnnotation) { | ||
// nothing | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...adata-annotations-lib/src/main/java/com/linkedin/metadata/annotations/DataSchemaUtil.java
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,39 @@ | ||
package com.linkedin.metadata.annotations; | ||
|
||
import com.linkedin.data.schema.DataSchema; | ||
import com.linkedin.data.schema.RecordDataSchema; | ||
import com.linkedin.data.schema.TyperefDataSchema; | ||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
/** | ||
* Utility operations on DataSchema. | ||
*/ | ||
public class DataSchemaUtil { | ||
|
||
private DataSchemaUtil() { | ||
} | ||
|
||
@CheckForNull | ||
public static String getFullName(@Nonnull DataSchema dataSchema) { | ||
if (dataSchema instanceof RecordDataSchema) { | ||
return ((RecordDataSchema) dataSchema).getFullName(); | ||
} else if (dataSchema instanceof TyperefDataSchema) { | ||
return ((TyperefDataSchema) dataSchema).getFullName(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@CheckForNull | ||
public static String getNamespace(@Nonnull DataSchema dataSchema) { | ||
if (dataSchema instanceof RecordDataSchema) { | ||
return ((RecordDataSchema) dataSchema).getNamespace(); | ||
} else if (dataSchema instanceof TyperefDataSchema) { | ||
return ((TyperefDataSchema) dataSchema).getNamespace(); | ||
} | ||
|
||
return null; | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
...my-dummy-module/src/main/pegasus/com/linkedin/metadata/test/aspects/TestTyperefAspect.pdl
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,6 @@ | ||
namespace com.linkedin.metadata.test.aspects | ||
|
||
import com.linkedin.metadata.test.models.TestModel | ||
|
||
@gma.aspect.entity.urn = "com.linkedin.testing.FooUrn" | ||
typeref TestTyperefAspect = TestModel |