Plank v1.6 Release Notes

Release Date: 2020-01-07 // almost 2 years ago
  • โšก๏ธ Updates

    General

    Nested object definitions.

    ๐Ÿ‘ Previously it was required to create a new file for each schema. Now we support declaring types within types which can be useful for ones that only make sense in a certain scope or are fairly minimal.

    Example schema declaration:

    { "some\_property" : { "type": "object", "title": "nested", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } } } }
    

    JSON dependency graph output

    0๏ธโƒฃ The behavior of the --print_deps output has changed to be JSON by default. This allows for tooling to be built to visualize or analyze dependency graph of your schemas.

    Given this command using our example schemas:

    plank --print\_deps Examples/PDK/pin.json 
    

    You'll get an output with it's dependencies and any inherited types (via extends keyword)

    { "pin" : ["image", "board", "user"] }
    

    CI

    ๐Ÿ— We've migrated our CI entirely to Github Actions which will make it easier for contributors to analyze logs and build failures.

    Objective-C

    • ๐Ÿ–จ Optimizations around memory footprint of properties
    • โšก๏ธ Test updates for equality methods

    Java

    • โœ‚ Removed AutoValue as a dependency
    • ๐Ÿ‘Œ Support for tracking properties which are set
    • ๐Ÿ‘ ADT, equality and nullability support
    • TypeAdapters derived from Schema definitions

    ๐Ÿ”„ Changes

    ๐Ÿ“š 8ee84c2 Mention nested object types in the documentation (#258)
    ๐Ÿ‘ 2346a29 Support nested object type definitions (#256)
    85e802f Mark generated files using 'linguist-generated' (#257)
    ๐Ÿšš e4e5e72 Remove trailing space after integer-based enums (#255)
    9e5c65f Missing @SerializedName annotation on integer-based enums (#253)
    fbcd34f Convert deps command output to produce JSON (#252)
    c232819 Java model potentially missing import for types contained in maps and lists (#251)
    โฌ†๏ธ 921c98f Upgrade swiftformat and swiftlint (#250)
    979e358 Java ADT partial implementation (#249)
    ๐Ÿ‘ท 41c25a8 Migrate CI to Github CI/CD (#239)
    ๐Ÿ”ง eeb4918 Support configurable URI types for Java (#245)
    ๐ŸŒฒ 618acaa Optionally log unknown properties in TypeAdapter.read (#243)
    9d367a5 Java equals() should evaluate primitives first (#244)
    a27b144 Check _bits directly in internal calls (#242)
    f650f01 Order modifiers according to the Java spec (#241)
    42a168b Make generated TypeAdapter classes private (#240)
    690a266 Only allocate _bits when necessary (#238)
    55b0a25 Use transitiveProperties to gather Java imports (#237)
    fa2e15e Only import the necessary set of types (#235)
    920dcee Stop importing java.lang.annotation.Retention{Policy} (#234)
    01cf3e9 Stop importing com.google.gson.JsonElement (#233)
    6253078 Add the Plank project URL to the file comment header (#232)
    4c794b2 Java model property annotations should be sorted deterministically (#231)
    bf771de Java model TypeAdapter write method should not use delegateAdapter. (#227)
    730f8e1 Add more nullability annotations to Java models (#228)
    f683102 Java model TypeAdapter should not not instantiate its inner TypeAdapters until needed (#226)
    102d645 Java models should not include null fields when serialized into Json (#225)
    ๐Ÿ— faadfa9 Java Model Builder.build method should be annotated with NonNull (#223)
    7b054be Java model - _bits field should be deserialized if it's present in the JSON (#221)
    bc8c8fd Java Model Decorators (beta) (#217)
    ๐Ÿ— 738fb3e Builder property variables should not have @SerializedName annotation (#220)
    d4a714d Emit BOOL properties as bitfields (#208)
    โœ… 47fb542 Add equality tests for ObjC (#219)
    ๐Ÿ”€ c7fe044 Missing call to set tracking isSet-bit in Java model merging (#218)
    d3c6322 Use smaller enum types to reduce object sizes. (#207)
    ๐Ÿ›  ef88906 Use a boolean[] array for tracking set-bits so we can accommodate models with more than 32 fields (fixes integer overflow) (#216)
    32f2fe5 Add option to generate Java private setters (#212)
    ๐Ÿ— 8d23c9b Fix invalid call to Builder-setter from Java TypeAdapter (#211)
    ๐Ÿ‘ 427edd4 Add support for androidx Nullability annotations (#204)
    f368cd1 Add a static TYPE variable to java models (#201)
    โšก๏ธ bdd00b0 Toolchain updates (#196)
    ๐Ÿšš a8e91d3 Remove local shadow variable self.properties should be used for clarity. (#202)
    a2d1022 Fix archive command to work also with Swift 5 (#200)
    d467436 Avoid use of reflection-based deserialization in Java model (#194)
    ๐Ÿ‘• 02d18ba Add linter for making sure linux main is kept up to date (#192)
    5e5ed22 Don't use ObjectiveC-based handling of reserved keywords for Java (#187)
    2dd9ed8 Add missing check for null json token (#188)
    06925b8 Use standard Java enum types for enum properties (#184)
    e63f15c For Boolean, Double and Integer properties, getters should be NonNull (#178)
    ๐Ÿ— efe3c84 Build Java sources during integration tests (#176)
    47ad603 Add custom TypeAdapter for Java models that will allow for setting _bits field (#177)
    f38aa84 Fix missing comma in Java model constructor (#175)
    โšก๏ธ 3cb4722 Update docs to reflect that plank is for more than Objective-C (#173)
    ๐Ÿšš 7d17623 Remove AutoValue from Java generated models (#159)
    โšก๏ธ 4372837 Update variable name substitution logic (#157)
    ๐Ÿ‘ท fd4dea5 Remove unused CI directory
    ๐Ÿ‘• 1d44870 Add swiftlint / swiftformat in Package.swift, fix issues (#168)


Previous changes from v1.5

  • ๐Ÿš€ This release contains a lot of internal cleanup as well as new functionality.

    โšก๏ธ Updates

    Objective-C

    โž• Added isSet methods for each property which will allow callers to differentiate if a property has been set:
    This is useful for differentiating:

    • 0๏ธโƒฃ Default values for primitive types (i.e. int properties will still be 0 if not set)
    • nil values for reference types (i.e. pointers to objects are nil if not set)

    Bazel

    ๐ŸŽ‰ Initial support for building plank and integrating it within your local bazel project.

    First add plank to your WORKSPACE file

    git\_repository( name = "plank", remote = "https://github.com/pinterest/plank.git", tag = "1.5")
    

    Then you can run plank using:
    bazel run @plank//:plank -- [YOUR ARGS HERE]

    Java (alpha)

    • ๐ŸŽ‰ Initial support is available and depends on AutoValue and GSON. AutoValue is likely to be removed soon as a requirement.
    • ๐Ÿ‘ Java support is in active development and breaking changes are likely
    • Audience is focused on Android development which could influence some of the design decisions / dependencies

    ๐Ÿ”„ Changes

    eaaccea [Objective-C] Option for adding abilities to tell if a method is set.
    fa1a00d [Objective-C] Fix issues that cause unstable output (#160)
    โšก๏ธ bec7ec9 Update WORKSPACE to latest rules_swift dependencies (#163)
    ๐Ÿ‘• e041f8e Enable Swiftlint for PRs (#154)
    โšก๏ธ 27f2219 Update README.md
    ๐Ÿ‘ท ce0dbea Migrate Plank to Travis CI (#152)
    71a3a5c Fix typo (#146)
    โšก๏ธ c387215 Update bazel build to use rules_swift
    โ™ป๏ธ 7328fa0 Refactor version number to use a struct (#145)
    8053ab1 Add version to CLI (#144)
    87197a3 Add flag to avoid runtime files from getting generated (#137)
    9439de7 Fix nil-checking issue in dictionary representation (#135)
    โšก๏ธ 0c2bf4e Update to Swift 4.1, fix inheritance issue with equality (#133)
    โšก๏ธ 42838c3 Update Java enum rendering to avoid collisions when multiple enums are (#130)
    ๐Ÿšš db6c647 Use fancy string enums and remove unused runtime function (#128)
    ๐Ÿง 6eb769b Fix linux build (#127)
    ๐Ÿ“š 153ebe7 Use @NonNull for nonnull Java properties. Add nullability to documentation
    ๐Ÿ“š 1b4641c Add initial Java documentation
    7a0b6aa Separate CLI reference into its own page
    56097d2 Add flow documenation overview
    ๐Ÿ‘ a86117d Initial support for Java (#106)