A tool for generating immutable model objects
APACHE-2.0 License
Bot releases are hidden (Show)
Published by rahul-malik almost 5 years ago
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" }
}
}
}
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"
]
}
We've migrated our CI entirely to Github Actions which will make it easier for contributors to analyze logs and build failures.
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)
Published by rahul-malik over 5 years ago
This release contains a lot of internal cleanup as well as new functionality.
Added isSet
methods for each property which will allow callers to differentiate if a property has been set:
This is useful for differentiating:
int
properties will still be 0
if not set)nil
values for reference types (i.e. pointers to objects are nil
if not set)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]
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)
Published by rahul-malik over 6 years ago
This release contains additional fixes to the generation of dictionaryObjectRepresentation for cases where you have model schema with nested collections (lists within lists, maps within maps, lists within maps, ...).
a5e132e Fix issues with nested collections in dictionaryObjectRepresentation (#126)
Published by rahul-malik over 6 years ago
aa069d2 Add basic Objective-C and JS bridging test (#124)
f09ae27 Fix Docker builds (#125)
fe78418 Restore dictionaryObjectRepresentation for Objective-C (#122)
Published by rahul-malik over 6 years ago
For Objective-C, an enum type will no longer have "Type" added to it's name. This introduced issues (https://github.com/pinterest/plank/issues/119) and was inconsistent with the logic we use for Flow.
Previous behavior:
A enum property some_prop
on a type Foo
would generate a enum named FooSomePropType
New behavior:
A enum property some_prop
on a type Foo
will generate a enum named FooSomeProp
If you are currently using Enums you'll likely need to update references to these types in your code base but the functionality remains the same. In the future we'll strive to keep these naming strategies consistent between languages.
991a465 Align naming logic between Flow and ObjC for enums. Fix naming collis… (#120)
f8f7c17 Correct extends field example (#117)
a8d8676 Fixed missing "" (#118)
0e2668c Update README.md (#114)
47fdfdd Builder setter should consider copy memoryAssignmentType (#113)
bcc7bef Enumeration of schema properties should occur in a specific order to ensure a (#110)
df1e444 Update homebrew installation instructions
Published by rahul-malik over 6 years ago
make install
to Makefile
. Use PREFIX
to specify a different installation path than /usr/local
Basic Usage:
make install
Usage with custom installation path:
make install PREFIX=/usr/local/Cellar/plank/1.2.1
Set
type56012d6 Add make install
target to Makefile (#109)
4c3f228 Add autocorrect step to Swiftlint (#107)
3bdc34f Add Set
to docs on property fields (#105)
Published by rahul-malik almost 7 years ago
In this release:
NSSet
for Objective-C, FlowCommits -
801d97e Use copy for NSURL and NSDate
4bdf16d Build archives with sandboxing disabled to allow homebrew installations (#102)
386c378 Update the .PHONY target list (#98)
5612063 Address lint warnings under swiftlint 0.24.0 (#99)
6bd7921 Don't generate dictionary representation until we can verify it compiles (#96)
b870223 Correct integer example (#95)
91d26a0 Rename dictionaryRepresentation method so it doesn't conflict with Foundation's one (#94)
56a6d99 Removes usage of deprecated characters
from String (#93)
d480449 Added support for NSSet properties (#91)
4de2627 Update ObjC builder extension to be aware of nullability of properties (#88)
8d84d74 Remove default case that will never be executed (#87)
ad1aed3 Fix issue with generating the dictionaryRepresentation method for schemas that (#85)
c5ed50a Expand list of reserved objc keywords to cover most conflicting case (#79)
3fc1bea Fix make clean command(#65)
6399daf ObjectiveCDictionaryExtension to correctly handle maps of root objects (#81)
9bc92b3 Compare NSArrays using -isEqualToArray: (#83)
c855031 Update indentation settings in plank.xcodeproj (#82)
f8378f6 Objective-C init extension to better handle null model dictionary in prod builds (#80)
92c9a3f Bazel build support for Plank (#75)
Published by rahul-malik about 7 years ago
--print_deps - Just print the path to the dependent schemas necessary to generate the schemas provided and exit.
--no_recursive - Don't generate files recursively. Only generate the one file I ask for.
--only_runtime - Only generate runtime files and exit.
--lang - Comma separated list of target language(s) for generating code. Default: "objc"
--help - Show this text and exit.
This release contains an early experimental implementation of Flow type generation. Now your schema files can be used to generate multiple languages by using the --lang
command line option.
--lang flow
--lang flow,objc
More documentation on Flow is coming soon but you can see the current output in the Examples.
required
will now influence if it is nonnull
or nullable
. Previously all methods were nullable
."- (NSDictionary *)dictionaryRepresentation"
allows your models to output a dictionary representation of themselves. This is intended to be the inverse of initWithModelDictionary
.864abac Nullability support in Plank: (#64)
6808341 Add dictionary representation to Objc models (#67)
fc967d5 Add tests for generated models to the integration tests pipeline (#69)
116b818 Copy the value to an ivar backed by a copy property (#72)
0d50564 Add custom indentation support (#61)
37a6bc3 Don't camel case the description for EnumValue by default (#60)
12db0da Add Flow Type Support (#57)
6d226ec Fix lint warnings (#58)
332af42 Use relative schema urls internally (#59)
46d340f Fix critical bug where deep equality comparison contained a pointer equality (#50)
658c73f Add initial support for integration testing. (#48)
aba7ecc Remove FilePrinter protocol (#46)
86873d0 Update to newest CI (#44)
69e6d20 Add lang attribute to provide future flexibility for additional languages in (#42)
d69c8e6 Simplify initWithModelDictionary and improve performance (#40)
e8d35e3 Update Plank to Swift 3.1 (#39)
38f6da3 Makes the code more readable via early returns / fatal errors in guards (#35)
9fefe3a Support for no_recursive and only_runtime flags. Fix print_deps output (#32)
120e4d2 Add cli option for printing the dependencies of a schema (#30)
Published by rahul-malik over 7 years ago
This is the initial public release of plank.