You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "theweipeng (via GitHub)" <gi...@apache.org> on 2025/02/13 10:34:01 UTC
[PR] feat(javascript): simplify the definition of object type description [fury]
theweipeng opened a new pull request, #2058:
URL: https://github.com/apache/fury/pull/2058
## What does this PR do?
It is hard to describe the type of a object, we should write some code like this:
```JavaScript
Type.object("example.foo", {
a: Type.string()
})
```
The `Type.xxx` APIs are very flexible but not easy to use.
This PR add some decorations to help simplifing the type definition. Now we can definition object type like this:
```JavaScript
@Decoration.object("example.foo")
class Foo {
@Decoration.int32
a: number;
}
const fury = new Fury({ refTracking: true });
const { serialize, deserialize } = fury.registerSerializer(Foo);
const foo = new Foo();
foo.a = 123;
const input = serialize(foo);
const result = deserialize(
input
);
expect(result instanceof Foo);
expect(result).toEqual({ a: 123 })
```
These decorations simply wraps the `Type.object`. Therefore, if we want to serialize a string or other primitive types, we can still use the `Type.xxx functions`. It is totally compatible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [PR] feat(javascript): simplify the definition of object type description [fury]
Posted by "Forchapeatl (via GitHub)" <gi...@apache.org>.
Forchapeatl commented on PR #2058:
URL: https://github.com/apache/fury/pull/2058#issuecomment-2661894900
@theweipeng , please open more javascript issues
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [PR] feat(javascript): simplify the definition of object type description [fury]
Posted by "theweipeng (via GitHub)" <gi...@apache.org>.
theweipeng merged PR #2058:
URL: https://github.com/apache/fury/pull/2058
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [PR] feat(javascript): simplify the definition of object type description [fury]
Posted by "theweipeng (via GitHub)" <gi...@apache.org>.
theweipeng commented on PR #2058:
URL: https://github.com/apache/fury/pull/2058#issuecomment-2661926670
> @theweipeng , please open more javascript issues
OK, I will open more
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org