Skip to content

Releases

1.3.0

Choose a tag to compare

@haumacher haumacher released this 25 Sep 18:33

New Features

  • TypeScript type definitions: Generate a TypeScript module per .proto file describing its JSON
    format (interfaces for messages, string-literal unions for enums, type-tagged tuple unions for polymorphic values).
    Top-level types are named with the suffix Json (e.g. ShapeJson, AnyShapeJson), since they describe the JSON
    format, not the data itself. Properties the Java writer always emits are required, only nullable fields are optional.
    Enabled for all files with the Maven plugin parameter typeScriptOutputDirectory or the -ts <dir> CLI argument,
    or per file with option TypeScript = "path/to/module.ts";.
    For polymorphic values, the modules contain small helpers operating on the plain JSON values (#10): a visitor
    interface and an exhaustive dispatch function (visitShapeJson(value, visitor), with a required visitDefault for
    option OpenWorld) and a type guard checking the type tag (isAnyShapeJson(value)) per Any...Json union, and a
    function creating the type-tagged tuple per concrete type (tagCircle(self)). No helpers are generated for
    option SharedGraph. Helper names that would clash (e.g. of message A_B and a nested A.B) are rejected.
  • File documentation comment: A doc comment before the syntax or package declaration is kept as the documentation
    of the .proto file (DefinitionFile.comment) and emitted as TSDoc @packageDocumentation of the TypeScript module.

Bug Fixes

  • Nested polymorphic hierarchies (#16): An abstract message nested in another message no longer crashes the
    generator with a NullPointerException. Nested sub-messages of a top-level abstract message are referenced by
    their qualified names in the generated JSON and XML readers (previously uncompilable). For option OpenWorld, the
    "same file" test for local subtypes and the implied NoBinary of extension files now also hold for nested
    definitions.
  • Maven plugin parameter names (#17): The parameters input, outputDirectory, resourceOutputDirectory and
    includePaths can be set under these names in the plugin <configuration>. Before, only the user properties
    (-DoutputDir=…) worked, and the README's <resourceOutputDir> was silently ignored.
  • Format options for enums (#20): option NoBinary and option NoJson (and the implied NoBinary of
    option SharedGraph and option OpenWorld) now also suppress the binary and JSON methods of enums.
    Source compatibility: a file that uses an enum of another file in a format the other file disables did compile
    before, because enums always had all methods. It is now rejected with an error naming both files and the option,
    as are references to messages of such files and mixed option SharedGraph references, which generated uncompilable
    code before. The generator (CLI and Maven plugin) now stops without writing code when it finds such errors.
  • XML format: transient and derived fields (#29): transient fields are no longer written in XML format, like in
    JSON and binary format. Wire format change: XML documents no longer contain these attributes and elements;
    readers ignore them in documents of earlier versions. The same applies to derived references (@Container,
    @Reverse): writing an object whose container was set to XML recursed endlessly (StackOverflowError).
  • Redeclared fields (#21): A field that redeclares an inherited field (directly or through any generalization,
    also across files), a field declared twice, and fields whose names generate the same Java names (e.g. foo_bar and
    fooBar) are rejected with an error. Before, the generator silently produced Java code that did not compile.
  • Extensions across files require OpenWorld (#25): A message that extends a message of another file is rejected
    unless that file declares option OpenWorld. Extending from another package produced Java that did not compile.
    Source compatibility: extending a message of an only imported (not generated together) file of the same package
    compiled before, but the readers of the base did not know the subtype. It is now rejected as well. A closed
    hierarchy split into files of the same package that are generated together is still accepted. Inheritance cycles
    are rejected with an error instead of crashing the generator.
  • Nested specializations of the outer message (#32): A message nested in its own generalization (e.g.
    abstract message Expr { message Sum extends Expr {…} }) crashed the generator with a StackOverflowError.
  • Consistent options across extends (#37, #38, #39, #40, #41): A message that extends a message of another
    file is rejected if the files disagree on the serialization formats, NoVisitor, NoVisitorExceptions,
    NoTypeKind or NoInterfaces, or if it adds listener or reflection support its generalization lacks. These
    combinations generated uncompilable code. The exception is NoJson (or NoXml) only on an OpenWorld extension
    file: it compiled, but the extension type was written without its own fields and could not be read. It is rejected
    now as well. option OpenWorld on a file whose hierarchy root is in a file without it, and OpenWorld combined
    with SharedGraph or NoInterfaces (before only a message on the console), are rejected. option NoVisitor now
    also suppresses the visitor of OpenWorld extension types.
  • OpenWorld readers of abstract intermediates (#26): The JSON reader of an abstract message below the root of an
    option OpenWorld hierarchy (e.g. Bird in Animal > Bird > Parrot, top-level or nested) no longer fails to
    compile. It reads the types of other files registered with the root, if they are specializations of the message; a
    registered type of another subtree is skipped like an unknown type (the reader returns null). This also works for
    abstract intermediates declared in extension files (which need option OpenWorld to be extended themselves), at any
    depth. All concrete messages of an extension file below an OpenWorld message of another file are now registered,
    also those extending a message of their own file. Visiting a type of an extension-file intermediate with a visitor
    that does not know it calls visitDefault(), and such types return null from kind(). The JSON readers load the
    type registrations themselves (before, reading an extension type returned null unless some implementation class
    of the hierarchy had been initialized before).
  • OpenWorld XML readers (#27): The XML readers of an option OpenWorld hierarchy (root and abstract intermediates)
    now read the types of other files. The generated registration class (e.g. Ext1Types) additionally registers the
    XML element name of each extension type with the root (registerXml(), XML_REGISTRY), if the files generate XML.
    The wire formats are unchanged.
  • Primitive types in XML and binary format (#44): bytes, fixed32 and uint32 fields no longer generate
    uncompilable XML code (all versions since 1.1.0). bytes are written in Base64, fixed32/uint32 as unsigned
    decimal (the readers also accept the signed form). Nullable fields that are not set are omitted in XML format, and
    bytes fields without a value in XML and binary format, instead of failing with a NullPointerException. An empty repeated
    value (written as empty attribute) is read as empty list (before, reading failed for numbers, and a list of strings
    contained one empty string). In binary format, sint32/sint64 values are now written zig-zag encoded and
    fixed32/sfixed32/fixed64/sfixed64 values in fixed length, as the readers always expected, and 64 bit values
    above 32 bits are read correctly (fix in msgbuf-api). Wire format change: the binary encoding of these six
    types changes; values written before could not be read back correctly (except 0), and writing a repeated field
    of these types failed.
  • Clashing type IDs in a hierarchy (#45): Two concrete specializations of an abstract message with the same type
    ID (by default the simple name, e.g. a top-level Item and a nested Msg.Item, or an equal @Name), the same XML
    element name, or the same explicit @type_id, also in extension files of an option OpenWorld hierarchy generated
    together, are rejected with an error naming both definitions. So are messages of one hierarchy with the same
    TypeKind constant (fix: rename, or option NoTypeKind), and a message with the name of a nested definition of
    one of its generalizations, which the generated class could not refer to. A top-level specialization whose simple
    name is shadowed by a nested definition in the scope of its generalization is referenced by its qualified name in
    the readers (before, the reader dispatched to the nested definition). Source compatibility: these definitions
    generated uncompilable code before (or silently wrong readers), except equal type IDs in the option OpenWorld
    registry of extensions of different files, where the last registered type won.
  • Name resolution across packages (#46): An unqualified type name resolves (after nested definitions of the
    message using it and its outer messages) to a definition of the package of the file using it, then to a definition
    of the files it imports (directly, then indirectly), and only then to a definition of any other file generated in
    the same run, if it is unique (see README, "Type names and imports"). Before, one global table of simple names was
    used, and the definition of the last file loaded won. So the resolution of a file's names no longer depends on
    unrelated files generated together, as long as it uses definitions of its own package or its imports. Duplicate
    definitions in a package (in one or several files) stop the generation with an error naming the files, instead of
    only a message on the console. A file given to the generator twice, or gi...
Read more

1.2.2

Choose a tag to compare

@haumacher haumacher released this 21 May 14:33

What's Changed

  • fix: add GWT super-source for TypeRegistryLoader by @jhuesing in #15

New Contributors

Full Changelog: msgbuf-api-1.2.1...msgbuf-api-1.2.2

1.2.1

Choose a tag to compare

@haumacher haumacher released this 26 Mar 08:05

1.2.0

Choose a tag to compare

@haumacher haumacher released this 25 Mar 11:40

What's Changed

  • Fix default lifecycle phase for generate goal to generate-sources by @haumacher in #12
  • Feature/issue 9 cross file extension by @haumacher in #13
  • Feature/issue 11 json field type by @haumacher in #14

Full Changelog: msgbuf-api-1.1.10...msgbuf-api-1.2.0

1.1.10

Choose a tag to compare

@haumacher haumacher released this 03 Sep 14:53

What's Changed

Full Changelog: msgbuf-api-1.1.9...msgbuf-api-1.1.10

1.1.9

Choose a tag to compare

@haumacher haumacher released this 03 Sep 12:18

What's Changed

  • Fixed call of DefaultScope#beforeChange() by @dbusche in #6

Full Changelog: msgbuf-api-1.1.8...msgbuf-api-1.1.9

msgbuf-api-1.1.8

Choose a tag to compare

@haumacher haumacher released this 06 May 09:58

What's Changed

  • Use impl type only when interfaces are used. by @dbusche in #4
  • Added listener method "afterChanged". by @dbusche in #5
  • Fixed error in shared graph sync due to missing ID.
  • No updates for transient objects in shard graph sync.
  • Fixed endless reading from StringR.
  • Allow to react on change of shared graph.
  • Fixed GWT incompatibilities.
  • Allow to specify field default values (9561842)
  • Fixed code generation for derived fields.

Full Changelog: msgbuf-api-1.1.7...msgbuf-api-1.1.8

1.1.7

Choose a tag to compare

@haumacher haumacher released this 09 Apr 15:04

What's Changed

  • Fixed reading of fields in generated classes by @dbusche in #2
  • Added missing override for "set". by @dbusche in #3

Full Changelog: msgbuf-api-1.1.6...msgbuf-api-1.1.7

1.1.6

Choose a tag to compare

@haumacher haumacher released this 04 Apr 12:40

What's Changed

Full Changelog: msgbuf-api-1.1.5...msgbuf-api-1.1.6

1.1.5

Choose a tag to compare

@haumacher haumacher released this 14 Apr 18:17
  • Added missing self() method override for @operations(...) annotated data classes.
  • Added missing type kind literal for non-abstract root data classes.