Comments (2)
Okay, this isn't a Getty issue, but a Getty JSON issue.
The pointer tests, which deserialize into the aforementioned types, all pass even though my repro code doesn't because the test deserializer they use implements both deserializeSeq
and deserializeString
with deserializeAny
. That means that deserialization is driven by the deserializer's input data:
- If a sequence is encountered,
visitSeq
is called in the pointer visitor. - If a string is encountered,
visitString
is called in the pointer visitor.
As a result, strings can be deserialized from either sequences or strings, which takes care of all string cases.
However, Getty JSON doesn't use deserializeAny
for sequences or strings. So, Getty is finding the child DB for the pointer type, seeing that it's an array, and calling deserializeSeq
, which in Getty JSON expects a JSON Array in the input, not a JSON String. Easiest fix I think is to just use deserializeAny
for strings and sequences in Getty JSON. Or, handle sequence and string tokens in either functions.
from getty.
Hmm, it might be better to check in the pointer DB if the type being deserialized into is a string. If so, then call deserializeString
in the visitor as that's probably what the user is expecting. I think that's a more reasonable default to have. It'd make the lives of deserializers easier as well.
from getty.
Related Issues (20)
- Add attributes support to enum types HOT 2
- Remove concepts and traits
- Large types with many fields hits backwards branches limit HOT 3
- Struct field without default value gets freed causing segmentation fault, even when "skipped" HOT 4
- Move logic in `getty.de.free` into Deserialization Blocks
- Build failure when depending on both getty and getty-json HOT 1
- Add support for 'untagged' attribute
- Add `isVariantAllocated` method to `UnionAccess`
- Make required methods optional HOT 3
- Avoid unnecessary allocations during deserialization HOT 1
- Investigate using arena allocators for deserialization HOT 1
- Type-defined SBTs do not use blocks for inner types HOT 1
- Remove type-defined tuples
- Remove `is` function in type-defined blocks
- Return interface value from aggregate serialization methods HOT 3
- Pass serializer into aggregate serialization interface methods
- `std.net.Address.resolveIP` doesn't work on Windows
- `getty.de.blocks.Pointer` does not respect type-defined attributes
- Properly slice sentinel-terminated strings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getty.