-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Honour DataMember and DataContract attributes #3304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Update docs with resolve ordering information
- Split test into type name / property name
LGTM though.
This commit updates the behaviour of TypeNameResolver and PropertyMapping to respect the usage of DataMember and DataContract attributes for all requests. Prior behaviour to this commit was that indexing would honour DataMember attributes on a document due to the internal implementation of JSON.Net honouring them. With other requests such as Search however, where a Field type is used, the the resolution of the Field string name did not honour the attributes. Closes #3107
* Honour DataMember and DataContract attributes This commit updates the behaviour of TypeNameResolver and PropertyMapping to respect the usage of DataMember and DataContract attributes for all requests. Prior behaviour to this commit was that indexing would honour DataMember attributes on a document due to the internal implementation of JSON.Net honouring them. With other requests such as Search however, where a Field type is used, the resolution of the Field string name did not honour the attributes. Include behaviour in documentation Closes #3107 (cherry picked from commit 97455b8)
* Honour DataMember and DataContract attributes This commit updates the behaviour of TypeNameResolver and PropertyMapping to respect the usage of DataMember and DataContract attributes for all requests. Prior behaviour to this commit was that indexing would honour DataMember attributes on a document due to the internal implementation of JSON.Net honouring them. With other requests such as Search however, where a Field type is used, the resolution of the Field string name did not honour the attributes. Include behaviour in documentation Closes #3107 (cherry picked from commit 97455b8)
I'm using .NET Core 2.2 with NEST 7.0.1, and whenever I have a class with DataContract and DataMember on a nested property, the objects in the nested property array are created as Is there any way around this? I'd like to avoid creating extra classes with the same properties but different attributes. |
@D9001 It's best to open a separate issue about this and link to this PR; a comment is likely to end up being lost as it's not as visible as an issue. Please open an issue an provide as much detail as you can, ideally with a reproducible example, so that it helps understand more quickly. |
We have our own json.net serializer defined in NEST 7.5.1 and we are doing our own naming strategy that ignores DataMember Attributes (on purpose) and we are hitting our break points as expected. But we noticed that the models that are being serialized that have the data member name are preserved even though our naming strategy is hit.. Any idea why this would be happening in NEST 7, was working as expected in NEST 5. |
This commit updates the behaviour of TypeNameResolver and
PropertyMapping to respect the usage of DataMember and
DataContract attributes for all requests.
Prior behaviour to this commit was that indexing would honour
DataMember attributes on a document due to the internal implementation of
JSON.Net honouring them. With other requests such as Search however,
where a Field type is used, the the resolution of the Field string name did
not honour the attributes.
Closes #3107