From 39a2e740255988b0968fed3cb131dba8b153fe94 Mon Sep 17 00:00:00 2001 From: Arne Seime Date: Mon, 23 Nov 2020 18:02:59 +0100 Subject: [PATCH] #102 Check that substitute type is complex before checking if type is abstract --- .../java/no/entur/schema2proto/generateproto/SchemaParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/SchemaParser.java b/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/SchemaParser.java index d501c49c..0e7fd7f1 100644 --- a/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/SchemaParser.java +++ b/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/SchemaParser.java @@ -385,7 +385,8 @@ private void navigateSubTypes(XSParticle parentParticle, MessageType messageType allSubtitutables.addAll(subsumptionSubstitutables); for (XSElementDecl substitutable : allSubtitutables) { - if (substitutable.isAbstract() || substitutable.getType().asComplexType().isAbstract()) { + if (substitutable.isAbstract() + || (substitutable.getType().isComplexType() && substitutable.getType().asComplexType().isAbstract())) { // No abstract concept in protobuf, only concrete messages } else { addOneOfField(messageType, schemaSet, fieldOptions, fieldLocation, oneOf, substitutable);