Endpoint object serialisation overlooks a public field
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
After returning from the endpoint GET /issue/1
i expect the json to contain the field project
with the value 1.
As this is the value set in the DTO.
But it holds {}
Expected Behavior
I expect the serialisation to contain all fields with their value as described in the DTO Project
.
Steps To Reproduce
- Given the attached project, start the project
- Setup an issue at the endpoint
curl -X 'POST' \
'https://localhost:7174/issue/1' \
-H 'accept: */*' \
-H 'Content-Type: multipart/form-data' \
-F 'author=a' \
-F 'comment=b'
- Retrieve the issue via
GET /issue/1
. Now i expect thatprojectId
is set to 1 in the first element of the list
Exceptions (if any)
No response
.NET Version
7.0.100-preview.6.22352.1
Anything else?
.NET SDK:
Version: 7.0.100-preview.6.22352.1
Commit: 492644e08e
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.5
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/7.0.100-preview.6.22352.1/
Host:
Version: 7.0.0-preview.6.22324.4
Architecture: x64
Commit: d3fa592f6d
.NET SDKs installed:
6.0.400 [/usr/local/share/dotnet/sdk]
7.0.100-preview.6.22352.1 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0-preview.6.22330.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0-preview.6.22324.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
/Users/user/Documents/backend/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How to set a custom serializer to ever API endpoint (spring ...
In the book object I like to only serialize some fields. class book{ @JsonView(Views.someClass.class) public String name; public String ...
Read more >Everything You Need to Know About Java Serialization ...
Check out this post to learn everything you need to know about serialization in Java and what this looks like in code examples....
Read more >Jackson's @JsonView with SpringBoot Tutorial
This is what tells Jackson which instance variable of the class to serialize/de-serialize. Example : @JsonView(Views.Public.class) private ...
Read more >Serialization - .NET
In this article. Serialization is the process of converting the state of an object into a form that can be persisted or transported....
Read more >ObjectOutputStream example: A Java object serialization ...
Java object serialization is a feature of the JDK that is far too often overlooked. When a developer puts together a prototype or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@brunolins16 will try that one out
Works. @brunolins16 why isnt the implicit operation performed before the serialisation? IMHO the projection should be performed transparently. What edge case am i overlooking?
There should be an implicit operation defined on
Issue
with