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

Change type version type in generated code to int #110

Closed
wwerner opened this issue Dec 13, 2019 · 2 comments
Closed

Change type version type in generated code to int #110

wwerner opened this issue Dec 13, 2019 · 2 comments

Comments

@wwerner
Copy link
Contributor

wwerner commented Dec 13, 2019

Originally posted by @VaughnVernon in #98 (comment)

@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.

@VaughnVernon
Copy link
Contributor

VaughnVernon commented Dec 15, 2019

@wwerner On second thought would be good to not have to type out the following:

extends io.vlingo.lattice.model.DomainEvent
extends io.vlingo.lattice.model.Command

Instead we should have a shorthand, maybe just ex:

event FooHappened ex {
  ...
}

command DoFoo ex {
  ...
}

The type event and command already imply what the base class would be. Thoughts?

kmruiz added a commit that referenced this issue Dec 19, 2019
@kmruiz
Copy link
Contributor

kmruiz commented Dec 19, 2019

@VaughnVernon , @wwerner , check the commit attached to this issue. Now the version should be an integer, built using SemanticVersion.

37c8b51

I think it's also a good example on how to change computed types from now on 😄

kmruiz added a commit that referenced this issue Dec 19, 2019
@wwerner wwerner 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
Development

No branches or pull requests

3 participants