Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Schemata containing simple types cannot be retrieved via the API #98

Closed
wwerner opened this issue Dec 6, 2019 · 6 comments · Fixed by #101
Closed

[API] Schemata containing simple types cannot be retrieved via the API #98

wwerner opened this issue Dec 6, 2019 · 6 comments · Fixed by #101
Assignees

Comments

@wwerner
Copy link
Contributor

wwerner commented Dec 6, 2019

When requesting the sources for a schema that contains at least one basic type not checked for in io.vlingo.schemata.codegen.processor.types.ComputableTypeProcessor#resolveType, the request hangs.
Schema not containing simple types can be retrieved, but after trying to retrieve one that does, a second try with a schema that worked before also fails.
If I'm not mistaken, this only happens with the TypeResolver in SchemaVersionQueriesActor, CacheTypeResolver did work with basic types.

When compiling the same schema within a test, the compilation works.

To reproduce via the http API:

  • Run all requests in src/test/resources/rest-api-calls.http starting from L:148 one after another
  • The last request (L:160) leads to the issue

To reproduce via the UI:

  • Open the UI
  • Create Org/Unit/Context/Schema/SchemaVersion
  • Use a specifciation containing a string property, see example
  • Navigate to the schema version in the treeview
  • Select the version
  • Request the generated sources by clicking Source

image

Minimal example spec:

event Foo {
    string bar
}

There already was a discussion on Slack, but I prefer having an issue to reference instead of searching within the chat history.

@wwerner
Copy link
Contributor Author

wwerner commented Dec 6, 2019

Findings so far:

image

wwerner added a commit that referenced this issue Dec 6, 2019
wwerner added a commit that referenced this issue Dec 6, 2019
@wwerner wwerner removed their assignment Dec 7, 2019
@wwerner wwerner mentioned this issue Dec 7, 2019
26 tasks
@pflueras
Copy link
Member

This issue seems to be a duplicate of #89
PR: #106 fixed only happy use cases (already in master).
Still to be fixed use cases when it is requested source code for non-existing SchemaVersion.
@wwerner please confirm that 'Source' button works correctly now.

wwerner added a commit that referenced this issue Dec 12, 2019
@wwerner
Copy link
Contributor Author

wwerner commented Dec 12, 2019

@pflueras Thanks, it does not hang anymore, thats certainly an improvement.

However, simple types other than event, version and timestamp are being ignored in the generated sources now.
See src/test/resources/io/vlingo/schemata/codegen/vss/allSingleTypes.vss for an example containing all possible simple types.

image

To reproduce, please have a look at #101, it contains both unit and e2e tests showing the issue.

In io.vlingo.schemata.codegen.specs.JavaCodeGenTests#testThatGeneratesABasicTypeWithAllConsideredInnerTypes, the code is compiled using the java backend directly which works.

In io.vlingo.schemata.codegen.JavaCodeGenSchemaVersionResolverTests#testThatSpecificationsContainingBasicTypesCanBeCompiledWithSchemaVersionQueryTypeResolver, the basic types are omitted in the generated sources as shown in the screen shot.

Please feel free to work in the feature/98-fix_compilation_w_basic_types (it is updated w/ the current state containing your fixes from master) branch directly so you don't have to merge the tests back and forth.

@VaughnVernon
Copy link
Contributor

VaughnVernon commented Dec 12, 2019

@wwerner My intention was for the typeVersion to be an int since io.vlingo.common.version. SemanticVersion understands how to convert into and out of multiple values of major, minor, and patch, as well as String representation. The int is only 4 bytes or less and as a JSON String-ified value most times 5-7 bytes (1.0.0 or 10.1.1, etc., and maybe 7 bytes as in 10.35.2).

Spec:
version typeVersion

becomes:
public final int typeVersion;

The above supports plain types, in case standard types not desired/used.

Further, if using a standard base class, spec should be:
extends io.vlingo.lattice.model.DomainEvent
extends io.vlingo.lattice.model.Command

becomes:
import io.vlingo.lattice.model.DomainEvent;
or:
import io.vlingo.lattice.model.Command;

public final class FooHappened extends DomainEvent {
// or
public final class DoFoo extends Command {

  // nothing here for version because standard types have:
  // public final int sourceTypeVersion;
  // and also no occurredOn here because standard types have:
  // public final long dateTimeSourced;
}

Sorry for the surprise extends. I have thought of how to deal with this but didn't finalize my ideas and this situation reminded me that it's necessary.

@wwerner
Copy link
Contributor Author

wwerner commented Dec 27, 2019

This is not fixed yet. I opened a new branch containing tests to reproduce, as the original one was merged already. I ignore the failing tests on master now and work on the issue in #115

@pflueras
Copy link
Member

pflueras commented Jan 9, 2020

This issue is likely to be fixed fixed by #117

@pflueras pflueras closed this as completed Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants