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

Remove (enrichment) option #312

Merged
merged 18 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
public final class EnrichmentForOption {

/** Splits type references separated with commas. */
private static final Splitter splitter = Splitter.on(',');
private static final Splitter splitter = Splitter.on(',')
.trimResults();

/** Prevents instantiation of this utility class. */
private EnrichmentForOption() {
Expand Down
59 changes: 0 additions & 59 deletions base/src/main/java/io/spine/code/proto/ref/EnrichmentOption.java

This file was deleted.

87 changes: 26 additions & 61 deletions base/src/main/proto/spine/options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,60 +180,39 @@ extend google.protobuf.FieldOptions {
//
// The value of the option is the name of the target event message/context field
// which is used to set the corresponding enrichment's field.
// The value must have event/context FQN prefix if `enrichment_for` option is omitted
// ("example.events.MyEvent.user_id" instead of just "user_id").
// The value of (by) option may contain more than one field reference,
// separated with the pipe character.
//
// An example:
//
// message MyEvent {
// spine.base.UserId user_id = 1;
// ...
// message Enrichment {
// spine.people.PersonName name = 1 [(by) = "user_id"];
//
// string time = 2 [(by) = "context.timestamp"];
// }
// spine.base.UserId user_id = 1;
// }
//
// message MyEventEnrichment {
// string username = 1 [(by) = "MyEvent.user_id"];
// }
//
// If a single enrichment message is used to enrich several events, a wildcard syntax may be
// used.
// option (enrichment_for) = "MyEvent";
//
// An example:
//
// message EnrichmentForSeveralEvents {
// string username = 1 [(by) = "*.user_id"];
// string username = 1 [(by) = "user_id"];
// }
//
// message EventOne {
// option (enrichment) = "EnrichmentForSeveralEvents";
// Multiple field references example:
//
// int32 user_id = 1;
// message FirstEvent {
// spine.base.UserId user_id = 1;
// }
//
// message EventTwo {
// option (enrichment) = "EnrichmentForSeveralEvents";
// message SecondEvent {
// string id = 1;
//
// int32 user_id = 1;
// spine.base.UserId admin_id = 1;
// }
//
// Also, the multiple arguments are supported. The syntax is:
//
// message EnrichmentForSeveralEvents {
// option (enrichment) = "EnrichmentForSeveralEvents";
// option (enrichment_for) = "FirstEvent,SecondEvent";
//
// int32 user_id = 1 [(by) = "qualifier.One.target_field | qualifier.Two.alternate_target_field"];
// string username = 1 [(by) = "user_id | admin_id"];
// }
//
// Wildcard syntax for the target fields is supported in cases when annotation `enrichment_for`
// gives a not ambiguous definition for the target type.
//
// If using the FQN field names, the `enrichment_for` annotation may be omitted
// (the same behavior as with a single-argument `by` annotation).
//
string by = 73900;
}

Expand Down Expand Up @@ -386,42 +365,28 @@ extend google.protobuf.MessageOptions {
// ...
// }
//
// The enrichment can qualify for all messages within a package using suffix wildcard (*)
yuri-sergiichuk marked this conversation as resolved.
Show resolved Hide resolved
// pattern. Infix and prefix wildcards are not supported.
//
// This option can be omitted if:
// - the enrichment message is enclosed into the target event message;
// - all `by` options have the event name prefix ("example.events.MyEvent.user_id" instead of
// just "user_id").
//
string enrichment_for = 73922;

// An instruction to enrich an event with one or more enrichments.
//
// This option is defined in event messages.
// If more than one enrichment should be added, their type names should be separated with
// the comma. For example:
// For example:
//
// message MyEvent {
// option (enrichment) = "EnrichmentOne,"
// "EnrichmentTwo";
// message MyEnrichment {
// option (enrichment_for) = "example.events.*"
// ...
// }
//
// Fields of the referenced enrichment types refer to the fields of the event message via
// `by` option. Therefore, if `enrichment` option is used in more than event message, the fields
// participating in the enrichment process must have the same names.
//
// In the enrichment message a wildcard `by` option syntax may be used to reference more than
// a single target events to enrich.
// It is also possible to mix different declarations as follows:
//
// For example:
//
// message EnrichmentForSeveralEvents {
// string username = 1 [(by) = "*.user_id"];
// message MyEnrichment {
// option (enrichment_for) = "example.events.*,"
// "secondExample.FirstEvent,"
// "thirdExample.*";
// ...
// }
//
string enrichment = 73923;
string enrichment_for = 73922;

// reserved 73924 to 73939 for future options.
// reserved 73923 to 73939 for future options.

// Command Options
//-------------------
Expand Down
2 changes: 1 addition & 1 deletion config
Submodule config updated 3 files
+14 −2 gradle/javac-args.gradle
+20 −0 pull
+67 −0 pull.bat
Loading