Closed hurelhuyag closed 3 years ago
@hurelhuyag This is not a problem with events that use data.
@VaughnVernon Same exception raising with this
event PetRegistered {
version semanticVersion
string id
Vlingo:Developers:io.vlingo.developers.petclinic:Name:1.0.0 name
long birth
Vlingo:Developers:io.vlingo.developers.petclinic:Kind:1.0.0 kind
Vlingo:Developers:io.vlingo.developers.petclinic:Owner:1.0.0 owner
}
@hurelhuyag Why? Please fix the problem.
/cc @danilo-ambrosio
@VaughnVernon
I could not reproduce this problem. The only thing I've found on the pet clinic example was a difference between the org name in the pom and in the VSS files. This inconsistency causes an error while pushing the schemas. Once I fixed the org name in the pom file., all schemas (including the ones that depend on another) were successfully pushed.
The image below shows all pet clinic schemas that I published during the tests:
@VaughnVernon
If you get a chance, just in case, start the Schemata service then pull the fixed xoom-petclinic-2 and run mvn clean install
. If the build succeeds, we can close this issue.
@danilo-ambrosio Test and confirmed. No problems on my side.
@hamzajg Looks like this is not a real problem.
Reopening for possible secondary cause. Seeking test case to find how it can happen and how it can be fixed.
/cc @hamzajg
Confirmed by @hamzajg that @danilo-ambrosio fix was the same one he was pursuing.
This is a problem when parsing the schema version in order to generate Java or C# code. I've investigated this and generated a decent error message. The parser doesn't support type references that are either fully-qualified or prefixed with category type.
Apparently the definition isn't parsed before schema-push
, otherwise the same definitions wouldn't be pushed in.
I will push the error message support.
/cc @jakzal @danilo-ambrosio
I added better parser error output, as follows:
00:55:33.272 [pool-2-thread-7] ERROR io.vlingo.xoom.actors.Logger - Parsing failed for schema: xoom:apps:io.vlingo.xoom.examples.petclinic:VeterinarianRegistered:1.0.0
Error [4,2]: mismatched input 'xoom' expecting {'boolean', 'byte', 'char', 'double', 'float', 'int', 'long', 'short', 'string', 'timestamp', 'type', 'version', '=', '}', TYPE_IDENTIFIER}null
org.antlr.v4.runtime.DefaultErrorStrategy.recoverInline(DefaultErrorStrategy.java:485)
org.antlr.v4.runtime.Parser.match(Parser.java:206)
io.vlingo.xoom.schemata.codegen.antlr.SchemaVersionDefinitionParser.typeBody(SchemaVersionDefinitionParser.java:276)
io.vlingo.xoom.schemata.codegen.antlr.SchemaVersionDefinitionParser.typeDeclaration(SchemaVersionDefinitionParser.java:140)
io.vlingo.xoom.schemata.codegen.parser.AntlrTypeParser.parseTypeDefinition(AntlrTypeParser.java:60)
io.vlingo.xoom.schemata.codegen.TypeDefinitionCompilerActor.compile(TypeDefinitionCompilerActor.java:37)
io.vlingo.xoom.schemata.resource.CodeResource.compile(CodeResource.java:135)
io.vlingo.xoom.schemata.resource.CodeResource.lambda$queryCodeForLanguage$0(CodeResource.java:93)
io.vlingo.xoom.common.completes.FutureCompletes$State.lambda$functionWrapper$8(FutureCompletes.java:576)
io.vlingo.xoom.common.completes.FutureCompletes$State.lambda$composableFunction$5(FutureCompletes.java:496)
java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:952)
java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Also every time a new type is parsed and instantiated as an object, it's definition is printed to the console. (This can be removed after debugging.) From this example you can see that the type is not fully loaded because the complex types are missing (not even sure why it gets that far).
==========
TypeDefinition [category=Event, fullyQualifiedTypeName=xoom:apps:io.vlingo.xoom.examples.petclinic:VeterinarianRegistered:1.0.0, typeName=VeterinarianRegistered, children=[FieldDefinition [type=BasicType [typeName=version], version=Optional.empty, name=semanticVersion, defaultValue=Optional.empty], FieldDefinition [type=BasicType [typeName=string], version=Optional.empty, name=id, defaultValue=Optional[NullValue []]]]]
==========
The VeterinarianRegistered
event should have all of the following, but only the semanticVersion
and id
are seen in the above TypeDefinition
log:
event VeterinarianRegistered {
version semanticVersion
string id
xoom:apps:io.vlingo.xoom.examples.petclinic:FullName:1.0.0 name
xoom:apps:io.vlingo.xoom.examples.petclinic:ContactInformation:1.0.0 contactInformation
xoom:apps:io.vlingo.xoom.examples.petclinic:Specialty:1.0.0 specialty
}
The way parser rules are currently defined require that:
Org
needs to have the first letter capitalised (Xoom
instead of xoom
)petclinic
is fine, but io.vlingo.xoom.examples.petclinic
is not)Part of the problem might be that the top level type definition:
is shared with attribute type definition:
Perhaps decoupling the two type definition is necessary to make the attribute type definition more elastic.
@jakzal The schema definitions now support only category.Type
, category.Type:m.m.p
, etc.
Fixed by #191 #192 #193 #194 #195
For example, currently, schemata can't parse this VSS file.
Stacktrace: