pulumi/pkg/codegen/hcl2/model
Fraser Waters c7ed4024ff Support for integers on the wire and state protocol
An exploration into how we could support int64 as well as float64 as a
first class type in Pulumi.

There's some inherit trickiness with this because we use JSON in a few
places, state files most obviously but `PropertyValue` on the wire is
using the protobuf `Struct` and `Value` types which are just mappings to
JSON as well.

JSON doesn't have an int64 type, and while the Go JSON marshaller can
read/write int64s it's not a great behaviour to rely on given mixed
support for that across languages. Further the protobuf `Value` type
only supports float64s.

So we support integers similar to our other special types (like assets)
and wrap them in an object with a special signature field. The value
itself is either a number (if it can safely roundtrip to float64 and
back again) or a string.

Providers, SDKs and the engine communicate support for integers via
`AcceptsIntegers` fields in their interfaces (or similar). When
transmitting to a peer that doesn't support integers (e.g. an old SDK,
or old provider) all integer values are mapped back to standard number
values.

As this changes the serialisation of property values in the state file
it will trigger errors if old engines try to load a state file
containing integers.
2024-08-23 13:36:45 +01:00
..
format all: Assert => Assertf 2023-03-03 14:37:43 -08:00
pretty Enable perfsprint linter (#14813) 2023-12-12 12:19:42 +00:00
attribute.go Do not panic when PCL attribute type or PCL resource variable type isn't fully bound 2023-04-12 18:19:57 +02:00
binder_expression.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
binder_expression_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
block.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
body.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
diagnostics.go Handle recursive types 2023-01-13 11:28:13 -08:00
expression.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
functions.go Initial implementation of simplified invokes for dotnet and nodejs 2023-01-11 14:17:14 -08:00
print_test.go [program-gen/pcl] Avoid pretty printing large object graphs when encountering bind error in resource properties (#14864) 2023-12-20 01:20:42 +00:00
printer.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
scope.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
spec.md Add an HCL2 static typechecker and semantic model. (#4087) 2020-03-18 09:28:57 -07:00
traversable.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
type.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
type_collection.go Allow binding unsupported range and collection types in non-strict mode for pulumi convert 2023-07-12 19:13:57 +02:00
type_const.go Enable perfsprint linter (#14813) 2023-12-12 12:19:42 +00:00
type_enum.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
type_eventuals.go [program-gen] Fix stack overflow when binding invoke that resolves to promise (#15463) 2024-02-20 15:49:08 +00:00
type_list.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_map.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_none.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_object.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
type_opaque.go Support for integers on the wire and state protocol 2024-08-23 13:36:45 +01:00
type_opaque_test.go [codegen] simplify opaque types to string newtype (#9770) 2022-06-13 11:13:03 -07:00
type_output.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_promise.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_scope.go Support map(any) in config/output types 2023-04-06 21:15:20 +01:00
type_set.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_test.go Allow case insensitive prop typecheck on traversal 2022-11-08 09:08:12 -08:00
type_tuple.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
type_union.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
type_union_test.go Fix stack overflow panic when pretty printing recursive types 2023-05-11 16:28:16 +02:00
utilities.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
visitor.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00