use of com.linkedin.data.grammar.PdlParser.UnionMemberDeclarationContext in project rest.li by linkedin.
the class PdlSchemaParser method parseUnion.
private UnionDataSchema parseUnion(UnionDeclarationContext union, boolean withinTypref) throws ParseException {
UnionDataSchema schema = new UnionDataSchema();
List<UnionMemberDeclarationContext> members = union.typeParams.members;
List<DataSchema> types = new ArrayList<>(members.size());
Set<DataSchema> typesDeclaredInline = new HashSet<>();
for (UnionMemberDeclarationContext memberDecl : members) {
TypeAssignmentContext memberType = memberDecl.member;
DataSchema dataSchema = toDataSchema(memberType);
if (dataSchema != null) {
types.add(dataSchema);
if (isDeclaredInline(memberDecl.member)) {
typesDeclaredInline.add(dataSchema);
}
}
}
schema.setTypes(types, errorMessageBuilder());
schema.setTypesDeclaredInline(typesDeclaredInline);
return schema;
}
Aggregations